• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Drawing
2
3
4## 概述
5
6Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 本模块采用屏幕物理像素单位px。本模块为单线程模型策略,需要调用方自行管理线程安全和上下文状态的切换。
7
8**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9
10**起始版本:** 8
11
12
13## 汇总
14
15
16### 文件
17
18| 名称 | 描述 |
19| -------- | -------- |
20| [drawing_bitmap.h](drawing__bitmap_8h.md) | 文件中定义了与位图相关的功能函数。 |
21| [drawing_brush.h](drawing__brush_8h.md) | 文件中定义了与画刷相关的功能函数。 |
22| [drawing_canvas.h](drawing__canvas_8h.md) | 文件中定义了与画布相关的功能函数。画布自带一个黑色,开启抗锯齿,不具备其他任何样式的默认画刷,当且仅当画布中主动设置的画刷和画笔都不存在时生效。非录制类型画布会将绘制指令直接绘制到绑定的位图中,录制类型画布会将绘制指令录制下来用于后续的回放。 |
23| [drawing_color.h](drawing__color_8h.md) | 文件中定义了与颜色相关的功能函数。 |
24| [drawing_color_filter.h](drawing__color__filter_8h.md) | 声明与绘图模块中的颜色滤波器对象相关的函数。 |
25| [drawing_error_code.h](drawing__error__code_8h.md) | 声明与绘图模块中的错误码相关的函数。 |
26| [drawing_color_space.h](drawing__color__space_8h.md) | 文件中定义了与颜色空间相关的功能函数。 |
27| [drawing_filter.h](drawing__filter_8h.md) | 声明与绘图模块中的滤波器对象相关的函数。 |
28| [drawing_font.h](drawing__font_8h.md) | 文件中定义了与字体相关的功能函数。 |
29| [drawing_font_collection.h](drawing__font__collection_8h.md) | 定义绘制模块中与字体集合相关的函数。 |
30| [drawing_font_mgr.h](drawing__font__mgr_8h.md) | 文件中定义了与字体管理相关的功能函数,用于加载和匹配系统中可用的字体。 |
31| [drawing_gpu_context.h](drawing__gpu__context_8h.md) | 声明与绘图模块中的图形处理器上下文对象相关的函数。 |
32| [drawing_image.h](drawing__image_8h.md) | 文件中定义了与图片相关的功能函数。 |
33| [drawing_image_filter.h](drawing__image__filter_8h.md) | 声明与绘图模块中的图像滤波器对象相关的函数。 |
34| [drawing_mask_filter.h](drawing__mask__filter_8h.md) | 声明与绘图模块中的对象相关的函数。 |
35| [drawing_matrix.h](drawing__matrix_8h.md) | 文件中定义了与矩阵相关的功能函数。 |
36| [drawing_memory_stream.h](drawing__memory__stream_8h.md) | 文件中定义了与内存流相关的功能函数。 |
37| [drawing_path.h](drawing__path_8h.md) | 文件中定义了与自定义路径相关的功能函数。 |
38| [drawing_path_effect.h](drawing__path__effect_8h.md) | 文件中定义了与路径效果相关的功能函数。 |
39| [drawing_pen.h](drawing__pen_8h.md) | 文件中定义了与画笔相关的功能函数。 |
40| [drawing_pixel_map.h](drawing__pixel__map_8h.md) | 声明与绘图模块中的像素图对象相关的函数。 |
41| [drawing_point.h](drawing__point_8h.md) | 文件中定义了与坐标点相关的功能函数。 |
42| [drawing_record_cmd.h](drawing__record__cmd_8h.md) | 文件中定义了与录制指令对象相关的功能函数。 |
43| [drawing_rect.h](drawing__rect_8h.md) | 文件中定义了与矩形相关的功能函数。 |
44| [drawing_region.h](drawing__region_8h.md) | 定义了与区域相关的功能函数,包括区域的创建,边界设置和销毁等。 |
45| [drawing_register_font.h](drawing__register__font_8h.md) | 定义绘制模块中字体管理器相关的函数。 |
46| [drawing_round_rect.h](drawing__round__rect_8h.md) | 文件中定义了与圆角矩形相关的功能函数。 |
47| [drawing_sampling_options.h](drawing__sampling__options_8h.md) | 文件中定义了与采样相关的功能函数。用于图片或者纹理等图像的采样。 |
48| [drawing_shader_effect.h](drawing__shader__effect_8h.md) | 声明与绘图模块中的着色器对象相关的函数。 |
49| [drawing_shadow_layer.h](drawing__shadow__layer_8h.md) | 声明与绘图模块中的阴影层对象相关的函数。 |
50| [drawing_surface.h](drawing__surface_8h.md) | 文件中定义与surface相关的功能函数,包括surface的创建、销毁和使用等。 |
51| [drawing_text_blob.h](drawing__text__blob_8h.md) | 文件中定义了与文字相关的功能函数。 |
52| [drawing_text_declaration.h](drawing__text__declaration_8h.md) | 提供2d 绘制文本相关的数据结构声明。 |
53| [drawing_text_font_descriptor.h](drawing__text__font__descriptor_8h.md) | 定义了字体信息的相关接口,比如获取字体信息,查找指定字体等。 |
54| [drawing_text_typography.h](drawing__text__typography_8h.md) | 定义绘制模块中排版相关的函数。 |
55| [drawing_typeface.h](drawing__typeface_8h.md) | 文件中定义了与字形相关的功能函数。 不同的平台有自己的默认字形,也可以从ttf文件解析出三方指定字形,如宋体、黑体字形等。 |
56| [drawing_types.h](drawing__types_8h.md) | 文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径。 |
57
58
59### 结构体
60
61| 名称 | 描述 |
62| -------- | -------- |
63| struct  [OH_Drawing_String](_o_h___drawing___string.md) | 采用UTF-16编码的字符串信息结构体。 |
64| struct  [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型。 |
65| struct  [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | 定义字体度量信息的结构体。 |
66| struct  [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) | 定义有关图形处理器上下文的选项。 |
67| struct  [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) | 结构体用于描述一块内存,描述文字和位置信息。 |
68| struct  [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | 用于描述占位符跨度的结构体。 |
69| struct  [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | 描述系统字体详细信息的结构体。 |
70| struct  [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | 文字行位置信息。 |
71| struct  [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md) | 备用字体信息结构体。 |
72| struct  [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md) | 备用字体集信息结构体。 |
73| struct  [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md) | 字重映射信息结构体。 |
74| struct  [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md) | 别名字体信息结构体。 |
75| struct  [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md) | 系统所支持的通用字体集信息结构体。 |
76| struct  [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) | 系统字体配置信息结构体。 |
77| struct  [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 定义字体样式信息的结构体。 |
78| struct  [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | 描述文本字体特征结构体。 |
79| struct  [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 |
80| struct  [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 定义一个二维的坐标点。 |
81| struct  [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) | 定义一个三维的坐标点。 |
82| struct  [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 定义图片信息结构体。 |
83| struct  [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | 定义矩形框样式结构体。 |
84
85
86### 类型定义
87
88| 名称 | 描述 |
89| -------- | -------- |
90| typedef struct [OH_Drawing_String](_o_h___drawing___string.md) [OH_Drawing_String](#oh_drawing_string) | 采用UTF-16编码的字符串信息结构体。 |
91| typedef enum [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) | 字体类型的枚举。 |
92| typedef struct [OH_Drawing_Array](#oh_drawing_array) [OH_Drawing_Array](#oh_drawing_array) | 定义数组对象, 用于存储多个同类型对象。 |
93| typedef struct [OH_Drawing_FontArguments](#oh_drawing_fontarguments) [OH_Drawing_FontArguments](#oh_drawing_fontarguments) | 用于描述字型参数。 |
94| typedef struct [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) | 定义指令录制工具,用于生成录制指令。 |
95| typedef struct [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) | 定义录制指令类, 用于存储录制指令的集合。 |
96| typedef enum [OH_Drawing_ErrorCode](#oh_drawing_errorcode)  [OH_Drawing_ErrorCode](#oh_drawing_errorcode) | 枚举本模块可能产生的错误码。 |
97| typedef enum [OH_Drawing_PathOpMode](#oh_drawing_pathopmode)  [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) | 路径操作类型枚举。 |
98| typedef enum [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags)  [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) | 路径测量获取相应矩阵信息维度枚举。 |
99| typedef enum [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode)  [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode) | 区域操作类型枚举。 |
100| typedef struct [OH_Drawing_ImageFilter](#oh_drawing_imagefilter)  [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) | 定义图像滤波器, 用于对构成图像像素的所有颜色位进行操作。 |
101| typedef struct [OH_Drawing_Filter](#oh_drawing_filter)  [OH_Drawing_Filter](#oh_drawing_filter) | 定义一个滤波器,用于存储颜色滤波器,蒙版滤波器和图像滤波器。 |
102| typedef struct [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)  [OH_Drawing_BitmapFormat](#oh_drawing_bitmapformat) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型。 |
103| typedef enum [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint)  [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint) | 源矩形区域约束类型枚举。 |
104| typedef enum [OH_Drawing_PointMode](#oh_drawing_pointmode)  [OH_Drawing_PointMode](#oh_drawing_pointmode) | 绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 |
105| typedef enum [OH_Drawing_VertexMode](#oh_drawing_vertexmode)  [OH_Drawing_VertexMode](#oh_drawing_vertexmode) | 用于指定如何解释给定顶点的几何形状的枚举类型。 |
106| typedef enum [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)  [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) | 画布裁剪方式的枚举集合。 |
107| typedef enum [OH_Drawing_FontEdging](#oh_drawing_fontedging)  [OH_Drawing_FontEdging](#oh_drawing_fontedging) | 字型边缘效果类型枚举。 |
108| typedef enum [OH_Drawing_FontHinting](#oh_drawing_fonthinting)  [OH_Drawing_FontHinting](#oh_drawing_fonthinting) | 字型轮廓效果类型枚举。 |
109| typedef struct [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)  [OH_Drawing_Font_Metrics](#oh_drawing_font_metrics) | 定义字体度量信息的结构体。 |
110| typedef struct [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)  [OH_Drawing_GpuContextOptions](#oh_drawing_gpucontextoptions) | 定义有关图形处理器上下文的选项。 |
111| typedef enum [OH_Drawing_BlurType](#oh_drawing_blurtype)  [OH_Drawing_BlurType](#oh_drawing_blurtype) | 蒙版滤波器模糊操作类型的枚举。 |
112| typedef enum [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit)  [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) | 矩阵缩放方式枚举。 |
113| typedef enum [OH_Drawing_PathDirection](#oh_drawing_pathdirection)  [OH_Drawing_PathDirection](#oh_drawing_pathdirection) | 添加闭合轮廓方向枚举。 |
114| typedef enum [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)  [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) | 定义路径的填充类型枚举。 |
115| typedef enum [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)  [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) | 用于指定路径添加模式的枚举类型。 |
116| typedef enum [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)  [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 |
117| typedef enum [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)  [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 |
118| typedef enum [OH_Drawing_CornerPos](#oh_drawing_cornerpos)  [OH_Drawing_CornerPos](#oh_drawing_cornerpos) | 用于描述圆角位置的枚举。 |
119| typedef enum [OH_Drawing_FilterMode](#oh_drawing_filtermode)  [OH_Drawing_FilterMode](#oh_drawing_filtermode) | 过滤模式枚举。 |
120| typedef enum [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)  [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) | 多级渐远纹理模式枚举。 |
121| typedef enum [OH_Drawing_TileMode](#oh_drawing_tilemode)  [OH_Drawing_TileMode](#oh_drawing_tilemode) | 着色器效果平铺模式的枚举。 |
122| typedef struct [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md)  [OH_Drawing_RunBuffer](#oh_drawing_runbuffer) | 结构体用于描述一块内存,描述文字和位置信息。 |
123| typedef struct [OH_Drawing_FontCollection](#oh_drawing_fontcollection)  [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | 用于加载字体。 |
124| typedef struct [OH_Drawing_Typography](#oh_drawing_typography)  [OH_Drawing_Typography](#oh_drawing_typography) | 用于管理排版的布局和显示等。 |
125| typedef struct [OH_Drawing_TextStyle](#oh_drawing_textstyle)  [OH_Drawing_TextStyle](#oh_drawing_textstyle) | 用于管理字体颜色、装饰等。 |
126| typedef struct [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)  [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) | 用于管理排版风格,如文字方向等。 |
127| typedef struct [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)  [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) | 用于创建[OH_Drawing_Typography](#oh_drawing_typography)。 |
128| typedef struct [OH_Drawing_TextBox](#oh_drawing_textbox)  [OH_Drawing_TextBox](#oh_drawing_textbox) | 用于接收文本框的矩形大小、方向和数量大小。 |
129| typedef struct [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)  [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) | 用于接收字体的位置和亲和性。 |
130| typedef struct [OH_Drawing_Range](#oh_drawing_range)  [OH_Drawing_Range](#oh_drawing_range) | 用于接收字体的起始位置和结束位置。 |
131| typedef struct [OH_Drawing_TextShadow](#oh_drawing_textshadow)  [OH_Drawing_TextShadow](#oh_drawing_textshadow) | 用于管理文本阴影。 |
132| typedef struct [OH_Drawing_FontParser](#oh_drawing_fontparser)  [OH_Drawing_FontParser](#oh_drawing_fontparser) | 用来解析系统字体文件。 |
133| typedef enum [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment)  [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) | 占位符垂直对齐枚举。 |
134| typedef struct [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md)  [OH_Drawing_PlaceholderSpan](#oh_drawing_placeholderspan) | 用于描述占位符跨度的结构体。 |
135| typedef enum [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)  [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) | 文本装饰样式枚举。 |
136| typedef enum [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)  [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) | 省略号样式枚举。 |
137| typedef enum [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy)  [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) | 文本的中断策略枚举。 |
138| typedef enum [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype)  [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) | 单词的断词方式枚举。 |
139| typedef enum [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle)  [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) | 矩形框高度样式枚举。 |
140| typedef enum [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)  [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) | 矩形框宽度样式枚举。 |
141| typedef struct [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)  [OH_Drawing_FontDescriptor](#oh_drawing_fontdescriptor) | 描述系统字体详细信息的结构体。 |
142| typedef struct [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)  [OH_Drawing_LineMetrics](#oh_drawing_linemetrics) | 文字行位置信息。 |
143| typedef struct [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md)  [OH_Drawing_FontFallbackInfo](#oh_drawing_fontfallbackinfo) | 备用字体信息结构体。 |
144| typedef struct [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md)  [OH_Drawing_FontFallbackGroup](#oh_drawing_fontfallbackgroup) | 备用字体集信息结构体。 |
145| typedef struct [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md)  [OH_Drawing_FontAdjustInfo](#oh_drawing_fontadjustinfo) | 字重映射信息结构体。 |
146| typedef struct [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md)  [OH_Drawing_FontAliasInfo](#oh_drawing_fontaliasinfo) | 别名字体信息结构体。 |
147| typedef struct [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md)  [OH_Drawing_FontGenericInfo](#oh_drawing_fontgenericinfo) | 系统所支持的通用字体集信息结构体。 |
148| typedef struct [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md)  [OH_Drawing_FontConfigInfo](#oh_drawing_fontconfiginfo) | 系统字体配置信息结构体。 |
149| typedef struct [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md)  [OH_Drawing_FontStyleStruct](#oh_drawing_fontstylestruct) | 定义字体样式信息的结构体。 |
150| typedef struct [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)  [OH_Drawing_StrutStyle](#oh_drawing_strutstyle) | 用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 |
151| typedef struct [OH_Drawing_Canvas](#oh_drawing_canvas)  [OH_Drawing_Canvas](#oh_drawing_canvas) | 定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 |
152| typedef struct [OH_Drawing_Pen](#oh_drawing_pen)  [OH_Drawing_Pen](#oh_drawing_pen) | 定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 |
153| typedef struct [OH_Drawing_Region](#oh_drawing_region)  [OH_Drawing_Region](#oh_drawing_region) | 定义一个区域,用于表示画布上的封闭区域,实现更精确的图形控制。 |
154| typedef struct [OH_Drawing_Brush](#oh_drawing_brush)  [OH_Drawing_Brush](#oh_drawing_brush) | 定义为画刷,画刷用于描述填充图形的样式和颜色。 |
155| typedef struct [OH_Drawing_Path](#oh_drawing_path)  [OH_Drawing_Path](#oh_drawing_path) | 定义为路径,路径用于自定义各种形状。 |
156| typedef struct [OH_Drawing_PixelMap](#oh_drawing_pixelmap)  [OH_Drawing_PixelMap](#oh_drawing_pixelmap) | 定义像素图,用于包装图像框架支持的真实像素图。 |
157| typedef struct [OH_Drawing_Bitmap](#oh_drawing_bitmap)  [OH_Drawing_Bitmap](#oh_drawing_bitmap) | 定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 |
158| typedef struct [OH_Drawing_Point](#oh_drawing_point)  [OH_Drawing_Point](#oh_drawing_point) | 定义一个点,用于描述坐标点。 |
159| typedef struct [OH_Drawing_ColorSpace](#oh_drawing_colorspace)  [OH_Drawing_ColorSpace](#oh_drawing_colorspace) | 定义色彩空间,用于解释颜色信息。 |
160| typedef struct [OH_Drawing_Point2D](_o_h___drawing___point2_d.md)  [OH_Drawing_Point2D](#oh_drawing_point2d) | 定义一个二维的坐标点。 |
161| typedef [OH_Drawing_Point2D](_o_h___drawing___point2_d.md)  [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) | 定义一个圆角半径,该圆角半径由x轴方向和y轴方向上的半径组成。 |
162| typedef struct [OH_Drawing_Point3D](_o_h___drawing___point3_d.md)  [OH_Drawing_Point3D](#oh_drawing_point3d) | 定义一个三维的坐标点。 |
163| typedef struct [OH_Drawing_PathEffect](#oh_drawing_patheffect)  [OH_Drawing_PathEffect](#oh_drawing_patheffect) | 定义一个路径效果,用于影响描边路径。 |
164| typedef struct [OH_Drawing_Rect](#oh_drawing_rect)  [OH_Drawing_Rect](#oh_drawing_rect) | 用于描述矩形。 |
165| typedef struct [OH_Drawing_RoundRect](#oh_drawing_roundrect)  [OH_Drawing_RoundRect](#oh_drawing_roundrect) | 用于描述圆角矩形。 |
166| typedef struct [OH_Drawing_Matrix](#oh_drawing_matrix)  [OH_Drawing_Matrix](#oh_drawing_matrix) | 定义一个矩阵,用于描述坐标变换。 |
167| typedef struct [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)  [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) | 定义一个着色器,用于描述绘制内容的源颜色。 |
168| typedef struct [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer)  [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) | 定义一个阴影层,用于描述绘制内容的阴影层。 |
169| typedef struct [OH_Drawing_Filter](#oh_drawing_filter)  [OH_Drawing_Filter](#oh_drawing_filter) | 定义一个滤波器,用于存储颜色滤波器和蒙版滤波器。 |
170| typedef struct [OH_Drawing_MaskFilter](#oh_drawing_maskfilter)  [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) | 定义蒙版滤波器。 |
171| typedef struct [OH_Drawing_ColorFilter](#oh_drawing_colorfilter)  [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) | 定义颜色滤波器,传入一个颜色并返回一个新的颜色。 |
172| typedef struct [OH_Drawing_Font](#oh_drawing_font)  [OH_Drawing_Font](#oh_drawing_font) | 用于描述字体。 |
173| typedef struct [OH_Drawing_MemoryStream](#oh_drawing_memorystream)  [OH_Drawing_MemoryStream](#oh_drawing_memorystream) | 用于描述内存流。 |
174| typedef struct [OH_Drawing_Typeface](#oh_drawing_typeface)  [OH_Drawing_Typeface](#oh_drawing_typeface) | 用于描述字形。 |
175| typedef struct [OH_Drawing_TextBlob](#oh_drawing_textblob)  [OH_Drawing_TextBlob](#oh_drawing_textblob) | 定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。 |
176| typedef struct [OH_Drawing_Image](#oh_drawing_image)  [OH_Drawing_Image](#oh_drawing_image) | 定义一个用于描述绘制二维像素数组的图片。 |
177| typedef struct [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)  [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) | 定义一个采样选项,用于描述图片、位图等图像的采样方法。 |
178| typedef struct [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder)  [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) | 定义文本构建器,用于构建文本。 |
179| typedef struct [OH_Drawing_GpuContext](#oh_drawing_gpucontext)  [OH_Drawing_GpuContext](#oh_drawing_gpucontext) | 定义图形处理器上下文,用于描述图形处理器后端上下文。 |
180| typedef struct [OH_Drawing_Surface](#oh_drawing_surface)  [OH_Drawing_Surface](#oh_drawing_surface) | 定义surface,用于管理画布绘制的内容。 |
181| typedef enum [OH_Drawing_ColorFormat](#oh_drawing_colorformat)  [OH_Drawing_ColorFormat](#oh_drawing_colorformat) | 用于描述位图像素的存储格式。 |
182| typedef enum [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat)  [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) | 用于描述位图像素的透明度分量。 |
183| typedef enum [OH_Drawing_BlendMode](#oh_drawing_blendmode)  [OH_Drawing_BlendMode](#oh_drawing_blendmode) | 混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在红、绿、蓝3个颜色通道上是相同的(透明度有另外的处理规则)。 |
184| typedef struct [OH_Drawing_Image_Info](_o_h___drawing___image___info.md)  [OH_Drawing_Image_Info](#oh_drawing_image_info) | 定义图片信息结构体。 |
185| typedef struct [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md)  [OH_Drawing_RectStyle_Info](#oh_drawing_rectstyle_info) | 定义矩形框样式结构体。 |
186| typedef enum [OH_Drawing_TextEncoding](#oh_drawing_textencoding)  [OH_Drawing_TextEncoding](#oh_drawing_textencoding) | 文本编码类型枚举。 |
187| typedef struct [OH_Drawing_FontMgr](#oh_drawing_fontmgr)  [OH_Drawing_FontMgr](#oh_drawing_fontmgr) | 定义字体管理类, 用于字体管理。 |
188| typedef struct [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)  [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) | 定义字体样式集, 用于字体样式族匹配。 |
189| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | 阴影标志枚举。 |
190
191### 枚举
192
193| 名称 | 描述 |
194| -------- | -------- |
195| [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype-1) { ALL = 1 << 0, GENERIC = 1 << 1, STYLISH = 1 << 2, INSTALLED = 1 << 3 } | 字体类型的枚举。 |
196| [OH_Drawing_ErrorCode](#oh_drawing_errorcode-1) { OH_DRAWING_SUCCESS = 0, OH_DRAWING_ERROR_NO_PERMISSION = 201, OH_DRAWING_ERROR_INVALID_PARAMETER = 401, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE = 26200001,OH_DRAWING_ERROR_ALLOCATION_FAILED = 26200002 } | 枚举本模块可能产生的错误码。 |
197| [OH_Drawing_PathOpMode](#oh_drawing_pathopmode-1) {<br/>PATH_OP_MODE_DIFFERENCE, PATH_OP_MODE_INTERSECT, PATH_OP_MODE_UNION, PATH_OP_MODE_XOR,<br/>PATH_OP_MODE_REVERSE_DIFFERENCE<br/>} | 路径操作类型枚举。 |
198| [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags-1) { GET_POSITION_MATRIX, GET_TANGENT_MATRIX, GET_POSITION_AND_TANGENT_MATRIX } | 路径测量获取相应矩阵信息维度枚举。 |
199| [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode-1) {<br/>REGION_OP_MODE_DIFFERENCE, REGION_OP_MODE_INTERSECT, REGION_OP_MODE_UNION, REGION_OP_MODE_XOR,<br/>REGION_OP_MODE_REVERSE_DIFFERENCE, REGION_OP_MODE_REPLACE<br/>} | 区域操作类型枚举。 |
200| [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1) { STRICT_SRC_RECT_CONSTRAINT, FAST_SRC_RECT_CONSTRAINT } | 源矩形区域约束类型枚举。 |
201| [OH_Drawing_PointMode](#oh_drawing_pointmode-1) { POINT_MODE_POINTS, POINT_MODE_LINES, POINT_MODE_POLYGON } | 绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 |
202| [OH_Drawing_VertexMode](#oh_drawing_vertexmode-1) { VERTEX_MODE_TRIANGLES, VERTEX_MODE_TRIANGLESSTRIP, VERTEX_MODE_TRIANGLEFAN } | 用于指定如何解释给定顶点的几何形状的枚举类型。 |
203| [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop-1) { DIFFERENCE, INTERSECT } | 画布裁剪方式的枚举集合。 |
204| [OH_Drawing_FontEdging](#oh_drawing_fontedging-1) { FONT_EDGING_ALIAS, FONT_EDGING_ANTI_ALIAS, FONT_EDGING_SUBPIXEL_ANTI_ALIAS } | 字型边缘效果类型枚举。 |
205| [OH_Drawing_FontHinting](#oh_drawing_fonthinting-1) { FONT_HINTING_NONE, FONT_HINTING_SLIGHT, FONT_HINTING_NORMAL, FONT_HINTING_FULL } | 字型轮廓效果类型枚举。 |
206| [OH_Drawing_BlurType](#oh_drawing_blurtype-1) { NORMAL, SOLID, OUTER, INNER } | 蒙版滤波器模糊操作类型的枚举。 |
207| [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit-1) { SCALE_TO_FIT_FILL, SCALE_TO_FIT_START, SCALE_TO_FIT_CENTER, SCALE_TO_FIT_END } | 矩阵缩放方式枚举。 |
208| [OH_Drawing_PathDirection](#oh_drawing_pathdirection-1) { PATH_DIRECTION_CW, PATH_DIRECTION_CCW } | 添加闭合轮廓方向枚举。 |
209| [OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1) { PATH_FILL_TYPE_WINDING, PATH_FILL_TYPE_EVEN_ODD, PATH_FILL_TYPE_INVERSE_WINDING, PATH_FILL_TYPE_INVERSE_EVEN_ODD } | 定义路径的填充类型枚举。 |
210| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode-1) { PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND } | 用于指定路径添加模式的枚举类型。 |
211| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle-1) { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 |
212| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle-1) { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 |
213| [OH_Drawing_CornerPos](#oh_drawing_cornerpos-1) { CORNER_POS_TOP_LEFT, CORNER_POS_TOP_RIGHT, CORNER_POS_BOTTOM_RIGHT, CORNER_POS_BOTTOM_LEFT } | 用于描述圆角位置的枚举。 |
214| [OH_Drawing_FilterMode](#oh_drawing_filtermode-1) { FILTER_MODE_NEAREST, FILTER_MODE_LINEAR } | 过滤模式枚举。 |
215| [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode-1) { MIPMAP_MODE_NONE, MIPMAP_MODE_NEAREST, MIPMAP_MODE_LINEAR } | 多级渐远纹理模式枚举。 |
216| [OH_Drawing_TileMode](#oh_drawing_tilemode-1) { CLAMP, REPEAT, MIRROR, DECAL } | 着色器效果平铺模式的枚举。 |
217| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | 文字方向。 |
218| [OH_Drawing_TextAlign](#oh_drawing_textalign) {<br/>TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY,<br/>TEXT_ALIGN_START, TEXT_ALIGN_END<br/>} | 文字对齐方式。 |
219| [OH_Drawing_FontWeight](#oh_drawing_fontweight) {<br/>FONT_WEIGHT_100, FONT_WEIGHT_200, FONT_WEIGHT_300, FONT_WEIGHT_400,<br/>FONT_WEIGHT_500, FONT_WEIGHT_600, FONT_WEIGHT_700, FONT_WEIGHT_800,<br/>FONT_WEIGHT_900<br/>} | 字重。 |
220| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | 基线位置。 |
221| [OH_Drawing_TextDecoration](#oh_drawing_textdecoration) { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } | 文本装饰。 |
222| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC, FONT_STYLE_OBLIQUE } | 区分字体是否为斜体。 |
223| [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment-1) {<br/>ALIGNMENT_OFFSET_AT_BASELINE, ALIGNMENT_ABOVE_BASELINE, ALIGNMENT_BELOW_BASELINE, ALIGNMENT_TOP_OF_ROW_BOX,<br/>ALIGNMENT_BOTTOM_OF_ROW_BOX, ALIGNMENT_CENTER_OF_ROW_BOX<br/>} | 占位符垂直对齐枚举。 |
224| [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle-1) {<br/>TEXT_DECORATION_STYLE_SOLID, TEXT_DECORATION_STYLE_DOUBLE, TEXT_DECORATION_STYLE_DOTTED, TEXT_DECORATION_STYLE_DASHED,<br/>TEXT_DECORATION_STYLE_WAVY<br/>} | 文本装饰样式枚举。 |
225| [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal-1) { ELLIPSIS_MODAL_HEAD = 0, ELLIPSIS_MODAL_MIDDLE = 1, ELLIPSIS_MODAL_TAIL = 2 } | 省略号样式枚举。 |
226| [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy-1) { BREAK_STRATEGY_GREEDY = 0, BREAK_STRATEGY_HIGH_QUALITY = 1, BREAK_STRATEGY_BALANCED = 2 } | 文本的中断策略枚举。 |
227| [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype-1) { WORD_BREAK_TYPE_NORMAL = 0, WORD_BREAK_TYPE_BREAK_ALL = 1, WORD_BREAK_TYPE_BREAK_WORD = 2 } | 单词的断词方式枚举。 |
228| [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle-1) {<br/>RECT_HEIGHT_STYLE_TIGHT, RECT_HEIGHT_STYLE_MAX, RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, RECT_HEIGHT_STYLE_INCLUDELINESPACETOP,<br/>RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, RECT_HEIGHT_STYLE_STRUCT<br/>} | 矩形框高度样式枚举。 |
229| [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle-1) { RECT_WIDTH_STYLE_TIGHT, RECT_WIDTH_STYLE_MAX } | 矩形框宽度样式枚举。 |
230| [OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode) {<br/>SUCCESS_FONT_CONFIG_INFO = 0, ERROR_FONT_CONFIG_INFO_UNKNOWN = 1, ERROR_FONT_CONFIG_INFO_PARSE_FILE = 2, ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY = 3,<br/>ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA = 4<br/>} | 获取系统字体配置信息列表结果枚举。 |
231| [OH_Drawing_FontWidth](#oh_drawing_fontwidth) {<br/>ULTRA_CONDENSED_WIDTH = 1, EXTRA_CONDENSED_WIDTH = 2, CONDENSED_WIDTH = 3, SEMI_CONDENSED_WIDTH = 4,<br/>NORMAL_WIDTH = 5, SEMI_EXPANDED_WIDTH = 6, EXPANDED_WIDTH = 7, EXTRA_EXPANDED_WIDTH = 8,<br/>ULTRA_EXPANDED_WIDTH = 9<br/>} | 字体宽度的枚举。 |
232| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) { TEXT_HEIGHT_ALL = 0x0, TEXT_HEIGHT_DISABLE_FIRST_ASCENT = 0x1, TEXT_HEIGHT_DISABLE_LAST_ASCENT = 0x2, TEXT_HEIGHT_DISABLE_ALL = 0x1 \| 0x2 } | 文本高度修饰符模式枚举。 |
233| [OH_Drawing_TextStyleType](#oh_drawing_textstyletype) {<br/>TEXT_STYLE_NONE, TEXT_STYLE_ALL_ATTRIBUTES, TEXT_STYLE_FONT, TEXT_STYLE_FOREGROUND,<br/>TEXT_STYLE_BACKGROUND, TEXT_STYLE_SHADOW, TEXT_STYLE_DECORATIONS, TEXT_STYLE_LETTER_SPACING,<br/>TEXT_STYLE_WORD_SPACING<br/>} | 文本样式类型枚举。 |
234| [OH_Drawing_ColorFormat](#oh_drawing_colorformat-1) {<br/>COLOR_FORMAT_UNKNOWN, COLOR_FORMAT_ALPHA_8, COLOR_FORMAT_RGB_565, COLOR_FORMAT_ARGB_4444,<br/>COLOR_FORMAT_RGBA_8888, COLOR_FORMAT_BGRA_8888<br/>} | 用于描述位图像素的存储格式。 |
235| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat-1) { ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL } | 用于描述位图像素的透明度分量。 |
236| [OH_Drawing_BlendMode](#oh_drawing_blendmode-1) {<br/>BLEND_MODE_CLEAR, BLEND_MODE_SRC, BLEND_MODE_DST, BLEND_MODE_SRC_OVER,<br/>BLEND_MODE_DST_OVER, BLEND_MODE_SRC_IN, BLEND_MODE_DST_IN, BLEND_MODE_SRC_OUT,<br/>BLEND_MODE_DST_OUT, BLEND_MODE_SRC_ATOP, BLEND_MODE_DST_ATOP, BLEND_MODE_XOR,<br/>BLEND_MODE_PLUS, BLEND_MODE_MODULATE, BLEND_MODE_SCREEN, BLEND_MODE_OVERLAY,<br/>BLEND_MODE_DARKEN, BLEND_MODE_LIGHTEN, BLEND_MODE_COLOR_DODGE, BLEND_MODE_COLOR_BURN,<br/>BLEND_MODE_HARD_LIGHT, BLEND_MODE_SOFT_LIGHT, BLEND_MODE_DIFFERENCE, BLEND_MODE_EXCLUSION,<br/>BLEND_MODE_MULTIPLY, BLEND_MODE_HUE, BLEND_MODE_SATURATION, BLEND_MODE_COLOR,<br/>BLEND_MODE_LUMINOSITY<br/>} | 混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在红、绿、蓝3个颜色通道上是相同的(透明度有另外的处理规则)。 |
237| [OH_Drawing_TextEncoding](#oh_drawing_textencoding-1) { TEXT_ENCODING_UTF8, TEXT_ENCODING_UTF16, TEXT_ENCODING_UTF32, TEXT_ENCODING_GLYPH_ID } | 文本编码类型枚举。 |
238| [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags-1) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | 阴影标志枚举。 |
239
240### 函数
241
242| 名称 | 描述 |
243| -------- | -------- |
244| [OH_Drawing_Surface](#oh_drawing_surface) \* [OH_Drawing_SurfaceCreateOnScreen](#oh_drawing_surfacecreateonscreen) ([OH_Drawing_GpuContext](#oh_drawing_gpucontext) \*gpuContext, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) imageInfo, void \*window) | 使用图形处理器上下文创建一个与屏幕窗口绑定的surface对象,用于管理画布绘制的内容。  |
245| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_SurfaceFlush](#oh_drawing_surfaceflush) ([OH_Drawing_Surface](#oh_drawing_surface) \*surface) | 将surface对象上的画布绘制内容提交给GPU处理,完成绘制内容上屏显示。  |
246| [OH_Drawing_GpuContext](#oh_drawing_gpucontext) \* [OH_Drawing_GpuContextCreate](#oh_drawing_gpucontextcreate) (void) | 用于创建一个图形处理器上下文对象, 使用的后端类型取决于运行设备。  |
247| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontSetThemeFontFollowed](#oh_drawing_fontsetthemefontfollowed) ([OH_Drawing_Font](#oh_drawing_font) \*font, bool followed) | 设置字型中的字体是否跟随主题字体。设置跟随主题字体后,若系统启用主题字体并且字型未被设置字体,字型会使用该主题字体。 |
248| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontIsThemeFontFollowed](#oh_drawing_fontisthemefontfollowed) (const [OH_Drawing_Font](#oh_drawing_font) \*font, bool \*followed) | 获取字型中的字体是否跟随主题字体。默认不跟随主题字体。 |
249| OH_Drawing_FontCollection \* [OH_Drawing_GetFontCollectionGlobalInstance](#oh_drawing_getfontcollectionglobalinstance) (void) | 获取全局字体集对象OH_Drawing_FontCollection,可感知主题字信息,禁止释放该对象。  |
250| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | 用于创建一个位图对象。 |
251| void [OH_Drawing_BitmapDestroy](#oh_drawing_bitmapdestroy) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于销毁位图对象并回收该对象占有内存。 |
252| [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) | 用于创建一个位图对象,并将位图像素存储内存地址设置为开发者申请内存的地址。 |
253| 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) \*) | 用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 |
254| uint32_t [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的宽度。 |
255| uint32_t [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的高度。 |
256| [OH_Drawing_ColorFormat](#oh_drawing_colorformat) [OH_Drawing_BitmapGetColorFormat](#oh_drawing_bitmapgetcolorformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素存储格式。 |
257| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) [OH_Drawing_BitmapGetAlphaFormat](#oh_drawing_bitmapgetalphaformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素透明度分量。 |
258| void \* [OH_Drawing_BitmapGetPixels](#oh_drawing_bitmapgetpixels) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 |
259| void [OH_Drawing_BitmapGetImageInfo](#oh_drawing_bitmapgetimageinfo) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | 用于获取指定位图的信息。 |
260| 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) | 将位图中的矩形区域像素数据读取到指定的内存缓冲区中。 |
261| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | 用于创建一个画刷对象。 |
262| [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),用于拷贝一个已有画刷对象。 |
263| void [OH_Drawing_BrushDestroy](#oh_drawing_brushdestroy) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于销毁画刷对象并回收该对象占有的内存。 |
264| bool [OH_Drawing_BrushIsAntiAlias](#oh_drawing_brushisantialias) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
265| void [OH_Drawing_BrushSetAntiAlias](#oh_drawing_brushsetantialias) ([OH_Drawing_Brush](#oh_drawing_brush) \*, bool) | 用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
266| uint32_t [OH_Drawing_BrushGetColor](#oh_drawing_brushgetcolor) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 |
267| void [OH_Drawing_BrushSetColor](#oh_drawing_brushsetcolor) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint32_t color) | 用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 |
268| uint8_t [OH_Drawing_BrushGetAlpha](#oh_drawing_brushgetalpha) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。 |
269| void [OH_Drawing_BrushSetAlpha](#oh_drawing_brushsetalpha) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint8_t alpha) | 为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。 |
270| void [OH_Drawing_BrushSetShaderEffect](#oh_drawing_brushsetshadereffect) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 为画刷设置着色器效果。 |
271| void [OH_Drawing_BrushSetShadowLayer](#oh_drawing_brushsetshadowlayer) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 为画刷设置阴影层,设置的阴影层效果当前仅在绘制文字时生效。 |
272| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 |
273| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 |
274| void [OH_Drawing_BrushSetBlendMode](#oh_drawing_brushsetblendmode) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 为画刷设置一个混合器,该混合器实现了指定的混合模式枚举。 |
275| void [OH_Drawing_BrushReset](#oh_drawing_brushreset) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 将画刷重置至初始状态,清空所有已设置的属性。 |
276| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | 用于创建一个画布对象。 |
277| void [OH_Drawing_CanvasDestroy](#oh_drawing_canvasdestroy) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于销毁画布对象并回收该对象占有的内存。 |
278| void [OH_Drawing_CanvasBind](#oh_drawing_canvasbind) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 |
279| void [OH_Drawing_CanvasAttachPen](#oh_drawing_canvasattachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。执行该方法后,若画笔的效果发生改变并且开发者希望该变化生效于接下来的绘制动作,需要再次执行该方法以确保变化生效。 |
280| void [OH_Drawing_CanvasDetachPen](#oh_drawing_canvasdetachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 |
281| void [OH_Drawing_CanvasAttachBrush](#oh_drawing_canvasattachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。执行该方法后,若画刷的效果发生改变并且开发者希望该变化生效于接下来的绘制动作,需要再次执行该方法以确保变化生效。 |
282| void [OH_Drawing_CanvasDetachBrush](#oh_drawing_canvasdetachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画刷,使用后画布将不使用此前设置的画刷去填充图形形状。 |
283| void [OH_Drawing_CanvasSave](#oh_drawing_canvassave) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于保存当前画布的状态(画布矩阵)到一个栈顶。需要与恢复接口[OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)配合使用。 |
284| 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)将放弃对矩阵和剪切区域所做的更改,并绘制位图。 |
285| void [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于恢复保存在栈顶的画布状态(画布矩阵)。 |
286| uint32_t [OH_Drawing_CanvasGetSaveCount](#oh_drawing_canvasgetsavecount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于获取栈中保存的画布状态(画布矩阵)的数量。 |
287| void [OH_Drawing_CanvasRestoreToCount](#oh_drawing_canvasrestoretocount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t saveCount) | 用于恢复到指定数量的画布状态(画布矩阵)。 |
288| void [OH_Drawing_CanvasDrawLine](#oh_drawing_canvasdrawline) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float x1, float y1, float x2, float y2) | 用于画一条直线段。 |
289| void [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | 用于画一个自定义路径。 |
290| 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) \*) | 用于将像素图的指定区域绘制到画布的指定区域。 |
291| void [OH_Drawing_CanvasDrawBackground](#oh_drawing_canvasdrawbackground) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于画一个背景,此背景以画刷填充。 |
292| void [OH_Drawing_CanvasDrawRegion](#oh_drawing_canvasdrawregion) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Region](#oh_drawing_region) \*) | 用于画一块区域。 |
293| [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) | 用于画一个点。 |
294| 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) \*) | 用于画多个点,绘制方式分为绘制单独的点、绘制成线段或绘制成开放多边形。 |
295| void [OH_Drawing_CanvasDrawBitmap](#oh_drawing_canvasdrawbitmap) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, float left, float top) | 用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。 |
296| 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) \*) | 将位图的指定区域绘制到画布的指定区域。 |
297| void [OH_Drawing_CanvasSetMatrix](#oh_drawing_canvassetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 设置画布的矩阵状态。 |
298| void [OH_Drawing_CanvasResetMatrix](#oh_drawing_canvasresetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 重置当前画布的矩阵为单位矩阵。 |
299| 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)) | 将图片绘制到画布的指定区域上,源矩形选定的区域会缩放平移到目标矩形。 |
300| 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) \*) | 将图片绘制到画布的指定区域上。 |
301| 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) | 用于画顶点数组描述的三角网格。 |
302| 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) | 从画布中拷贝像素数据到指定地址。该接口不可用于录制类型画布。 |
303| 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) | 从画布拷贝像素数据到位图中。该接口不可用于录制类型画布。 |
304| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasIsClipEmpty](#oh_drawing_canvasisclipempty) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, bool \*isClipEmpty) | 用于判断裁剪后可绘制区域是否为空。 |
305| [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) | 用于获取画布的图像信息。 |
306| void [OH_Drawing_CanvasDrawRect](#oh_drawing_canvasdrawrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个矩形。 |
307| void [OH_Drawing_CanvasDrawCircle](#oh_drawing_canvasdrawcircle) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Point](#oh_drawing_point) \*, float radius) | 用于画一个圆形。 |
308| [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) | 用于使用指定的颜色及混合模式来填充整个画布。 |
309| void [OH_Drawing_CanvasDrawOval](#oh_drawing_canvasdrawoval) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个椭圆。 |
310| void [OH_Drawing_CanvasDrawArc](#oh_drawing_canvasdrawarc) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | 用于画一个弧。当扫描角度的绝对值大于360度时,本接口绘制的是一个椭圆。 |
311| void [OH_Drawing_CanvasDrawRoundRect](#oh_drawing_canvasdrawroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于画一个圆角矩形。 |
312| [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) | 用于绘制单个字符。当前字型中的字体不支持待绘制字符时,退化到使用系统字体绘制字符。 |
313| 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的字体不支持待绘制字符,则该部分字符无法绘制。 |
314| uint32_t [OH_Drawing_ColorSetArgb](#oh_drawing_colorsetargb) (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | 用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 |
315| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateBlendMode](#oh_drawing_colorfiltercreateblendmode) (uint32_t color, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 创建具有混合模式的颜色滤波器。 |
316| [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) | 将两个颜色滤波器合成一个新的颜色滤波器。 |
317| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateMatrix](#oh_drawing_colorfiltercreatematrix) (const float matrix[20]) | 创建具有5x4颜色矩阵的颜色滤波器。 |
318| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLinearToSrgbGamma](#oh_drawing_colorfiltercreatelineartosrgbgamma) (void) | 创建一个从线性颜色空间转换到SRGB颜色空间的颜色滤波器。 |
319| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateSrgbGammaToLinear](#oh_drawing_colorfiltercreatesrgbgammatolinear) (void) | 创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。 |
320| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLuma](#oh_drawing_colorfiltercreateluma) (void) | 创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。 |
321| void [OH_Drawing_ColorFilterDestroy](#oh_drawing_colorfilterdestroy) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 销毁颜色滤波器对象,并收回该对象占用的内存。 |
322| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgb](#oh_drawing_colorspacecreatesrgb) (void) | 创建一个标准颜色空间。 |
323| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgbLinear](#oh_drawing_colorspacecreatesrgblinear) (void) | 创建一个Gamma 1.0空间上的颜色空间。 |
324| void [OH_Drawing_ColorSpaceDestroy](#oh_drawing_colorspacedestroy) ([OH_Drawing_ColorSpace](#oh_drawing_colorspace) \*) | 销毁颜色空间对象,并回收该对象占有内存。 |
325| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget) () | 获取本模块的错误码。 |
326| [OH_Drawing_Filter](#oh_drawing_filter) \* [OH_Drawing_FilterCreate](#oh_drawing_filtercreate) (void) | 创建一个滤波器对象。 |
327| void [OH_Drawing_FilterSetImageFilter](#oh_drawing_filtersetimagefilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | 为滤波器对象设置图像滤波器对象。 |
328| void [OH_Drawing_FilterSetMaskFilter](#oh_drawing_filtersetmaskfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 为滤波器对象设置蒙版滤波器对象。 |
329| void [OH_Drawing_FilterSetColorFilter](#oh_drawing_filtersetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 为滤波器对象设置颜色滤波器对象。 |
330| void [OH_Drawing_FilterGetColorFilter](#oh_drawing_filtergetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 从滤波器对象获取颜色滤波器对象。 |
331| void [OH_Drawing_FilterDestroy](#oh_drawing_filterdestroy) ([OH_Drawing_Filter](#oh_drawing_filter) \*) | 销毁滤波器对象,并收回该对象占用的内存。 |
332| void [OH_Drawing_FontSetBaselineSnap](#oh_drawing_fontsetbaselinesnap) ([OH_Drawing_Font](#oh_drawing_font) \*, bool baselineSnap) | 当前画布矩阵轴对齐时,将字型基线设置为是否与像素对齐。 |
333| bool [OH_Drawing_FontIsBaselineSnap](#oh_drawing_fontisbaselinesnap) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 当前画布矩阵轴对齐时,获取字型基线是否与像素对齐。 |
334| void [OH_Drawing_FontSetEdging](#oh_drawing_fontsetedging) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontEdging](#oh_drawing_fontedging)) | 用于设置字型边缘效果。 |
335| [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontGetEdging](#oh_drawing_fontgetedging) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型边缘效果。 |
336| void [OH_Drawing_FontSetForceAutoHinting](#oh_drawing_fontsetforceautohinting) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isForceAutoHinting) | 用于设置是否自动调整字型轮廓。 |
337| bool [OH_Drawing_FontIsForceAutoHinting](#oh_drawing_fontisforceautohinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型轮廓是否自动调整。 |
338| void [OH_Drawing_FontSetSubpixel](#oh_drawing_fontsetsubpixel) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isSubpixel) | 设置字型是否使用次像素渲染。 |
339| bool [OH_Drawing_FontIsSubpixel](#oh_drawing_fontissubpixel) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型是否使用次像素渲染。 |
340| [OH_Drawing_Font](#oh_drawing_font) \* [OH_Drawing_FontCreate](#oh_drawing_fontcreate) (void) | 用于创建一个字型对象。 |
341| void [OH_Drawing_FontSetTypeface](#oh_drawing_fontsettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于给字型设置字体。 |
342| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontGetTypeface](#oh_drawing_fontgettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*) | 获取字体对象。 |
343| void [OH_Drawing_FontSetTextSize](#oh_drawing_fontsettextsize) ([OH_Drawing_Font](#oh_drawing_font) \*, float textSize) | 用于给字型设置文字大小。 |
344| float [OH_Drawing_FontGetTextSize](#oh_drawing_fontgettextsize) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型文字大小。 |
345| 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) | 获取文本所表示的字符数量。 |
346| 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) | 用于将文本转换为字形索引。 |
347| void [OH_Drawing_FontGetWidths](#oh_drawing_fontgetwidths) (const [OH_Drawing_Font](#oh_drawing_font) \*, const uint16_t \*glyphs, int count, float \*widths) | 用于获取字符串中每个字符的宽度。 |
348| [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) | 用于测量单个字符的宽度。当前字型中的字体不支持待测量字符时,退化到使用系统字体测量字符宽度。 |
349| [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) | 用于获取文本的宽度和边界框。 |
350| void [OH_Drawing_FontSetLinearText](#oh_drawing_fontsetlineartext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isLinearText) | 用于设置线性可缩放字型。 |
351| bool [OH_Drawing_FontIsLinearText](#oh_drawing_fontislineartext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型是否使用线性缩放。 |
352| void [OH_Drawing_FontSetTextSkewX](#oh_drawing_fontsettextskewx) ([OH_Drawing_Font](#oh_drawing_font) \*, float skewX) | 用于给字型设置文本倾斜。 |
353| float [OH_Drawing_FontGetTextSkewX](#oh_drawing_fontgettextskewx) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型文本在x轴上的倾斜度。 |
354| void [OH_Drawing_FontSetFakeBoldText](#oh_drawing_fontsetfakeboldtext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isFakeBoldText) | 用于设置增加描边宽度以近似粗体字体效果。 |
355| bool [OH_Drawing_FontIsFakeBoldText](#oh_drawing_fontisfakeboldtext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取是否增加笔画宽度以接近粗体字体。 |
356| void [OH_Drawing_FontSetScaleX](#oh_drawing_fontsetscalex) ([OH_Drawing_Font](#oh_drawing_font) \*, float scaleX) | 用于设置字型对象在x轴上的缩放比例。 |
357| float [OH_Drawing_FontGetScaleX](#oh_drawing_fontgetscalex) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型对象在x轴上的缩放比例。 |
358| void [OH_Drawing_FontSetHinting](#oh_drawing_fontsethinting) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontHinting](#oh_drawing_fonthinting)) | 用于设置字型轮廓效果。 |
359| [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontGetHinting](#oh_drawing_fontgethinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型轮廓效果枚举类型。 |
360| void [OH_Drawing_FontSetEmbeddedBitmaps](#oh_drawing_fontsetembeddedbitmaps) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isEmbeddedBitmaps) | 用于设置字型是否转换成位图处理。 |
361| bool [OH_Drawing_FontIsEmbeddedBitmaps](#oh_drawing_fontisembeddedbitmaps) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型是否转换成位图处理。 |
362| void [OH_Drawing_FontDestroy](#oh_drawing_fontdestroy) ([OH_Drawing_Font](#oh_drawing_font) \*) | 用于销毁字型对象并回收该对象占有的内存。 |
363| float [OH_Drawing_FontGetMetrics](#oh_drawing_fontgetmetrics) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | 获取字体度量信息。 |
364| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | 创建字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 |
365| void [OH_Drawing_DestroyFontCollection](#oh_drawing_destroyfontcollection) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 释放被字体集对象占据的内存。 |
366| void [OH_Drawing_DisableFontCollectionFallback](#oh_drawing_disablefontcollectionfallback) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | 禁用备用字体。 |
367| void [OH_Drawing_DisableFontCollectionSystemFont](#oh_drawing_disablefontcollectionsystemfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | 禁用系统字体。 |
368| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection) (void) | 创建可共享的字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 |
369| void [OH_Drawing_ClearFontCaches](#oh_drawing_clearfontcaches) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 清理字体排版缓存(字体排版缓存本身设有内存上限和清理机制,所占内存有限,如无内存要求,不建议清理)。 |
370| [OH_Drawing_FontMgr](#oh_drawing_fontmgr) \* [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate) (void) | 构造字体管理对象。 |
371| void [OH_Drawing_FontMgrDestroy](#oh_drawing_fontmgrdestroy) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | 释放字体管理对象占用的内存。 |
372| int [OH_Drawing_FontMgrGetFamilyCount](#oh_drawing_fontmgrgetfamilycount) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | 获取字体家族的数量。 |
373| char \* [OH_Drawing_FontMgrGetFamilyName](#oh_drawing_fontmgrgetfamilyname) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | 由索引值获取字体家族名称。 |
374| void [OH_Drawing_FontMgrDestroyFamilyName](#oh_drawing_fontmgrdestroyfamilyname) (char \*familyName) | 释放指定字体家族名称占用的内存。 |
375| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrCreateFontStyleSet](#oh_drawing_fontmgrcreatefontstyleset) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | 由字体管理对象构造字体样式集对象。 |
376| void [OH_Drawing_FontMgrDestroyFontStyleSet](#oh_drawing_fontmgrdestroyfontstyleset) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | 释放字体样式集对象占用的内存。 |
377| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrMatchFamily](#oh_drawing_fontmgrmatchfamily) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName) | 由指定的字体家族名称,获取字体样式集对象。 |
378| [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)) | 根据指定的字体样式信息和字体家族名称,获取字型对象。 |
379| [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) | 为指定字符获取字型对象,仅在传入字体管理对象中无法找到传入UTF8字符值对应的字型对象时返回空指针。 |
380| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontStyleSetCreateTypeface](#oh_drawing_fontstylesetcreatetypeface) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*, int index) | 为指定索引获取字型对象。 |
381| [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) | 获取字体样式。 |
382| void [OH_Drawing_FontStyleSetFreeStyleName](#oh_drawing_fontstylesetfreestylename) (char \*\*styleName) | 释放指定字体样式的内存。 |
383| [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) | 获取最接近字体样式的字型对象。 |
384| int [OH_Drawing_FontStyleSetCount](#oh_drawing_fontstylesetcount) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | 获取字体样式集中字体的个数。 |
385| [OH_Drawing_GpuContext](#oh_drawing_gpucontext) \* [OH_Drawing_GpuContextCreateFromGL](#oh_drawing_gpucontextcreatefromgl) ([OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)) | 用于创建一个使用OpenGL作为后端接口的图形处理器上下文对象。 |
386| void [OH_Drawing_GpuContextDestroy](#oh_drawing_gpucontextdestroy) ([OH_Drawing_GpuContext](#oh_drawing_gpucontext) \*) | 用于销毁图形处理器上下文对象并回收该对象占用的内存。 |
387| [OH_Drawing_Image](#oh_drawing_image) \* [OH_Drawing_ImageCreate](#oh_drawing_imagecreate) (void) | 创建一个图片对象,描述了要绘制的二维像素数组。 |
388| void [OH_Drawing_ImageDestroy](#oh_drawing_imagedestroy) ([OH_Drawing_Image](#oh_drawing_image) \*) | 销毁图片对象并回收该对象占有内存。 |
389| bool [OH_Drawing_ImageBuildFromBitmap](#oh_drawing_imagebuildfrombitmap) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 从位图构造图片对象内容,共享或复制位图像素。如果位图被标记为不可变状态, 像素内存是共享的,不是复制。 |
390| int32_t [OH_Drawing_ImageGetWidth](#oh_drawing_imagegetwidth) ([OH_Drawing_Image](#oh_drawing_image) \*) | 获取图片宽度,即每行的像素个数。 |
391| int32_t [OH_Drawing_ImageGetHeight](#oh_drawing_imagegetheight) ([OH_Drawing_Image](#oh_drawing_image) \*) | 获取图片高度,即像素行数。 |
392| void [OH_Drawing_ImageGetImageInfo](#oh_drawing_imagegetimageinfo) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | 获取图片信息。调用该接口后,传入的图片信息对象被填充。 |
393| [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) | 创建具有模糊效果的图像滤波器。 |
394| [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) | 创建具有颜色变换效果的图像滤波器。 |
395| void [OH_Drawing_ImageFilterDestroy](#oh_drawing_imagefilterdestroy) ([OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | 销毁图像滤波器对象并回收该对象占有内存。 |
396| [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \* [OH_Drawing_MaskFilterCreateBlur](#oh_drawing_maskfiltercreateblur) ([OH_Drawing_BlurType](#oh_drawing_blurtype) blurType, float sigma, bool respectCTM) | 创建具有模糊效果的蒙版滤波器。 |
397| void [OH_Drawing_MaskFilterDestroy](#oh_drawing_maskfilterdestroy) ([OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 销毁蒙版滤波器对象,并收回该对象占用的内存。 |
398| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate) (void) | 用于创建一个矩阵对象。 |
399| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateRotation](#oh_drawing_matrixcreaterotation) (float deg, float x, float y) | 创建一个带旋转属性的矩阵对象。 该矩阵对象为:单位矩阵在(x, y)旋转点以度为单位进行旋转后得到的矩阵。 |
400| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateScale](#oh_drawing_matrixcreatescale) (float sx, float sy, float px, float py) | 创建一个带缩放属性的矩阵对象。 该矩阵对象为:单位矩阵在(px, py)旋转点以sx和sy为缩放因子进行缩放后得到的矩阵。 |
401| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateTranslation](#oh_drawing_matrixcreatetranslation) (float dx, float dy) | 创建一个带平移属性的矩阵对象。 该矩阵对象为:单位矩阵平移(dx, dy)后得到的矩阵。 |
402| 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) | 用于给矩阵对象设置参数。 |
403| 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) | 将矩阵以缩放方式适配目标矩阵。 |
404| void [OH_Drawing_MatrixPreRotate](#oh_drawing_matrixprerotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 将矩阵设置为矩阵左乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 |
405| void [OH_Drawing_MatrixPreScale](#oh_drawing_matrixprescale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | 将矩阵设置为矩阵左乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 |
406| void [OH_Drawing_MatrixPreTranslate](#oh_drawing_matrixpretranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 将矩阵设置为矩阵左乘平移一定距离后的单位矩阵后得到的矩阵。 |
407| void [OH_Drawing_MatrixPostRotate](#oh_drawing_matrixpostrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 将矩阵设置为矩阵右乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 |
408| void [OH_Drawing_MatrixPostScale](#oh_drawing_matrixpostscale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | 将矩阵设置为矩阵右乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 |
409| void [OH_Drawing_MatrixPostTranslate](#oh_drawing_matrixposttranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 将矩阵设置为矩阵右乘平移一定距离后的单位矩阵后得到的矩阵。 |
410| void [OH_Drawing_MatrixReset](#oh_drawing_matrixreset) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 重置当前矩阵为单位矩阵。 |
411| void [OH_Drawing_MatrixConcat](#oh_drawing_matrixconcat) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*total, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*a, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*b) | 将矩阵total设置为矩阵a乘以矩阵b。 例如给定矩阵a和矩阵b如下所示: \| A B C \| \| J K L \| a = \| D E F \|, b = \| M N O \| \| G H I \| \| P Q R \| 设置的最终矩阵total为: \| A B C \| \| J K L \| \| AJ+BM+CP AK+BN+CQ AL+BO+CR \| total = a \* b = \| D E F \| \* \| M N O \| = \| DJ+EM+FP DK+EN+FQ DL+EO+FR \| \| G H I \| \| P Q R \| \| GJ+HM+IP GK+HN+IQ GL+HO+IR \| |
412| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_MatrixGetAll](#oh_drawing_matrixgetall) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*matrix, float value[9]) | 获取矩阵所有元素值。 |
413| float [OH_Drawing_MatrixGetValue](#oh_drawing_matrixgetvalue) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, int index) | 获取矩阵给定索引位的值。索引范围0-8。 |
414| void [OH_Drawing_MatrixRotate](#oh_drawing_matrixrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点进行旋转。 |
415| void [OH_Drawing_MatrixTranslate](#oh_drawing_matrixtranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 设置矩阵为单位矩阵,并平移(dx, dy)。 |
416| 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进行缩放。 |
417| bool [OH_Drawing_MatrixInvert](#oh_drawing_matrixinvert) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*inverse) | 将矩阵inverse设置为矩阵的倒数,并返回结果。 |
418| 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。 |
419| 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) | 通过矩阵变换将源点数组映射到目标点数组。 |
420| 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) | 将目标矩形设置为一个新的矩形,该矩形是能够包围源矩形的四个顶点通过矩阵变换映射后形成的新顶点的最小矩形。 |
421| bool [OH_Drawing_MatrixIsEqual](#oh_drawing_matrixisequal) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*other) | 判断两个矩阵是否相等。 |
422| bool [OH_Drawing_MatrixIsIdentity](#oh_drawing_matrixisidentity) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 判断矩阵是否是单位矩阵。 |
423| void [OH_Drawing_MatrixDestroy](#oh_drawing_matrixdestroy) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 用于销毁矩阵对象并回收该对象占有的内存。 |
424| [OH_Drawing_MemoryStream](#oh_drawing_memorystream) \* [OH_Drawing_MemoryStreamCreate](#oh_drawing_memorystreamcreate) (const void \*data, size_t length, bool copyData) | 创建一个内存流对象。 |
425| void [OH_Drawing_MemoryStreamDestroy](#oh_drawing_memorystreamdestroy) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*) | 销毁内存流对象并回收该对象占有内存。 |
426| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | 用于创建一个路径对象。 |
427| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCopy](#oh_drawing_pathcopy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 创建一个路径对象副本[OH_Drawing_Path](#oh_drawing_path),用于拷贝一个已有路径对象。 |
428| void [OH_Drawing_PathDestroy](#oh_drawing_pathdestroy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于销毁路径对象并回收该对象占有的内存。 |
429| void [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于设置自定义路径的起始点位置。 |
430| void [OH_Drawing_PathLineTo](#oh_drawing_pathlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 |
431| 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) | 用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框, 矩形边框的内切椭圆将会被用来截取弧线,然后会指定一个起始角度和扫描度数, 从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。若路径有内容则会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 |
432| void [OH_Drawing_PathQuadTo](#oh_drawing_pathquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 |
433| 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)。 |
434| 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))到目标点位置的三阶贝塞尔圆滑曲线。 |
435| void [OH_Drawing_PathRMoveTo](#oh_drawing_pathrmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。 |
436| void [OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 |
437| void [OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 |
438| 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))到目标点位置的圆锥曲线段。 |
439| 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))到目标点位置的三阶贝塞尔圆滑曲线。 |
440| 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)) | 按指定方向,将矩形添加到路径中,添加的路径的起始点为矩形左上角。 |
441| 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) | 按指定方向,向路径添加矩形轮廓。 |
442| 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)) | 按指定方向,向路径添加圆角矩形轮廓。路径添加方向为顺时针时,起始点位于圆角矩形左下方圆角与左边界的交点;路径添加方向为逆时针时,起始点位于圆角矩形左上方圆角与左边界的交点。 |
443| 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)) | 将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。 |
444| void [OH_Drawing_PathAddArc](#oh_drawing_pathaddarc) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | 将圆弧添加到路径中,作为新轮廓的起点。从起始角度到扫描角度添加弧, 添加的弧是矩形内切椭圆的一部分,如果扫描角度&lt;= -360°,或&gt;= 360°, 并且起始角度对90取模接近于0,则添加椭圆而不是弧。 |
445| 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) \*) | 将源路径矩阵变换后,添加到当前路径中。 |
446| 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)) | 将源路径矩阵变换后,以规定模式添加到当前路径中。 |
447| 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)) | 将源路径以规定模式添加到当前路径中。 |
448| 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)) | 将源路径偏移后,以规定模式添加到当前路径中。 |
449| 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) | 向路径添加多边形。 |
450| 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)) | 按指定方向,向路径添加圆形。 |
451| 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)) | 按指定方向,向路径添加椭圆。 |
452| bool [OH_Drawing_PathBuildFromSvgString](#oh_drawing_pathbuildfromsvgstring) ([OH_Drawing_Path](#oh_drawing_path) \*path, const char \*str) | 解析SVG字符串表示的路径。 |
453| bool [OH_Drawing_PathContains](#oh_drawing_pathcontains) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](#oh_drawing_pathfilltype)。 |
454| void [OH_Drawing_PathTransform](#oh_drawing_pathtransform) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 对路径进行矩阵变换。 |
455| 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,则替换源路径。 |
456| void [OH_Drawing_PathSetFillType](#oh_drawing_pathsetfilltype) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)) | 设置路径的填充类型,这个决定了路径内部区域的定义方式。 |
457| float [OH_Drawing_PathGetLength](#oh_drawing_pathgetlength) ([OH_Drawing_Path](#oh_drawing_path) \*, bool forceClosed) | 获取当前路径的长度。 |
458| void [OH_Drawing_PathGetBounds](#oh_drawing_pathgetbounds) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取包含路径的最小边界框。 |
459| void [OH_Drawing_PathClose](#oh_drawing_pathclose) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 |
460| bool [OH_Drawing_PathIsClosed](#oh_drawing_pathisclosed) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed) | 获取路径是否闭合。 |
461| 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) | 获取距路径起始点指定距离的坐标点和切线值。 |
462| 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) | 将两个路径按照指定的路径操作类型合并。 |
463| 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) | 获取距路径起始点指定距离的相应变换矩阵。 |
464| 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轴方向偏移一定距离,并将结果存储到目标路径对象中。 |
465| void [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于重置自定义路径数据。 |
466| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateDashPathEffect](#oh_drawing_createdashpatheffect) (float \*intervals, int count, float phase) | 创建一个虚线效果的路径效果对象。虚线效果由一组虚线开的间隔、虚线关的间隔数据决定。 |
467| void [OH_Drawing_PathEffectDestroy](#oh_drawing_patheffectdestroy) ([OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | 销毁路径效果对象并回收该对象占有内存。 |
468| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | 用于创建一个画笔对象。 |
469| [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),用于拷贝一个已有画笔对象。 |
470| void [OH_Drawing_PenDestroy](#oh_drawing_pendestroy) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于销毁画笔对象并回收该对象占有的内存。 |
471| bool [OH_Drawing_PenIsAntiAlias](#oh_drawing_penisantialias) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
472| void [OH_Drawing_PenSetAntiAlias](#oh_drawing_pensetantialias) ([OH_Drawing_Pen](#oh_drawing_pen) \*, bool) | 用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
473| uint32_t [OH_Drawing_PenGetColor](#oh_drawing_pengetcolor) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 |
474| void [OH_Drawing_PenSetColor](#oh_drawing_pensetcolor) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint32_t color) | 用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 |
475| uint8_t [OH_Drawing_PenGetAlpha](#oh_drawing_pengetalpha) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。 |
476| void [OH_Drawing_PenSetAlpha](#oh_drawing_pensetalpha) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint8_t alpha) | 为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。 |
477| float [OH_Drawing_PenGetWidth](#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 |
478| void [OH_Drawing_PenSetWidth](#oh_drawing_pensetwidth) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float width) | 用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 |
479| float [OH_Drawing_PenGetMiterLimit](#oh_drawing_pengetmiterlimit) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 |
480| void [OH_Drawing_PenSetMiterLimit](#oh_drawing_pensetmiterlimit) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float miter) | 用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 |
481| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) [OH_Drawing_PenGetCap](#oh_drawing_pengetcap) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔笔帽的样式。 |
482| void [OH_Drawing_PenSetCap](#oh_drawing_pensetcap) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)) | 用于设置画笔笔帽样式。 |
483| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) [OH_Drawing_PenGetJoin](#oh_drawing_pengetjoin) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔绘制折线转角的样式。 |
484| void [OH_Drawing_PenSetJoin](#oh_drawing_pensetjoin) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)) | 用于设置画笔绘制转角的样式。 |
485| void [OH_Drawing_PenSetShaderEffect](#oh_drawing_pensetshadereffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 设置画笔着色器效果。 |
486| void [OH_Drawing_PenSetShadowLayer](#oh_drawing_pensetshadowlayer) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 设置画笔阴影层效果,设置的阴影层效果当前仅在绘制文字时生效。 |
487| void [OH_Drawing_PenSetPathEffect](#oh_drawing_pensetpatheffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | 设置画笔路径效果。 |
488| void [OH_Drawing_PenSetFilter](#oh_drawing_pensetfilter) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | 设置画笔滤波器。 |
489| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 |
490| void [OH_Drawing_PenSetBlendMode](#oh_drawing_pensetblendmode) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 为画笔设置一个混合器,该混合器实现了指定的混合模式枚举。 |
491| 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) \*) | 获取使用画笔绘制的源路径轮廓,并用目标路径表示。 |
492| void [OH_Drawing_PenReset](#oh_drawing_penreset) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 将画笔重置至初始值。 |
493| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap) (NativePixelMap_ \*) | 从图像框架定义的像素图对象中获取本模块定义的像素图对象。 |
494| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative) (OH_PixelmapNative \*) | 从图像框架定义的像素图对象中获取本模块定义的像素图对象。 |
495| 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)建立。 |
496| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_PointCreate](#oh_drawing_pointcreate) (float x, float y) | 用于创建一个坐标点对象。 |
497| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetX](#oh_drawing_pointgetx) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*x) | 用于获取点的x轴坐标。 |
498| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetY](#oh_drawing_pointgety) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*y) | 用于获取点的y轴坐标。 |
499| [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轴坐标。 |
500| void [OH_Drawing_PointDestroy](#oh_drawing_pointdestroy) ([OH_Drawing_Point](#oh_drawing_point) \*) | 用于销毁坐标点对象并回收该对象占有的内存。 |
501| [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \* [OH_Drawing_RecordCmdUtilsCreate](#oh_drawing_recordcmdutilscreate) (void) | 创建一个录制指令工具对象。 |
502| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdUtilsDestroy](#oh_drawing_recordcmdutilsdestroy) ([OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \*recordCmdUtils) | 销毁一个录制指令工具对象,并回收该对象占有的内存。 |
503| [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的绘制接口,记录接下来所有的绘制指令。 |
504| [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/>指令录制工具结束录制指令,将录制类型画布对象记录的绘制指令存入生成的录制指令对象。 |
505| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy) ([OH_Drawing_RecordCmd](#oh_drawing_recordcmd) \*recordCmd) | 销毁录制指令对象,并回收该对象占有的内存。 |
506| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_RectCreate](#oh_drawing_rectcreate) (float left, float top, float right, float bottom) | 用于创建一个矩形对象,不会对设置的坐标排序,即允许矩形设置的左上角坐标大于对应的矩形右下角坐标。 |
507| float [OH_Drawing_RectGetHeight](#oh_drawing_rectgetheight) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取矩形对象高度,计算方式为设置的矩形的右下角纵坐标减去左上角纵坐标。 |
508| float [OH_Drawing_RectGetWidth](#oh_drawing_rectgetwidth) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取矩形对象的宽度,计算方式为设置的矩形的右下角横坐标减去左上角横坐标。 |
509| float [OH_Drawing_RectGetLeft](#oh_drawing_rectgetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的左上角的横坐标。 |
510| float [OH_Drawing_RectGetTop](#oh_drawing_rectgettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的左上角的纵坐标。 |
511| float [OH_Drawing_RectGetRight](#oh_drawing_rectgetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的右下角的横坐标。 |
512| float [OH_Drawing_RectGetBottom](#oh_drawing_rectgetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的右下角的纵坐标。 |
513| bool [OH_Drawing_RectIntersect](#oh_drawing_rectintersect) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | 用于判断两个矩形是否相交,若相交,将rect设置为两个矩形的交集。 |
514| bool [OH_Drawing_RectJoin](#oh_drawing_rectjoin) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | 将两个矩形取并集。 |
515| void [OH_Drawing_RectSetLeft](#oh_drawing_rectsetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float left) | 用于设置矩形左上角的横坐标。 |
516| void [OH_Drawing_RectSetTop](#oh_drawing_rectsettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float top) | 用于设置矩形左上角的纵坐标。 |
517| void [OH_Drawing_RectSetRight](#oh_drawing_rectsetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float right) | 用于设置矩形右下角的横坐标。 |
518| void [OH_Drawing_RectSetBottom](#oh_drawing_rectsetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float bottom) | 用于设置矩形右下角的纵坐标。 |
519| void [OH_Drawing_RectCopy](#oh_drawing_rectcopy) ([OH_Drawing_Rect](#oh_drawing_rect) \*sRect, [OH_Drawing_Rect](#oh_drawing_rect) \*dRect) | 用于将源矩形对象复制到目标矩形对象。 |
520| void [OH_Drawing_RectDestroy](#oh_drawing_rectdestroy) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于销毁矩形对象并回收该对象占有的内存。 |
521| [OH_Drawing_Region](#oh_drawing_region) \* [OH_Drawing_RegionCreate](#oh_drawing_regioncreate) (void) | 用于创建一个区域对象,实现更精确的图形控制。 |
522| bool [OH_Drawing_RegionContains](#oh_drawing_regioncontains) ([OH_Drawing_Region](#oh_drawing_region) \*region, int32_t x, int32_t y) | 判断区域是否包含指定坐标点。 |
523| 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) | 将两个区域按照指定的区域操作类型合并。 |
524| bool [OH_Drawing_RegionSetRect](#oh_drawing_regionsetrect) ([OH_Drawing_Region](#oh_drawing_region) \*region, const [OH_Drawing_Rect](#oh_drawing_rect) \*rect) | 用于尝试给区域对象设置矩形边界。 |
525| 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) | 给区域对象设置为指定区域内路径表示的范围。 |
526| void [OH_Drawing_RegionDestroy](#oh_drawing_regiondestroy) ([OH_Drawing_Region](#oh_drawing_region) \*) | 用于销毁区域对象并回收该对象占有的内存。 |
527| uint32_t [OH_Drawing_RegisterFont](#oh_drawing_registerfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, const char \*familySrc) | 用于在字体管理器中注册自定义字体,支持的字体文件格式包含:ttf、otf。 |
528| uint32_t [OH_Drawing_RegisterFontBuffer](#oh_drawing_registerfontbuffer) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, uint8_t \*fontBuffer, size_t length) | 用于在字体管理器中注册字体缓冲区。 |
529| [OH_Drawing_RoundRect](#oh_drawing_roundrect) \* [OH_Drawing_RoundRectCreate](#oh_drawing_roundrectcreate) (const [OH_Drawing_Rect](#oh_drawing_rect) \*, float xRad, float yRad) | 用于创建一个圆角矩形对象。 |
530| 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)) | 用于设置圆角矩形中指定圆角位置的圆角半径。 |
531| [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) | 用于获取圆角矩形中指定圆角位置的圆角半径。 |
532| void [OH_Drawing_RoundRectDestroy](#oh_drawing_roundrectdestroy) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于销毁圆角矩形对象并回收该对象占有的内存。 |
533| [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轴方向平移指定距离。 |
534| [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \* [OH_Drawing_SamplingOptionsCreate](#oh_drawing_samplingoptionscreate) ([OH_Drawing_FilterMode](#oh_drawing_filtermode), [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)) | 创建一个采样选项对象。 |
535| void [OH_Drawing_SamplingOptionsDestroy](#oh_drawing_samplingoptionsdestroy) ([OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | 销毁采样选项对象并回收该对象占有内存。 |
536| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateColorShader](#oh_drawing_shadereffectcreatecolorshader) (const uint32_t color) | 创建具有单一颜色的着色器。 |
537| [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)) | 创建着色器,在两个指定点之间生成线性渐变。 |
538| [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) \*) | 创建着色器,在两个指定点之间生成线性渐变。 |
539| [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)) | 创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 |
540| [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) \*) | 创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 |
541| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateSweepGradient](#oh_drawing_shadereffectcreatesweepgradient) (const [OH_Drawing_Point](#oh_drawing_point) \*centerPt, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode)) | 创建着色器,在给定中心的情况下生成扇形渐变。 颜色从0°到360°渐变被称为扇形渐变。 |
542| [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) \*) | 创建图像着色器。此接口不建议用于录制类型的画布,会影响性能。 |
543| [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) \*) | 创建着色器,在给定两个圆之间生成渐变。 |
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_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_GetFontDescriptorByFullName](#oh_drawing_getfontdescriptorbyfullname) (const [OH_Drawing_String](_o_h___drawing___string.md) \*, [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)) | 根据字体名称和字体类型获取指定的字体描述符,支持系统字体、风格字体和用户已安装字体。 字体描述符是描述字体特征的一种数据结构,它包含了定义字体外观和属性的详细信息。 |
561| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetSystemFontFullNamesByType](#oh_drawing_getsystemfontfullnamesbytype) ([OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)) | 根据字体类型获取对应字体的字体名称数组。 |
562| const [OH_Drawing_String](_o_h___drawing___string.md) \* [OH_Drawing_GetSystemFontFullNameByIndex](#oh_drawing_getsystemfontfullnamebyindex) ([OH_Drawing_Array](#oh_drawing_array) \*, size_t) | 在字体名称数组中通过索引获取对应位置的字体名称。 |
563| void [OH_Drawing_DestroySystemFontFullNames](#oh_drawing_destroysystemfontfullnames) ([OH_Drawing_Array](#oh_drawing_array) \*) | 释放通过字体类型获取的对应字体的字体名称数组占用的内存。 |
564| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \* [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | 创建指向OH_Drawing_TypographyStyle对象的指针。 |
565| void [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 释放被OH_Drawing_TypographyStyle对象占据的内存。 |
566| void [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置指定排版样式中的文本方向。 |
567| void [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本对齐方式。 |
568| int [OH_Drawing_TypographyGetEffectiveAlignment](#oh_drawing_typographygeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文字对齐方式。 |
569| void [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本最大行数。 |
570| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | 创建指向OH_Drawing_TextStyle对象的指针。 |
571| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_TypographyGetTextStyle](#oh_drawing_typographygettextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取指定排版样式中设置的默认文本样式。 |
572| void [OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 释放被OH_Drawing_TextStyle对象占据的内存。 |
573| void [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置文本颜色。 |
574| void [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置字号。 |
575| void [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 |
576| void [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体基线位置。 |
577| void [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置指定文本样式中的装饰线类型。 |
578| void [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置指定文本样式中的装饰线颜色。 |
579| void [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置行高,按当前字体大小的倍数进行设置。 |
580| void [OH_Drawing_SetTextStyleFontFamilies](#oh_drawing_settextstylefontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int, const char \*fontFamilies[]) | 设置字体类型。 |
581| void [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体风格。 |
582| void [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置文本语言类型。 |
583| void [OH_Drawing_SetTextStyleForegroundBrush](#oh_drawing_settextstyleforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 设置指定文本样式中的前景色画刷。 |
584| void [OH_Drawing_TextStyleGetForegroundBrush](#oh_drawing_textstylegetforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 返回设置的前景色画刷。 |
585| void [OH_Drawing_SetTextStyleForegroundPen](#oh_drawing_settextstyleforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 设置指定文本样式中的前景色画笔。 |
586| void [OH_Drawing_TextStyleGetForegroundPen](#oh_drawing_textstylegetforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 返回设置的前景色画笔。 |
587| void [OH_Drawing_SetTextStyleBackgroundBrush](#oh_drawing_settextstylebackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 设置指定文本样式中的背景色画刷。 |
588| void [OH_Drawing_TextStyleGetBackgroundBrush](#oh_drawing_textstylegetbackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 返回设置的背景色画刷。 |
589| void [OH_Drawing_SetTextStyleBackgroundPen](#oh_drawing_settextstylebackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 设置指定文本样式中的背景色画笔。 |
590| void [OH_Drawing_TextStyleGetBackgroundPen](#oh_drawing_textstylegetbackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 返回设置的背景色画笔。 |
591| [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对象的指针。 |
592| void [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 释放被OH_Drawing_TypographyCreate对象占据的内存。 |
593| void [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 设置排版风格。 |
594| void [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | 设置文本内容。 |
595| void [OH_Drawing_TypographyHandlerPopTextStyle](#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 排版弹出。 |
596| [OH_Drawing_Typography](#oh_drawing_typography) \* [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 创建指向OH_Drawing_Typography对象的指针。 |
597| void [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 释放OH_Drawing_Typography对象占据的内存。 |
598| void [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | 排版布局。 |
599| void [OH_Drawing_TypographyPaint](#oh_drawing_typographypaint) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, double, double) | 在指定位置绘制文本,从左上角开始绘制,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用并生效之后调用。 |
600| 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) | 沿路径绘制文本。 |
601| double [OH_Drawing_TypographyGetMaxWidth](#oh_drawing_typographygetmaxwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取用户设置的排版宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
602| double [OH_Drawing_TypographyGetHeight](#oh_drawing_typographygetheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象整体的高度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
603| double [OH_Drawing_TypographyGetLongestLine](#oh_drawing_typographygetlongestline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象最长行的宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。 |
604| double [OH_Drawing_TypographyGetLongestLineWithIndent](#oh_drawing_typographygetlongestlinewithindent) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象最长行的宽度(该宽度包含当前行缩进的宽度),该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。 |
605| double [OH_Drawing_TypographyGetMinIntrinsicWidth](#oh_drawing_typographygetminintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象的最小固有宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
606| double [OH_Drawing_TypographyGetMaxIntrinsicWidth](#oh_drawing_typographygetmaxintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象的最大固有宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
607| double [OH_Drawing_TypographyGetAlphabeticBaseline](#oh_drawing_typographygetalphabeticbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取字母文字基线。 |
608| double [OH_Drawing_TypographyGetIdeographicBaseline](#oh_drawing_typographygetideographicbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取表意文字基线。 |
609| void [OH_Drawing_TypographyHandlerAddPlaceholder](#oh_drawing_typographyhandleraddplaceholder) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) \*) | 设置占位符。 |
610| bool [OH_Drawing_TypographyDidExceedMaxLines](#oh_drawing_typographydidexceedmaxlines) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象中文本是否超过最大行,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,如果没有通过[OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines)接口设置最大行,则返回false。 |
611| [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)) | 获取排版对象中指定范围内的文本框,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。不再需要[OH_Drawing_TextBox](#oh_drawing_textbox)时,请使用[OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox)接口释放该对象的指针。 |
612| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象中占位符的文本框,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。不再需要[OH_Drawing_TextBox](#oh_drawing_textbox)时,请使用[OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox)接口释放该对象的指针。 |
613| float [OH_Drawing_GetLeftFromTextBox](#oh_drawing_getleftfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框左侧位置。 |
614| float [OH_Drawing_GetRightFromTextBox](#oh_drawing_getrightfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框右侧位置。 |
615| float [OH_Drawing_GetTopFromTextBox](#oh_drawing_gettopfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框顶部位置。 |
616| float [OH_Drawing_GetBottomFromTextBox](#oh_drawing_getbottomfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框底部位置。 |
617| int [OH_Drawing_GetTextDirectionFromTextBox](#oh_drawing_gettextdirectionfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框方向。 |
618| size_t [OH_Drawing_GetSizeOfTextBox](#oh_drawing_getsizeoftextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | 获取文本框数量大小。 |
619| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本的索引位置和亲和性。 |
620| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。 |
621| size_t [OH_Drawing_GetPositionFromPositionAndAffinity](#oh_drawing_getpositionfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的位置属性。 |
622| int [OH_Drawing_GetAffinityFromPositionAndAffinity](#oh_drawing_getaffinityfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本。 |
623| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t) | 获取排版对象中单词的边界。 |
624| size_t [OH_Drawing_GetStartFromRange](#oh_drawing_getstartfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象开始位置。 |
625| size_t [OH_Drawing_GetEndFromRange](#oh_drawing_getendfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象结束位置。 |
626| size_t [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象中文本行数,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
627| void [OH_Drawing_SetTextStyleDecorationStyle](#oh_drawing_settextstyledecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置指定文本样式中的装饰线样式。 |
628| void [OH_Drawing_SetTextStyleDecorationThicknessScale](#oh_drawing_settextstyledecorationthicknessscale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本装饰线的厚度缩放比例。 |
629| void [OH_Drawing_SetTextStyleLetterSpacing](#oh_drawing_settextstyleletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的字符间距。 |
630| void [OH_Drawing_SetTextStyleWordSpacing](#oh_drawing_settextstylewordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的单词间距。 |
631| void [OH_Drawing_SetTextStyleHalfLeading](#oh_drawing_settextstylehalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, bool) | 设置文本为一半行间距。 |
632| void [OH_Drawing_SetTextStyleEllipsis](#oh_drawing_settextstyleellipsis) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置文本的省略号内容。 |
633| void [OH_Drawing_SetTextStyleEllipsisModal](#oh_drawing_settextstyleellipsismodal) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置文本的省略号样式。 |
634| void [OH_Drawing_SetTypographyTextBreakStrategy](#oh_drawing_settypographytextbreakstrategy) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本的中断策略。 |
635| void [OH_Drawing_SetTypographyTextWordBreakType](#oh_drawing_settypographytextwordbreaktype) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置单词的断词方式。 |
636| void [OH_Drawing_SetTypographyTextEllipsisModal](#oh_drawing_settypographytextellipsismodal) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本的省略号样式。 |
637| void [OH_Drawing_SetTypographyTextEllipsis](#oh_drawing_settypographytextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*ellipsis) | 设置省略号样式。 |
638| double [OH_Drawing_TypographyGetLineHeight](#oh_drawing_typographygetlineheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取排版对象中指定行的行高,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
639| double [OH_Drawing_TypographyGetLineWidth](#oh_drawing_typographygetlinewidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取指定行的行宽,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
640| void [OH_Drawing_SetTypographyTextSplitRatio](#oh_drawing_settypographytextsplitratio) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, float textSplitRatio) | 设置文本划分比率。 |
641| bool [OH_Drawing_TypographyIsLineUnlimited](#oh_drawing_typographyislineunlimited) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否有最大行数限制。 |
642| bool [OH_Drawing_TypographyIsEllipsized](#oh_drawing_typographyisellipsized) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取指定排版样式是否配置省略号。 |
643| void [OH_Drawing_SetTypographyTextLocale](#oh_drawing_settypographytextlocale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*locale) | 设置指定排版样式的语言环境。 |
644| 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) \*) | 获取文本字体属性。 |
645| void [OH_Drawing_SetTypographyTextStyle](#oh_drawing_settypographytextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 设置段落样式。 |
646| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor) (void) | 构造字体描述对象,用于描述系统字体详细信息。 |
647| void [OH_Drawing_DestroyFontDescriptor](#oh_drawing_destroyfontdescriptor) ([OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \*) | 释放字体描述对象占用的内存。 |
648| [OH_Drawing_FontParser](#oh_drawing_fontparser) \* [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser) (void) | 构造字体解析对象,用于解析系统字体。 |
649| void [OH_Drawing_DestroyFontParser](#oh_drawing_destroyfontparser) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*) | 释放字体解析对象占用的内存。 |
650| char \*\* [OH_Drawing_FontParserGetSystemFontList](#oh_drawing_fontparsergetsystemfontlist) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, size_t \*) | 获取系统字体名称列表,此接口仅在2in1设备上可用。 |
651| void [OH_Drawing_DestroySystemFontList](#oh_drawing_destroysystemfontlist) (char \*\*, size_t) | 释放系统字体名称列表占用的内存。 |
652| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_FontParserGetFontByName](#oh_drawing_fontparsergetfontbyname) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, const char \*) | 根据传入的系统字体名称获取系统字体的相关信息。 |
653| [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \* [OH_Drawing_TypographyGetLineMetrics](#oh_drawing_typographygetlinemetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象的行位置信息,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。不再需要[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)时,请使用[OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics)接口释放该对象的指针。 |
654| size_t [OH_Drawing_LineMetricsGetSize](#oh_drawing_linemetricsgetsize) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 获取行数量。 |
655| void [OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 释放行位置信息对象占用的内存。 |
656| bool [OH_Drawing_TypographyGetLineMetricsAt](#oh_drawing_typographygetlinemetricsat) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 获取排版对象的指定行位置信息,具体参见[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)结构体,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
657| 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) \*) | 获取排版对象中指定行的位置信息或指定行第一个字符的位置信息,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
658| void [OH_Drawing_SetTypographyTextFontWeight](#oh_drawing_settypographytextfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 |
659| void [OH_Drawing_SetTypographyTextFontStyle](#oh_drawing_settypographytextfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置字体风格。 |
660| void [OH_Drawing_SetTypographyTextFontFamily](#oh_drawing_settypographytextfontfamily) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, const char \*) | 设置字体家族的名称。 |
661| void [OH_Drawing_SetTypographyTextFontSize](#oh_drawing_settypographytextfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版字号。 |
662| void [OH_Drawing_SetTypographyTextFontHeight](#oh_drawing_settypographytextfontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版字体高度。 |
663| void [OH_Drawing_SetTypographyTextHalfLeading](#oh_drawing_settypographytexthalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否为一半行间距。 |
664| void [OH_Drawing_SetTypographyTextUseLineStyle](#oh_drawing_settypographytextuselinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否启用行样式。 |
665| void [OH_Drawing_SetTypographyTextLineStyleFontWeight](#oh_drawing_settypographytextlinestylefontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版行样式字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 |
666| void [OH_Drawing_SetTypographyTextLineStyleFontStyle](#oh_drawing_settypographytextlinestylefontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版行样式风格。 |
667| void [OH_Drawing_SetTypographyTextLineStyleFontFamilies](#oh_drawing_settypographytextlinestylefontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int, const char \*fontFamilies[]) | 设置文本排版行样式字体类型。 |
668| void [OH_Drawing_SetTypographyTextLineStyleFontSize](#oh_drawing_settypographytextlinestylefontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式字号。 |
669| void [OH_Drawing_SetTypographyTextLineStyleFontHeight](#oh_drawing_settypographytextlinestylefontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式字体高度。 |
670| void [OH_Drawing_SetTypographyTextLineStyleHalfLeading](#oh_drawing_settypographytextlinestylehalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版行样式是否为一半行间距。 |
671| void [OH_Drawing_SetTypographyTextLineStyleSpacingScale](#oh_drawing_settypographytextlinestylespacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式间距比例。 |
672| void [OH_Drawing_SetTypographyTextLineStyleOnly](#oh_drawing_settypographytextlinestyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否仅启用行样式。 |
673| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow) (void) | 创建指向字体阴影对象的指针。 |
674| void [OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 释放被字体阴影对象占据的内存。 |
675| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadows](#oh_drawing_textstylegetshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体阴影容器。 |
676| int [OH_Drawing_TextStyleGetShadowCount](#oh_drawing_textstylegetshadowcount) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体阴影容器的大小。 |
677| void [OH_Drawing_TextStyleAddShadow](#oh_drawing_textstyleaddshadow) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const [OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 字体阴影容器中添加字体阴影元素。 |
678| void [OH_Drawing_TextStyleClearShadows](#oh_drawing_textstyleclearshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 清除字体阴影容器中的所有元素。 |
679| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadowWithIndex](#oh_drawing_textstylegetshadowwithindex) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 根据下标获取字体阴影容器中的元素。 |
680| void [OH_Drawing_TypographySetIndents](#oh_drawing_typographysetindents) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, const float indents[]) | 设置文本的排版缩进,不调用此接口默认文本无缩进。 |
681| float [OH_Drawing_TypographyGetIndentsWithIndex](#oh_drawing_typographygetindentswithindex) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 根据行索引获取排版对象缩进容器中的元素,行索引从0开始。 |
682| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetLineTextRange](#oh_drawing_typographygetlinetextrange) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, bool) | 获取排版对象中行的边界,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。该接口只能获取已有行的边界,即输入行索引从0开始,最大行索引为[OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) - 1。 |
683| void [OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。 |
684| [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \* [OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo) ([OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode) \*) | 获取系统字体配置信息。 |
685| void [OH_Drawing_DestroySystemFontConfigInfo](#oh_drawing_destroysystemfontconfiginfo) ([OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \*) | 释放系统字体配置信息占用的的内存。 |
686| 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) | 设置文本样式中的字体样式,包括字体字重、字体宽度和字体斜度。 |
687| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TextStyleGetFontStyleStruct](#oh_drawing_textstylegetfontstylestruct) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*drawingTextStyle) | 获取文本样式中的字体样式,包括字体字重、字体宽度和字体斜度。 |
688| 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) | 设置文本字体样式,包括字体字重、字体宽度和字体斜度。 |
689| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TypographyStyleGetFontStyleStruct](#oh_drawing_typographystylegetfontstylestruct) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*drawingStyle) | 获取文本字体样式,包括字体字重、字体宽度和字体斜度。 |
690| 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仅当背景框为圆角矩形时有效。 |
691| void [OH_Drawing_TypographyHandlerAddSymbol](#oh_drawing_typographyhandleraddsymbol) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, uint32_t symbol) | 设置排版创建过程中的符号。 |
692| void [OH_Drawing_TextStyleAddFontFeature](#oh_drawing_textstyleaddfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*tag, int value) | 添加文本字体特征。 |
693| void [OH_Drawing_TextStyleAddFontVariation](#oh_drawing_textstyleaddfontvariation) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*, const float) | 添加可变字体属性。对应的字体文件(.ttf文件)需要支持可变调节,此接口才能生效。当对应的字体不支持可变调节时,此接口调用不生效。 |
694| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \* [OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体特征map容器中的所有内容。 |
695| void [OH_Drawing_TextStyleDestroyFontFeatures](#oh_drawing_textstyledestroyfontfeatures) ([OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \*, size_t fontFeatureSize) | 释放存放字体特征所有内容的结构体数组所占用的空间。 |
696| size_t [OH_Drawing_TextStyleGetFontFeatureSize](#oh_drawing_textstylegetfontfeaturesize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体特征map容器的大小。 |
697| void [OH_Drawing_TextStyleClearFontFeature](#oh_drawing_textstyleclearfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 清除字体特征map容器中的所有内容。 |
698| double [OH_Drawing_TextStyleGetBaselineShift](#oh_drawing_textstylegetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的基线漂移。 |
699| void [OH_Drawing_TextStyleSetBaselineShift](#oh_drawing_textstylesetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double lineShift) | 设置文本的基线漂移。 |
700| void [OH_Drawing_TypographyTextSetHeightBehavior](#oh_drawing_typographytextsetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) heightMode) | 设置文本高度修饰符模式。 |
701| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) [OH_Drawing_TypographyTextGetHeightBehavior](#oh_drawing_typographytextgetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本高度修饰符模式。 |
702| [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) | 从排版对象中目标行获取所有字体度量信息,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,否则会返回空指针。不再需要[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)时,请使用[OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics)接口释放该对象的指针。 |
703| void [OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics) ([OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | 释放指定行所有字体度量结构体集合所占用的所有空间。 |
704| bool [OH_Drawing_TextStyleIsEqual](#oh_drawing_textstyleisequal) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | 判断两个字体风格对象是否相等。 |
705| bool [OH_Drawing_TextStyleIsEqualByFont](#oh_drawing_textstyleisequalbyfont) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | 判断两个字体风格对象的字体样式属性是否相等。 |
706| 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) | 判断两个字体风格对象是否有一样的文本样式类型。 |
707| void [OH_Drawing_TextStyleSetPlaceholder](#oh_drawing_textstylesetplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | 设置占位符。 |
708| bool [OH_Drawing_TextStyleIsPlaceholder](#oh_drawing_textstyleisplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | 返回是否有设置文本占位符。 |
709| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyStyleGetEffectiveAlignment](#oh_drawing_typographystylegeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本对齐模式。 |
710| bool [OH_Drawing_TypographyStyleIsHintEnabled](#oh_drawing_typographystyleishintenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否启用字形轮廓自动调整,字形轮廓自动调整用于在渲染小字号文本时改善其可读性和外观。 |
711| void [OH_Drawing_SetTypographyStyleTextStrutStyle](#oh_drawing_settypographystyletextstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | 设置文本支柱样式。 |
712| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \* [OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本支柱样式。 |
713| void [OH_Drawing_TypographyStyleDestroyStrutStyle](#oh_drawing_typographystyledestroystrutstyle) ([OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | 释放被支柱样式对象占据的内存。 |
714| 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) | 判断支柱样式结构体是否相同。 |
715| void [OH_Drawing_TypographyStyleSetHintsEnabled](#oh_drawing_typographystylesethintsenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, bool hintsEnabled) | 设置文本是否启用字形轮廓自动调整,字形轮廓自动调整用于在渲染小字号文本时改善其可读性和外观。 |
716| void [OH_Drawing_TypographyMarkDirty](#oh_drawing_typographymarkdirty) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 将排版标记为脏数据,用于初始化排版状态。 |
717| int32_t [OH_Drawing_TypographyGetUnresolvedGlyphsCount](#oh_drawing_typographygetunresolvedglyphscount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本中尚未解析的字形的数量,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用并生效之后调用。 |
718| void [OH_Drawing_TypographyUpdateFontSize](#oh_drawing_typographyupdatefontsize) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t from, size_t to, float fontSize) | 更新排版对象中的字体大小。 |
719| bool [OH_Drawing_TypographyTextGetLineStyle](#oh_drawing_typographytextgetlinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版是否启用行样式。 |
720| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TypographyTextlineStyleGetFontWeight](#oh_drawing_typographytextlinestylegetfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式字重。 |
721| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TypographyTextlineStyleGetFontStyle](#oh_drawing_typographytextlinestylegetfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式风格。 |
722| char \*\* [OH_Drawing_TypographyTextlineStyleGetFontFamilies](#oh_drawing_typographytextlinestylegetfontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, size_t \*num) | 获取文本排版行样式字体家族名。 |
723| void [OH_Drawing_TypographyTextlineStyleDestroyFontFamilies](#oh_drawing_typographytextlinestyledestroyfontfamilies) (char \*\*fontFamilies, size_t fontFamiliesNum) | 释放字体类型占用的内存。 |
724| double [OH_Drawing_TypographyTextlineStyleGetFontSize](#oh_drawing_typographytextlinestylegetfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式字号。 |
725| double [OH_Drawing_TypographyTextlineStyleGetHeightScale](#oh_drawing_typographytextlinestylegetheightscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式的行高缩放系数。 |
726| bool [OH_Drawing_TypographyTextlineStyleGetHeightOnly](#oh_drawing_typographytextlinestylegetheightonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取字体渲染过程中计算字体块高度相关参数的方法。 |
727| bool [OH_Drawing_TypographyTextlineStyleGetHalfLeading](#oh_drawing_typographytextlinestylegethalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式是否为一半行间距。 |
728| double [OH_Drawing_TypographyTextlineStyleGetSpacingScale](#oh_drawing_typographytextlinestylegetspacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式间距比例。 |
729| bool [OH_Drawing_TypographyTextlineGetStyleOnly](#oh_drawing_typographytextlinegetstyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版是否仅启用行样式。 |
730| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyGetTextAlign](#oh_drawing_typographygettextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本对齐方式。 |
731| [OH_Drawing_TextDirection](#oh_drawing_textdirection) [OH_Drawing_TypographyGetTextDirection](#oh_drawing_typographygettextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取指定排版样式中的文本方向。 |
732| size_t [OH_Drawing_TypographyGetTextMaxLines](#oh_drawing_typographygettextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本的最大行数。 |
733| char \* [OH_Drawing_TypographyGetTextEllipsis](#oh_drawing_typographygettextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取设置的省略号内容。 |
734| void [OH_Drawing_TypographyDestroyEllipsis](#oh_drawing_typographydestroyellipsis) (char \*ellipsis) | 释放省略号名称列表占用的内存。 |
735| bool [OH_Drawing_TypographyStyleEquals](#oh_drawing_typographystyleequals) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*from, [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*to) | 判断排版样式是否相同,当前文本高度修饰符模式[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)没有被纳入比较。 |
736| uint32_t [OH_Drawing_TextStyleGetColor](#oh_drawing_textstylegetcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本颜色。 |
737| [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) [OH_Drawing_TextStyleGetDecorationStyle](#oh_drawing_textstylegetdecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本装饰样式。 |
738| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TextStyleGetFontWeight](#oh_drawing_textstylegetfontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字重。 |
739| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TextStyleGetFontStyle](#oh_drawing_textstylegetfontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体风格。 |
740| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) [OH_Drawing_TextStyleGetBaseline](#oh_drawing_textstylegetbaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体基线位置。 |
741| char \*\* [OH_Drawing_TextStyleGetFontFamilies](#oh_drawing_textstylegetfontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, size_t \*num) | 获取字体类型名称列表。 |
742| void [OH_Drawing_TextStyleDestroyFontFamilies](#oh_drawing_textstyledestroyfontfamilies) (char \*\*fontFamilies, size_t num) | 释放字体类型名称列表占用的内存。 |
743| double [OH_Drawing_TextStyleGetFontSize](#oh_drawing_textstylegetfontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字号。 |
744| double [OH_Drawing_TextStyleGetLetterSpacing](#oh_drawing_textstylegetletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的字符间距。 |
745| double [OH_Drawing_TextStyleGetWordSpacing](#oh_drawing_textstylegetwordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的单词间距。 |
746| double [OH_Drawing_TextStyleGetFontHeight](#oh_drawing_textstylegetfontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体高度。 |
747| bool [OH_Drawing_TextStyleGetHalfLeading](#oh_drawing_textstylegethalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取当前文档是否设置为一半行间距。 |
748| const char \* [OH_Drawing_TextStyleGetLocale](#oh_drawing_textstylegetlocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取语言文本语言类型。 |
749| void [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | 释放文本框占用的内存。 |
750| 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) | 设置字体阴影对象的参数。 |
751| size_t [OH_Drawing_GetDrawingArraySize](#oh_drawing_getdrawingarraysize) ([OH_Drawing_Array](#oh_drawing_array) \*drawingArray) | 获取传入类型为对象数组[OH_Drawing_Array](#oh_drawing_array)中的对象个数。 |
752| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateDefault](#oh_drawing_typefacecreatedefault) (void) | 用于创建一个默认的字形对象。 |
753| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile) (const char \*path, int index) | 通过文件创建一个字形对象。 |
754| [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)相同的功能。 |
755| [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) | 通过已存在的字体对象创建带有字型参数的字体对象。 |
756| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromStream](#oh_drawing_typefacecreatefromstream) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*, int32_t index) | 通过内存流创建一个字形对象。如果内存流是无效的字体文件,返回空指针。 内存流传入后,所有权转移,开发者不能再释放它。 |
757| void [OH_Drawing_TypefaceDestroy](#oh_drawing_typefacedestroy) ([OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于销毁字形对象并回收该对象占有的内存。 |
758| [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \* [OH_Drawing_FontArgumentsCreate](#oh_drawing_fontargumentscreate) (void) | 用于创建一个字型参数对象。字型参数用于创建带有自定义属性的字体对象。 |
759| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsAddVariation](#oh_drawing_fontargumentsaddvariation) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments, const char \*axis, float value) | 给字型参数对象添加可变维度。 |
760| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsDestroy](#oh_drawing_fontargumentsdestroy) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | 用于销毁一个字型参数对象。 |
761| enum&nbsp;&nbsp;[OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | 阴影标志枚举。 |
762| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | 阴影标志枚举。 |
763| 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) | 用于裁剪一个矩形。 |
764| 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) | 用于裁剪一个圆角矩形。 |
765| 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) | 用于裁剪一个自定义路径。 |
766| [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) | 用于裁剪一个区域。 |
767| void [OH_Drawing_CanvasRotate](#oh_drawing_canvasrotate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float degrees, float px, float py) | 用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。 |
768| void [OH_Drawing_CanvasTranslate](#oh_drawing_canvastranslate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float dx, float dy) | 用于平移画布一段距离。 |
769| void [OH_Drawing_CanvasScale](#oh_drawing_canvasscale) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | 用于画布缩放。 |
770| 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\|。 |
771| void [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | 用于使用指定颜色去清空画布。 |
772| int32_t [OH_Drawing_CanvasGetWidth](#oh_drawing_canvasgetwidth) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 获取画布宽度。 |
773| int32_t [OH_Drawing_CanvasGetHeight](#oh_drawing_canvasgetheight) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 获取画布高度。 |
774| void [OH_Drawing_CanvasGetLocalClipBounds](#oh_drawing_canvasgetlocalclipbounds) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取画布裁剪区域的边界。该接口不可用于录制类型画布。 |
775| void [OH_Drawing_CanvasGetTotalMatrix](#oh_drawing_canvasgettotalmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 获取画布3x3矩阵。 |
776| void [OH_Drawing_CanvasConcatMatrix](#oh_drawing_canvasconcatmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 画布现有矩阵左乘以传入矩阵,不影响该接口之前的绘制操作。 |
777| 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) | 绘制射灯类型阴影,使用路径描述环境光阴影的轮廓。 |
778| [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) | 用于绘制录制指令对象。 |
779
780## 类型定义说明
781
782
783### OH_Drawing_Array
784
785```
786typedef struct OH_Drawing_Array OH_Drawing_Array
787```
788
789**描述**
790
791定义数组对象, 用于存储多个同类型对象。
792
793**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
794
795**起始版本:** 14
796
797### OH_Drawing_String
798
799```
800typedef struct OH_Drawing_String OH_Drawing_String
801```
802
803**描述**
804
805采用UTF-16编码的字符串信息结构体。
806
807**起始版本:** 14
808
809
810### OH_Drawing_SystemFontType
811
812```
813typedef enum OH_Drawing_SystemFontType OH_Drawing_SystemFontType
814```
815
816**描述**
817
818字体类型的枚举。
819
820**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
821
822**起始版本:** 14
823
824
825### OH_Drawing_FontArguments
826
827```
828typedef struct OH_Drawing_FontArguments OH_Drawing_FontArguments
829```
830
831**描述**
832
833用于描述字型参数。
834
835**起始版本:** 13
836
837### OH_Drawing_RecordCmd
838
839```
840typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd
841```
842
843**描述**
844
845定义录制指令类, 用于存储录制指令的集合。
846
847**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
848
849**起始版本:** 13
850
851
852### OH_Drawing_RecordCmdUtils
853
854```
855typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils
856```
857
858**描述**
859
860定义指令录制工具,用于生成录制指令。
861
862**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
863
864**起始版本:** 13
865
866
867### OH_Drawing_ErrorCode
868
869```
870typedef enum OH_Drawing_ErrorCode OH_Drawing_ErrorCode
871```
872
873
874**描述**
875
876枚举本模块可能产生的错误码。
877
878**起始版本:** 12
879
880
881### OH_Drawing_PathOpMode
882
883```
884typedef enum OH_Drawing_PathOpMode OH_Drawing_PathOpMode
885```
886
887**描述**
888
889路径操作类型枚举。
890
891**起始版本:** 12
892
893
894### OH_Drawing_PathMeasureMatrixFlags
895
896```
897typedef enum OH_Drawing_PathMeasureMatrixFlags OH_Drawing_PathMeasureMatrixFlags
898```
899
900**描述**
901
902路径测量获取相应矩阵信息维度枚举。
903
904**起始版本:** 12
905
906
907### OH_Drawing_RegionOpMode
908
909```
910typedef enum OH_Drawing_RegionOpMode OH_Drawing_RegionOpMode
911```
912
913**描述**
914
915区域操作类型枚举。
916
917**起始版本:** 12
918
919
920### OH_Drawing_ImageFilter
921
922```
923typedef struct OH_Drawing_ImageFilter OH_Drawing_ImageFilter
924```
925
926**描述**
927
928定义图像滤波器, 用于对构成图像像素的所有颜色位进行操作。
929
930**起始版本:** 12
931
932
933### OH_Drawing_Filter
934
935```
936typedef struct OH_Drawing_Filter OH_Drawing_Filter
937```
938
939**描述**
940
941定义一个滤波器,用于存储颜色滤波器,蒙版滤波器和图像滤波器。
942
943**起始版本:** 11
944
945### OH_Drawing_AlphaFormat
946
947```
948typedef enum OH_Drawing_AlphaFormat OH_Drawing_AlphaFormat
949```
950
951**描述**
952
953用于描述位图像素的透明度分量。
954
955**起始版本:** 8
956
957
958### OH_Drawing_Bitmap
959
960```
961typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap
962```
963
964**描述**
965
966定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。
967
968**起始版本:** 8
969
970
971### OH_Drawing_BitmapFormat
972
973```
974typedef struct OH_Drawing_BitmapFormat OH_Drawing_BitmapFormat
975```
976
977**描述**
978
979结构体用于描述位图像素的格式,包括颜色类型和透明度类型。
980
981**起始版本:** 8
982
983
984### OH_Drawing_BlendMode
985
986```
987typedef enum OH_Drawing_BlendMode OH_Drawing_BlendMode
988```
989
990**描述**
991
992混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在红、绿、蓝3个颜色通道上是相同的(透明度有另外的处理规则)。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。
993
994为简洁起见,我们使用以下缩写:
995
996s : source,源的缩写。
997
998d : destination,目标的缩写。
999
1000sa : source alpha,源透明度的缩写。
1001
1002da : destination alpha,目标透明度的缩写。
1003
1004计算结果用如下缩写表示:
1005
1006r : 如果4个通道的计算方式相同,用r表示。
1007
1008ra : 如果只操作透明度通道,用ra表示。
1009
1010rc : 如果操作3个颜色通道,用rc表示。
1011
1012**起始版本:** 11
1013
1014
1015### OH_Drawing_BlurType
1016
1017```
1018typedef enum OH_Drawing_BlurType OH_Drawing_BlurType
1019```
1020
1021**描述**
1022
1023蒙版滤波器模糊操作类型的枚举。
1024
1025**起始版本:** 11
1026
1027
1028### OH_Drawing_BreakStrategy
1029
1030```
1031typedef enum OH_Drawing_BreakStrategy OH_Drawing_BreakStrategy
1032```
1033
1034**描述**
1035
1036文本的中断策略枚举。
1037
1038**起始版本:** 11
1039
1040
1041### OH_Drawing_Brush
1042
1043```
1044typedef struct OH_Drawing_Brush OH_Drawing_Brush
1045```
1046
1047**描述**
1048
1049定义为画刷,画刷用于描述填充图形的样式和颜色。
1050
1051**起始版本:** 8
1052
1053
1054### OH_Drawing_Canvas
1055
1056```
1057typedef struct OH_Drawing_Canvas OH_Drawing_Canvas
1058```
1059
1060**描述**
1061
1062定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。
1063
1064**起始版本:** 8
1065
1066
1067### OH_Drawing_CanvasClipOp
1068
1069```
1070typedef enum OH_Drawing_CanvasClipOp OH_Drawing_CanvasClipOp
1071```
1072
1073**描述**
1074
1075画布裁剪方式的枚举集合。
1076
1077**起始版本:** 11
1078
1079
1080### OH_Drawing_CanvasShadowFlags
1081
1082```
1083typedef enum OH_Drawing_CanvasShadowFlags OH_Drawing_CanvasShadowFlags
1084```
1085
1086**描述**
1087
1088阴影标志枚举。
1089
1090**起始版本:** 12
1091
1092
1093### OH_Drawing_ColorFilter
1094
1095```
1096typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter
1097```
1098
1099**描述**
1100
1101定义颜色滤波器,传入一个颜色并返回一个新的颜色。
1102
1103**起始版本:** 11
1104
1105
1106### OH_Drawing_ColorFormat
1107
1108```
1109typedef enum OH_Drawing_ColorFormat OH_Drawing_ColorFormat
1110```
1111
1112**描述**
1113
1114用于描述位图像素的存储格式。
1115
1116**起始版本:** 8
1117
1118
1119### OH_Drawing_ColorSpace
1120
1121```
1122typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace
1123```
1124
1125**描述**
1126
1127定义色彩空间,用于解释颜色信息。
1128
1129**起始版本:** 12
1130
1131
1132### OH_Drawing_Corner_Radii
1133
1134```
1135typedef OH_Drawing_Point2D OH_Drawing_Corner_Radii
1136```
1137
1138**描述**
1139
1140定义一个圆角半径,该圆角半径由x轴方向和y轴方向上的半径组成。
1141
1142**起始版本:** 12
1143
1144
1145### OH_Drawing_CornerPos
1146
1147```
1148typedef enum OH_Drawing_CornerPos OH_Drawing_CornerPos
1149```
1150
1151**描述**
1152
1153用于描述圆角位置的枚举。
1154
1155**起始版本:** 12
1156
1157
1158### OH_Drawing_EllipsisModal
1159
1160```
1161typedef enum OH_Drawing_EllipsisModal OH_Drawing_EllipsisModal
1162```
1163
1164**描述**
1165
1166省略号样式枚举。
1167
1168**起始版本:** 11
1169
1170
1171### OH_Drawing_FilterMode
1172
1173```
1174typedef enum OH_Drawing_FilterMode OH_Drawing_FilterMode
1175```
1176
1177**描述**
1178
1179过滤模式枚举。
1180
1181**起始版本:** 12
1182
1183
1184### OH_Drawing_Font
1185
1186```
1187typedef struct OH_Drawing_Font OH_Drawing_Font
1188```
1189
1190**描述**
1191
1192用于描述字体。
1193
1194**起始版本:** 11
1195
1196
1197### OH_Drawing_Font_Metrics
1198
1199```
1200typedef struct OH_Drawing_Font_Metrics OH_Drawing_Font_Metrics
1201```
1202
1203**描述**
1204
1205定义字体度量信息的结构体。
1206
1207**起始版本:** 12
1208
1209
1210### OH_Drawing_FontAdjustInfo
1211
1212```
1213typedef struct OH_Drawing_FontAdjustInfo OH_Drawing_FontAdjustInfo
1214```
1215
1216**描述**
1217
1218字重映射信息结构体。
1219
1220**起始版本:** 12
1221
1222
1223### OH_Drawing_FontAliasInfo
1224
1225```
1226typedef struct OH_Drawing_FontAliasInfo OH_Drawing_FontAliasInfo
1227```
1228
1229**描述**
1230
1231别名字体信息结构体。
1232
1233**起始版本:** 12
1234
1235
1236### OH_Drawing_FontCollection
1237
1238```
1239typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection
1240```
1241
1242**描述**
1243
1244用于加载字体。
1245
1246**起始版本:** 8
1247
1248
1249### OH_Drawing_FontConfigInfo
1250
1251```
1252typedef struct OH_Drawing_FontConfigInfo OH_Drawing_FontConfigInfo
1253```
1254
1255**描述**
1256
1257系统字体配置信息结构体。
1258
1259**起始版本:** 12
1260
1261
1262### OH_Drawing_FontDescriptor
1263
1264```
1265typedef struct OH_Drawing_FontDescriptor OH_Drawing_FontDescriptor
1266```
1267
1268**描述**
1269
1270描述系统字体详细信息的结构体。
1271
1272**起始版本:** 12
1273
1274
1275### OH_Drawing_FontEdging
1276
1277```
1278typedef enum OH_Drawing_FontEdging OH_Drawing_FontEdging
1279```
1280
1281**描述**
1282
1283字型边缘效果类型枚举。
1284
1285**起始版本:** 12
1286
1287
1288### OH_Drawing_FontFallbackGroup
1289
1290```
1291typedef struct OH_Drawing_FontFallbackGroup OH_Drawing_FontFallbackGroup
1292```
1293
1294**描述**
1295
1296备用字体集信息结构体。
1297
1298**起始版本:** 12
1299
1300
1301### OH_Drawing_FontFallbackInfo
1302
1303```
1304typedef struct OH_Drawing_FontFallbackInfo OH_Drawing_FontFallbackInfo
1305```
1306
1307**描述**
1308
1309备用字体信息结构体。
1310
1311**起始版本:** 12
1312
1313
1314### OH_Drawing_FontGenericInfo
1315
1316```
1317typedef struct OH_Drawing_FontGenericInfo OH_Drawing_FontGenericInfo
1318```
1319
1320**描述**
1321
1322系统所支持的通用字体集信息结构体。
1323
1324**起始版本:** 12
1325
1326
1327### OH_Drawing_FontHinting
1328
1329```
1330typedef enum OH_Drawing_FontHinting OH_Drawing_FontHinting
1331```
1332
1333**描述**
1334
1335字型轮廓效果类型枚举。
1336
1337**起始版本:** 12
1338
1339
1340### OH_Drawing_FontMgr
1341
1342```
1343typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr
1344```
1345
1346**描述**
1347
1348定义字体管理类, 用于字体管理。
1349
1350**起始版本:** 12
1351
1352
1353### OH_Drawing_FontParser
1354
1355```
1356typedef struct OH_Drawing_FontParser OH_Drawing_FontParser
1357```
1358
1359**描述**
1360
1361用来解析系统字体文件。
1362
1363**起始版本:** 12
1364
1365
1366### OH_Drawing_FontStyleSet
1367
1368```
1369typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet
1370```
1371
1372**描述**
1373
1374定义字体样式集, 用于字体样式族匹配。
1375
1376**起始版本:** 12
1377
1378
1379### OH_Drawing_FontStyleStruct
1380
1381```
1382typedef struct OH_Drawing_FontStyleStruct OH_Drawing_FontStyleStruct
1383```
1384
1385**描述**
1386
1387定义字体样式信息的结构体。
1388
1389**起始版本:** 12
1390
1391
1392### OH_Drawing_GpuContext
1393
1394```
1395typedef struct OH_Drawing_GpuContext OH_Drawing_GpuContext
1396```
1397
1398**描述**
1399
1400定义图形处理器上下文,用于描述图形处理器后端上下文。
1401
1402**起始版本:** 12
1403
1404
1405### OH_Drawing_GpuContextOptions
1406
1407```
1408typedef struct OH_Drawing_GpuContextOptions OH_Drawing_GpuContextOptions
1409```
1410
1411**描述**
1412
1413定义有关图形处理器上下文的选项。
1414
1415**起始版本:** 12
1416
1417
1418### OH_Drawing_Image
1419
1420```
1421typedef struct OH_Drawing_Image OH_Drawing_Image
1422```
1423
1424**描述**
1425
1426定义一个用于描述绘制二维像素数组的图片。
1427
1428**起始版本:** 12
1429
1430
1431### OH_Drawing_Image_Info
1432
1433```
1434typedef struct OH_Drawing_Image_Info OH_Drawing_Image_Info
1435```
1436
1437**描述**
1438
1439定义图片信息结构体。
1440
1441**起始版本:** 12
1442
1443
1444### OH_Drawing_LineMetrics
1445
1446```
1447typedef struct OH_Drawing_LineMetrics OH_Drawing_LineMetrics
1448```
1449
1450**描述**
1451
1452文字行位置信息。
1453
1454**起始版本:** 12
1455
1456
1457### OH_Drawing_MaskFilter
1458
1459```
1460typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter
1461```
1462
1463**描述**
1464
1465定义蒙版滤波器。
1466
1467**起始版本:** 11
1468
1469
1470### OH_Drawing_Matrix
1471
1472```
1473typedef struct OH_Drawing_Matrix OH_Drawing_Matrix
1474```
1475
1476**描述**
1477
1478定义一个矩阵,用于描述坐标变换。
1479
1480**起始版本:** 11
1481
1482
1483### OH_Drawing_MemoryStream
1484
1485```
1486typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream
1487```
1488
1489**描述**
1490
1491用于描述内存流。
1492
1493**起始版本:** 12
1494
1495
1496### OH_Drawing_MipmapMode
1497
1498```
1499typedef enum OH_Drawing_MipmapMode OH_Drawing_MipmapMode
1500```
1501
1502**描述**
1503
1504多级渐远纹理模式枚举。
1505
1506**起始版本:** 12
1507
1508
1509### OH_Drawing_Path
1510
1511```
1512typedef struct OH_Drawing_Path OH_Drawing_Path
1513```
1514
1515**描述**
1516
1517定义为路径,路径用于自定义各种形状。
1518
1519**起始版本:** 8
1520
1521
1522### OH_Drawing_PathAddMode
1523
1524```
1525typedef enum OH_Drawing_PathAddMode OH_Drawing_PathAddMode
1526```
1527
1528**描述**
1529
1530用于指定路径添加模式的枚举类型。
1531
1532**起始版本:** 12
1533
1534
1535### OH_Drawing_PathDirection
1536
1537```
1538typedef enum OH_Drawing_PathDirection OH_Drawing_PathDirection
1539```
1540
1541**描述**
1542
1543添加闭合轮廓方向枚举。
1544
1545**起始版本:** 12
1546
1547
1548### OH_Drawing_PathEffect
1549
1550```
1551typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect
1552```
1553
1554**描述**
1555
1556定义一个路径效果,用于影响描边路径。
1557
1558**起始版本:** 12
1559
1560
1561### OH_Drawing_PathFillType
1562
1563```
1564typedef enum OH_Drawing_PathFillType OH_Drawing_PathFillType
1565```
1566
1567**描述**
1568
1569定义路径的填充类型枚举。
1570
1571**起始版本:** 12
1572
1573
1574### OH_Drawing_Pen
1575
1576```
1577typedef struct OH_Drawing_Pen OH_Drawing_Pen
1578```
1579
1580**描述**
1581
1582定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。
1583
1584**起始版本:** 8
1585
1586
1587### OH_Drawing_PenLineCapStyle
1588
1589```
1590typedef enum OH_Drawing_PenLineCapStyle OH_Drawing_PenLineCapStyle
1591```
1592
1593**描述**
1594
1595枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。
1596
1597**起始版本:** 8
1598
1599
1600### OH_Drawing_PenLineJoinStyle
1601
1602```
1603typedef enum OH_Drawing_PenLineJoinStyle OH_Drawing_PenLineJoinStyle
1604```
1605
1606**描述**
1607
1608枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。
1609
1610**起始版本:** 8
1611
1612
1613### OH_Drawing_PixelMap
1614
1615```
1616typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap
1617```
1618
1619**描述**
1620
1621定义像素图,用于包装图像框架支持的真实像素图。
1622
1623**起始版本:** 12
1624
1625
1626### OH_Drawing_PlaceholderSpan
1627
1628```
1629typedef struct OH_Drawing_PlaceholderSpan OH_Drawing_PlaceholderSpan
1630```
1631
1632**描述**
1633
1634用于描述占位符跨度的结构体。
1635
1636**起始版本:** 11
1637
1638
1639### OH_Drawing_PlaceholderVerticalAlignment
1640
1641```
1642typedef enum OH_Drawing_PlaceholderVerticalAlignment OH_Drawing_PlaceholderVerticalAlignment
1643```
1644
1645**描述**
1646
1647占位符垂直对齐枚举。
1648
1649**起始版本:** 11
1650
1651
1652### OH_Drawing_Point
1653
1654```
1655typedef struct OH_Drawing_Point OH_Drawing_Point
1656```
1657
1658**描述**
1659
1660定义一个点,用于描述坐标点。
1661
1662**起始版本:** 11
1663
1664
1665### OH_Drawing_Point2D
1666
1667```
1668typedef struct OH_Drawing_Point2D OH_Drawing_Point2D
1669```
1670
1671**描述**
1672
1673定义一个二维的坐标点。
1674
1675**起始版本:** 12
1676
1677
1678### OH_Drawing_Point3D
1679
1680```
1681typedef struct OH_Drawing_Point3D OH_Drawing_Point3D
1682```
1683
1684**描述**
1685
1686定义一个三维的坐标点。
1687
1688**起始版本:** 12
1689
1690
1691### OH_Drawing_PointMode
1692
1693```
1694typedef enum OH_Drawing_PointMode OH_Drawing_PointMode
1695```
1696
1697**描述**
1698
1699绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。
1700
1701**起始版本:** 12
1702
1703
1704### OH_Drawing_PositionAndAffinity
1705
1706```
1707typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity
1708```
1709
1710**描述**
1711
1712用于接收字体的位置和亲和性。
1713
1714**起始版本:** 11
1715
1716
1717### OH_Drawing_Range
1718
1719```
1720typedef struct OH_Drawing_Range OH_Drawing_Range
1721```
1722
1723**描述**
1724
1725用于接收字体的起始位置和结束位置。
1726
1727**起始版本:** 11
1728
1729
1730### OH_Drawing_Rect
1731
1732```
1733typedef struct OH_Drawing_Rect OH_Drawing_Rect
1734```
1735
1736**描述**
1737
1738用于描述矩形。
1739
1740**起始版本:** 11
1741
1742
1743### OH_Drawing_RectHeightStyle
1744
1745```
1746typedef enum OH_Drawing_RectHeightStyle OH_Drawing_RectHeightStyle
1747```
1748
1749**描述**
1750
1751矩形框高度样式枚举。
1752
1753**起始版本:** 11
1754
1755
1756### OH_Drawing_RectStyle_Info
1757
1758```
1759typedef struct OH_Drawing_RectStyle_Info OH_Drawing_RectStyle_Info
1760```
1761
1762**描述**
1763
1764定义矩形框样式结构体。
1765
1766**起始版本:** 12
1767
1768
1769### OH_Drawing_RectWidthStyle
1770
1771```
1772typedef enum OH_Drawing_RectWidthStyle OH_Drawing_RectWidthStyle
1773```
1774
1775**描述**
1776
1777矩形框宽度样式枚举。
1778
1779**起始版本:** 11
1780
1781
1782### OH_Drawing_Region
1783
1784```
1785typedef struct OH_Drawing_Region OH_Drawing_Region
1786```
1787
1788**描述**
1789
1790定义一个区域,用于表示画布上的封闭区域,实现更精确的图形控制。
1791
1792**起始版本:** 12
1793
1794
1795### OH_Drawing_RoundRect
1796
1797```
1798typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect
1799```
1800
1801**描述**
1802
1803用于描述圆角矩形。
1804
1805**起始版本:** 11
1806
1807
1808### OH_Drawing_RunBuffer
1809
1810```
1811typedef struct OH_Drawing_RunBuffer OH_Drawing_RunBuffer
1812```
1813
1814**描述**
1815
1816结构体用于描述一块内存,描述文字和位置信息。
1817
1818**起始版本:** 11
1819
1820
1821### OH_Drawing_SamplingOptions
1822
1823```
1824typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions
1825```
1826
1827**描述**
1828
1829定义一个采样选项,用于描述图片、位图等图像的采样方法。
1830
1831**起始版本:** 12
1832
1833
1834### OH_Drawing_ScaleToFit
1835
1836```
1837typedef enum OH_Drawing_ScaleToFit OH_Drawing_ScaleToFit
1838```
1839
1840**描述**
1841
1842矩阵缩放方式枚举。
1843
1844**起始版本:** 12
1845
1846
1847### OH_Drawing_ShaderEffect
1848
1849```
1850typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect
1851```
1852
1853**描述**
1854
1855定义一个着色器,用于描述绘制内容的源颜色。
1856
1857**起始版本:** 11
1858
1859
1860### OH_Drawing_ShadowLayer
1861
1862```
1863typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer
1864```
1865
1866**描述**
1867
1868定义一个阴影层,用于描述绘制内容的阴影层。
1869
1870**起始版本:** 12
1871
1872
1873### OH_Drawing_SrcRectConstraint
1874
1875```
1876typedef enum OH_Drawing_SrcRectConstraint OH_Drawing_SrcRectConstraint
1877```
1878
1879**描述**
1880
1881源矩形区域约束类型枚举。
1882
1883**起始版本:** 12
1884
1885
1886### OH_Drawing_StrutStyle
1887
1888```
1889typedef struct OH_Drawing_StrutStyle OH_Drawing_StrutStyle
1890```
1891
1892**描述**
1893
1894用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。
1895
1896**起始版本:** 12
1897
1898
1899### OH_Drawing_Surface
1900
1901```
1902typedef struct OH_Drawing_Surface OH_Drawing_Surface
1903```
1904
1905**描述**
1906
1907定义surface,用于管理画布绘制的内容。
1908
1909**起始版本:** 12
1910
1911
1912### OH_Drawing_TextBlob
1913
1914```
1915typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob
1916```
1917
1918**描述**
1919
1920定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。
1921
1922**起始版本:** 11
1923
1924
1925### OH_Drawing_TextBlobBuilder
1926
1927```
1928typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder
1929```
1930
1931**描述**
1932
1933定义文本构建器,用于构建文本。
1934
1935**起始版本:** 11
1936
1937
1938### OH_Drawing_TextBox
1939
1940```
1941typedef struct OH_Drawing_TextBox OH_Drawing_TextBox
1942```
1943
1944**描述**
1945
1946用于接收文本框的矩形大小、方向和数量大小。
1947
1948**起始版本:** 11
1949
1950
1951### OH_Drawing_TextDecorationStyle
1952
1953```
1954typedef enum OH_Drawing_TextDecorationStyle OH_Drawing_TextDecorationStyle
1955```
1956
1957**描述**
1958
1959文本装饰样式枚举。
1960
1961**起始版本:** 11
1962
1963
1964### OH_Drawing_TextEncoding
1965
1966```
1967typedef enum OH_Drawing_TextEncoding OH_Drawing_TextEncoding
1968```
1969
1970**描述**
1971
1972文本编码类型枚举。
1973
1974**起始版本:** 12
1975
1976
1977### OH_Drawing_TextShadow
1978
1979```
1980typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow
1981```
1982
1983**描述**
1984
1985用于管理文本阴影。
1986
1987**起始版本:** 12
1988
1989
1990### OH_Drawing_TextStyle
1991
1992```
1993typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle
1994```
1995
1996**描述**
1997
1998用于管理字体颜色、装饰等。
1999
2000**起始版本:** 8
2001
2002
2003### OH_Drawing_TileMode
2004
2005```
2006typedef enum OH_Drawing_TileMode OH_Drawing_TileMode
2007```
2008
2009**描述**
2010
2011着色器效果平铺模式的枚举。
2012
2013**起始版本:** 11
2014
2015
2016### OH_Drawing_Typeface
2017
2018```
2019typedef struct OH_Drawing_Typeface OH_Drawing_Typeface
2020```
2021
2022**描述**
2023
2024用于描述字形。
2025
2026**起始版本:** 11
2027
2028
2029### OH_Drawing_Typography
2030
2031```
2032typedef struct OH_Drawing_Typography OH_Drawing_Typography
2033```
2034
2035**描述**
2036
2037用于管理排版的布局和显示等。
2038
2039**起始版本:** 8
2040
2041
2042### OH_Drawing_TypographyCreate
2043
2044```
2045typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate
2046```
2047
2048**描述**
2049
2050用于创建[OH_Drawing_Typography](#oh_drawing_typography)。
2051
2052**起始版本:** 8
2053
2054
2055### OH_Drawing_TypographyStyle
2056
2057```
2058typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle
2059```
2060
2061**描述**
2062
2063用于管理排版风格,如文字方向等。
2064
2065**起始版本:** 8
2066
2067
2068### OH_Drawing_VertexMode
2069
2070```
2071typedef enum OH_Drawing_VertexMode OH_Drawing_VertexMode
2072```
2073
2074**描述**
2075
2076用于指定如何解释给定顶点的几何形状的枚举类型。
2077
2078**起始版本:** 12
2079
2080
2081### OH_Drawing_WordBreakType
2082
2083```
2084typedef enum OH_Drawing_WordBreakType OH_Drawing_WordBreakType
2085```
2086
2087**描述**
2088
2089单词的断词方式枚举。
2090
2091**起始版本:** 11
2092
2093
2094## 枚举类型说明
2095
2096### OH_Drawing_SystemFontType
2097
2098```
2099enum OH_Drawing_SystemFontType
2100```
2101
2102**描述**
2103
2104字体类型的枚举。
2105
2106**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2107
2108**起始版本:** 14
2109
2110| 枚举值 | 描述 |
2111| -------- | -------- |
2112| ALL | 所有字体类型。 |
2113| GENERIC | 系统字体类型。 |
2114| STYLISH | 风格字体类型。 |
2115| INSTALLED | 用户已安装字体类型。 |
2116
2117### OH_Drawing_ErrorCode
2118
2119```
2120enum OH_Drawing_ErrorCode
2121```
2122
2123**描述**
2124
2125枚举本模块可能产生的错误码。
2126
2127**起始版本:** 12
2128
2129| 枚举值 | 描述 |
2130| -------- | -------- |
2131| OH_DRAWING_SUCCESS | 操作成功完成。 |
2132| OH_DRAWING_ERROR_NO_PERMISSION | 权限校验失败。 |
2133| OH_DRAWING_ERROR_INVALID_PARAMETER | 无效的输入参数,如参数中传入了NULL。 |
2134| OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE | 输入参数不在有效的范围内。 |
2135| OH_DRAWING_ERROR_ALLOCATION_FAILED<sup>13+</sup> | 内存分配失败。 |
2136
2137### OH_Drawing_PathMeasureMatrixFlags
2138
2139```
2140enum OH_Drawing_PathMeasureMatrixFlags
2141```
2142
2143**描述**
2144
2145路径测量获取相应矩阵信息维度枚举。
2146
2147**起始版本:** 12
2148
2149| 枚举值 | 描述 |
2150| -------- | -------- |
2151| GET_POSITION_MATRIX | 获取位置信息对应的矩阵。 |
2152| GET_TANGENT_MATRIX | 获取切线信息对应的矩阵。 |
2153| GET_POSITION_AND_TANGENT_MATRIX | 获取位置和切线信息对应的矩阵。 |
2154
2155
2156### OH_Drawing_PathOpMode
2157
2158```
2159enum OH_Drawing_PathOpMode
2160```
2161
2162**描述**
2163
2164路径操作类型枚举。
2165
2166**起始版本:** 12
2167
2168| 枚举值 | 描述 |
2169| -------- | -------- |
2170| PATH_OP_MODE_DIFFERENCE | 差集操作。 |
2171| PATH_OP_MODE_INTERSECT | 交集操作。 |
2172| PATH_OP_MODE_UNION | 并集操作。 |
2173| PATH_OP_MODE_XOR | 异或操作。 |
2174| PATH_OP_MODE_REVERSE_DIFFERENCE | 反向差集操作。 |
2175
2176
2177### OH_Drawing_RegionOpMode
2178
2179```
2180enum OH_Drawing_RegionOpMode
2181```
2182
2183**描述**
2184
2185区域操作类型枚举。
2186
2187**起始版本:** 12
2188
2189| 枚举值 | 描述 |
2190| -------- | -------- |
2191| REGION_OP_MODE_DIFFERENCE | 差集操作。 |
2192| REGION_OP_MODE_INTERSECT | 交集操作。 |
2193| REGION_OP_MODE_UNION | 并集操作。 |
2194| REGION_OP_MODE_XOR | 异或操作。 |
2195| REGION_OP_MODE_REVERSE_DIFFERENCE | 反向差集操作。 |
2196| REGION_OP_MODE_REPLACE | 替换操作。 |
2197
2198
2199### OH_Drawing_AlphaFormat
2200
2201```
2202enum OH_Drawing_AlphaFormat
2203```
2204
2205**描述**
2206
2207用于描述位图像素的透明度分量。
2208
2209**起始版本:** 8
2210
2211| 枚举值 | 描述 |
2212| -------- | -------- |
2213| ALPHA_FORMAT_UNKNOWN | 未知格式。 |
2214| ALPHA_FORMAT_OPAQUE | 位图无透明度。 |
2215| ALPHA_FORMAT_PREMUL | 每个像素的颜色组件由透明度分量预先乘以。 |
2216| ALPHA_FORMAT_UNPREMUL | 每个像素的颜色组件未由透明度分量预先乘以。 |
2217
2218
2219### OH_Drawing_BlendMode
2220
2221```
2222enum OH_Drawing_BlendMode
2223```
2224
2225**描述**
2226
2227混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在红、绿、蓝3个颜色通道上是相同的(透明度有另外的处理规则)。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。
2228
2229为简洁起见,我们使用以下缩写:
2230
2231s : source,源的缩写。
2232
2233d : destination,目标的缩写。
2234
2235sa : source alpha,源透明度的缩写。
2236
2237da : destination alpha,目标透明度的缩写。
2238
2239计算结果用如下缩写表示:
2240
2241r : 如果4个通道的计算方式相同,用r表示。
2242
2243ra : 如果只操作透明度通道,用ra表示。
2244
2245rc : 如果操作3个颜色通道,用rc表示。
2246
2247**起始版本:** 11
2248
2249| 枚举值 | 描述 |
2250| -------- | -------- |
2251| BLEND_MODE_CLEAR | 清除模式,r = 0. |
2252| BLEND_MODE_SRC | r = s(result的4个通道,都等于source的4个通道,即结果等于源。) |
2253| BLEND_MODE_DST | r = d(result的4个通道,都等于destination的4个通道,即结果等于目标。) |
2254| BLEND_MODE_SRC_OVER | r = s + (1 - sa) \* d. |
2255| BLEND_MODE_DST_OVER | r = d + (1 - da) \* s. |
2256| BLEND_MODE_SRC_IN | r = s \* da. |
2257| BLEND_MODE_DST_IN | r = d \* sa. |
2258| BLEND_MODE_SRC_OUT | r = s \* (1 - da). |
2259| BLEND_MODE_DST_OUT | r = d \* (1 - sa). |
2260| BLEND_MODE_SRC_ATOP | r = s \* da + d \* (1 - sa). |
2261| BLEND_MODE_DST_ATOP | r = d \* sa + s \* (1 - da). |
2262| BLEND_MODE_XOR | r = s \* (1 - da) + d \* (1 - sa). |
2263| BLEND_MODE_PLUS | r = min(s + d, 1). |
2264| BLEND_MODE_MODULATE | r = s \* d. |
2265| BLEND_MODE_SCREEN | 滤色模式,r = s + d - s \* d. |
2266| BLEND_MODE_OVERLAY | 叠加模式。 |
2267| BLEND_MODE_DARKEN | 变暗模式,rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d. |
2268| BLEND_MODE_LIGHTEN | 变亮模式,rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d. |
2269| BLEND_MODE_COLOR_DODGE | 颜色减淡模式。 |
2270| BLEND_MODE_COLOR_BURN | 颜色加深模式。 |
2271| BLEND_MODE_HARD_LIGHT | 强光模式。 |
2272| BLEND_MODE_SOFT_LIGHT | 柔光模式。 |
2273| BLEND_MODE_DIFFERENCE | 差值模式,rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d. |
2274| BLEND_MODE_EXCLUSION | 排除模式,rc = s + d - two(s \* d), ra = s + (1 - sa) \* d. |
2275| BLEND_MODE_MULTIPLY | 正片叠底,r = s \* (1 - da) + d \* (1 - sa) + s \* d. |
2276| BLEND_MODE_HUE | 色相模式。 |
2277| BLEND_MODE_SATURATION | 饱和度模式。 |
2278| BLEND_MODE_COLOR | 颜色模式。 |
2279| BLEND_MODE_LUMINOSITY | 亮度模式。 |
2280
2281
2282### OH_Drawing_BlurType
2283
2284```
2285enum OH_Drawing_BlurType
2286```
2287
2288**描述**
2289
2290蒙版滤波器模糊操作类型的枚举。
2291
2292**起始版本:** 11
2293
2294| 枚举值 | 描述 |
2295| -------- | -------- |
2296| NORMAL | 内外模糊。 |
2297| SOLID | 内部实体,外部模糊。 |
2298| OUTER | 内部空白,外部模糊。 |
2299| INNER | 内部模糊,外部空白。 |
2300
2301
2302### OH_Drawing_BreakStrategy
2303
2304```
2305enum OH_Drawing_BreakStrategy
2306```
2307
2308**描述**
2309
2310文本的中断策略枚举。
2311
2312**起始版本:** 11
2313
2314| 枚举值 | 描述 |
2315| -------- | -------- |
2316| BREAK_STRATEGY_GREEDY | 贪心策略,换行时尽可能填满每一行。 |
2317| BREAK_STRATEGY_HIGH_QUALITY | 高质量策略,换行时优先考虑文本的连续性。 |
2318| BREAK_STRATEGY_BALANCED | 平衡策略,换行时在单词边界换行。 |
2319
2320
2321### OH_Drawing_CanvasClipOp
2322
2323```
2324enum OH_Drawing_CanvasClipOp
2325```
2326
2327**描述**
2328
2329画布裁剪方式的枚举集合。
2330
2331**起始版本:** 11
2332
2333| 枚举值 | 描述 |
2334| -------- | -------- |
2335| DIFFERENCE | 将指定区域裁剪(取差集)。 |
2336| INTERSECT | 将指定区域保留(取交集)。 |
2337
2338
2339### OH_Drawing_CanvasShadowFlags
2340
2341```
2342enum OH_Drawing_CanvasShadowFlags
2343```
2344
2345**描述**
2346
2347阴影标志枚举。
2348
2349**起始版本:** 12
2350
2351| 枚举值 | 描述 |
2352| -------- | -------- |
2353| SHADOW_FLAGS_NONE | 无阴影标志。 |
2354| SHADOW_FLAGS_TRANSPARENT_OCCLUDER | 遮挡物对象不透明标志。 |
2355| SHADOW_FLAGS_GEOMETRIC_ONLY | 不分析阴影标志。 |
2356| SHADOW_FLAGS_ALL | 使能以上所有阴影标志。 |
2357
2358
2359### OH_Drawing_ColorFormat
2360
2361```
2362enum OH_Drawing_ColorFormat
2363```
2364
2365**描述**
2366
2367用于描述位图像素的存储格式。
2368
2369**起始版本:** 8
2370
2371| 枚举值 | 描述 |
2372| -------- | -------- |
2373| COLOR_FORMAT_UNKNOWN | 未知格式。 |
2374| COLOR_FORMAT_ALPHA_8 | 每个像素用一个8位的量表示,8个位比特位表示透明度。 |
2375| COLOR_FORMAT_RGB_565 | 每个像素用一个16位的量表示,高位到低位依次是5个比特位表示红,6个比特位表示绿,5个比特位表示蓝。 |
2376| COLOR_FORMAT_ARGB_4444 | 每个像素用一个16位的量表示,高位到低位依次是4个比特位表示透明度,4个比特位表示红,4个比特位表示绿,4个比特位表示蓝。 |
2377| COLOR_FORMAT_RGBA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示透明度,8个比特位表示红,8个比特位表示绿,8个比特位表示蓝。 |
2378| COLOR_FORMAT_BGRA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示蓝,8个比特位表示绿,8个比特位表示红,8个比特位表示透明度。 |
2379
2380
2381### OH_Drawing_CornerPos
2382
2383```
2384enum OH_Drawing_CornerPos
2385```
2386
2387**描述**
2388
2389用于描述圆角位置的枚举。
2390
2391**起始版本:** 12
2392
2393| 枚举值 | 描述 |
2394| -------- | -------- |
2395| CORNER_POS_TOP_LEFT | 左上角圆角位置。 |
2396| CORNER_POS_TOP_RIGHT | 右上角圆角位置。 |
2397| CORNER_POS_BOTTOM_RIGHT | 右下角圆角位置。 |
2398| CORNER_POS_BOTTOM_LEFT | 左下角圆角位置。 |
2399
2400
2401### OH_Drawing_EllipsisModal
2402
2403```
2404enum OH_Drawing_EllipsisModal
2405```
2406
2407**描述**
2408
2409省略号样式枚举。
2410
2411**起始版本:** 11
2412
2413| 枚举值 | 描述 |
2414| -------- | -------- |
2415| ELLIPSIS_MODAL_HEAD | 头部模式,即省略号放在文本头部。 |
2416| ELLIPSIS_MODAL_MIDDLE | 中部模式,即省略号放在文本中部。 |
2417| ELLIPSIS_MODAL_TAIL | 尾部模式,即省略号放在文本尾部。 |
2418
2419
2420### OH_Drawing_FilterMode
2421
2422```
2423enum OH_Drawing_FilterMode
2424```
2425
2426**描述**
2427
2428过滤模式枚举。
2429
2430**起始版本:** 12
2431
2432| 枚举值 | 描述 |
2433| -------- | -------- |
2434| FILTER_MODE_NEAREST | 邻近过滤模式。 |
2435| FILTER_MODE_LINEAR | 线性过滤模式。 |
2436
2437
2438### OH_Drawing_FontConfigInfoErrorCode
2439
2440```
2441enum OH_Drawing_FontConfigInfoErrorCode
2442```
2443
2444**描述**
2445
2446获取系统字体配置信息列表结果枚举。
2447
2448**起始版本:** 12
2449
2450| 枚举值 | 描述 |
2451| -------- | -------- |
2452| SUCCESS_FONT_CONFIG_INFO | 获取系统字体配置信息列表成功。 |
2453| ERROR_FONT_CONFIG_INFO_UNKNOWN | 未知错误。 |
2454| ERROR_FONT_CONFIG_INFO_PARSE_FILE | 解析系统配置文件失败。 |
2455| ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY | 申请内存失败。 |
2456| ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA | 拷贝字符串数据失败。 |
2457
2458
2459### OH_Drawing_FontEdging
2460
2461```
2462enum OH_Drawing_FontEdging
2463```
2464
2465**描述**
2466
2467字型边缘效果类型枚举。
2468
2469**起始版本:** 12
2470
2471| 枚举值 | 描述 |
2472| -------- | -------- |
2473| FONT_EDGING_ALIAS | 无抗锯齿处理。 |
2474| FONT_EDGING_ANTI_ALIAS | 使用抗锯齿来平滑字型边缘。 |
2475| FONT_EDGING_SUBPIXEL_ANTI_ALIAS | 使用次像素级别的抗锯齿来平滑字型边缘,可以获得更加平滑的字形渲染效果。 |
2476
2477
2478### OH_Drawing_FontHinting
2479
2480```
2481enum OH_Drawing_FontHinting
2482```
2483
2484**描述**
2485
2486字型轮廓效果类型枚举。
2487
2488**起始版本:** 12
2489
2490| 枚举值 | 描述 |
2491| -------- | -------- |
2492| FONT_HINTING_NONE | 不修改字型轮廓。 |
2493| FONT_HINTING_SLIGHT | 最小限度修改字型轮廓以改善对比度。 |
2494| FONT_HINTING_NORMAL | 修改字型轮廓以提高对比度。 |
2495| FONT_HINTING_FULL | 修改字型轮廓以获得最大对比度。 |
2496
2497
2498### OH_Drawing_FontStyle
2499
2500```
2501enum OH_Drawing_FontStyle
2502```
2503
2504**描述**
2505
2506区分字体是否为斜体。
2507
2508| 枚举值 | 描述 |
2509| -------- | -------- |
2510| FONT_STYLE_NORMAL | 非斜体。 |
2511| FONT_STYLE_ITALIC | 斜体。 |
2512| FONT_STYLE_OBLIQUE<sup>12+</sup> | 倾斜字体。 |
2513
2514
2515### OH_Drawing_FontWeight
2516
2517```
2518enum OH_Drawing_FontWeight
2519```
2520
2521**描述**
2522
2523字重。
2524
2525| 枚举值 | 描述 |
2526| -------- | -------- |
2527| FONT_WEIGHT_100 | 字重为thin |
2528| FONT_WEIGHT_200 | 字重为extra-light |
2529| FONT_WEIGHT_300 | 字重为light |
2530| FONT_WEIGHT_400 | 字重为normal/regular |
2531| FONT_WEIGHT_500 | 字重为medium |
2532| FONT_WEIGHT_600 | 字重为semi-bold |
2533| FONT_WEIGHT_700 | 字重为bold |
2534| FONT_WEIGHT_800 | 字重为extra-bold |
2535| FONT_WEIGHT_900 | 字重为black |
2536
2537
2538### OH_Drawing_FontWidth
2539
2540```
2541enum OH_Drawing_FontWidth
2542```
2543
2544**描述**
2545
2546字体宽度的枚举。
2547
2548**起始版本:** 12
2549
2550
2551### OH_Drawing_MipmapMode
2552
2553```
2554enum OH_Drawing_MipmapMode
2555```
2556
2557**描述**
2558
2559多级渐远纹理模式枚举。
2560
2561**起始版本:** 12
2562
2563| 枚举值 | 描述 |
2564| -------- | -------- |
2565| MIPMAP_MODE_NONE | 忽略多级渐远纹理级别。 |
2566| MIPMAP_MODE_NEAREST | 邻近多级渐远级别采样。 |
2567| MIPMAP_MODE_LINEAR | 两个邻近多级渐远纹理之间,线性插值采样。 |
2568
2569
2570### OH_Drawing_PathAddMode
2571
2572```
2573enum OH_Drawing_PathAddMode
2574```
2575
2576**描述**
2577
2578用于指定路径添加模式的枚举类型。
2579
2580**起始版本:** 12
2581
2582| 枚举值 | 描述 |
2583| -------- | -------- |
2584| PATH_ADD_MODE_APPEND | 以追加的方式添加路径。 |
2585| PATH_ADD_MODE_EXTEND | 如果之前的路径未闭合,则添加直线闭合路径。 |
2586
2587
2588### OH_Drawing_PathDirection
2589
2590```
2591enum OH_Drawing_PathDirection
2592```
2593
2594**描述**
2595
2596添加闭合轮廓方向枚举。
2597
2598**起始版本:** 12
2599
2600| 枚举值 | 描述 |
2601| -------- | -------- |
2602| PATH_DIRECTION_CW | 顺时针方向添加闭合轮廓。 |
2603| PATH_DIRECTION_CCW | 逆时针方向添加闭合轮廓。 |
2604
2605
2606### OH_Drawing_PathFillType
2607
2608```
2609enum OH_Drawing_PathFillType
2610```
2611
2612**描述**
2613
2614定义路径的填充类型枚举。
2615
2616**起始版本:** 12
2617
2618| 枚举值 | 描述 |
2619| -------- | -------- |
2620| PATH_FILL_TYPE_WINDING | 绘制区域中的任意一点,向任意方向射出一条射线,对于射线和路径的所有交点,初始计数为0,遇到每个顺时针的交点(路径从射线的左边向右穿过),计数加1,遇到每个逆时针的交点(路径从射线的右边向左穿过),计数减1,若最终的计数结果为0,则认为这个点在路径内部,需要被涂色;若计数为0则不被涂色。 |
2621| PATH_FILL_TYPE_EVEN_ODD | 绘制区域中的任意一点,向任意方向射出一条射线,若这条射线和路径相交的次数是奇数,则这个点被认为在路径内部,需要被涂色;若是偶数则不被涂色。 |
2622| PATH_FILL_TYPE_INVERSE_WINDING | PATH_FILL_TYPE_WINDING 涂色规则取反。 |
2623| PATH_FILL_TYPE_INVERSE_EVEN_ODD | PATH_FILL_TYPE_EVEN_ODD 涂色规则取反。 |
2624
2625
2626### OH_Drawing_PenLineCapStyle
2627
2628```
2629enum OH_Drawing_PenLineCapStyle
2630```
2631
2632**描述**
2633
2634枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。
2635
2636**起始版本:** 8
2637
2638| 枚举值 | 描述 |
2639| -------- | -------- |
2640| LINE_FLAT_CAP | 没有笔帽样式,线条头尾端点处横切。 |
2641| LINE_SQUARE_CAP | 笔帽的样式为方框,线条的头尾端点处多出一个方框,方框宽度和线段一样宽,高度时线段厚度的一半。 |
2642| LINE_ROUND_CAP | 笔帽的样式为圆弧,线条的头尾端点处多出一个半圆弧,半圆的直径与线段厚度一致。 |
2643
2644
2645### OH_Drawing_PenLineJoinStyle
2646
2647```
2648enum OH_Drawing_PenLineJoinStyle
2649```
2650
2651**描述**
2652
2653枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。
2654
2655**起始版本:** 8
2656
2657| 枚举值 | 描述 |
2658| -------- | -------- |
2659| LINE_MITER_JOIN | 转角类型为尖角,如果折线角度比较小,则尖角会很长,需要使用限制值(miter limit)进行限制。 |
2660| LINE_ROUND_JOIN | 转角类型为圆头。 |
2661| LINE_BEVEL_JOIN | 转角类型为平头。 |
2662
2663
2664### OH_Drawing_PlaceholderVerticalAlignment
2665
2666```
2667enum OH_Drawing_PlaceholderVerticalAlignment
2668```
2669
2670**描述**
2671
2672占位符垂直对齐枚举。
2673
2674**起始版本:** 11
2675
2676| 枚举值 | 描述 |
2677| -------- | -------- |
2678| ALIGNMENT_OFFSET_AT_BASELINE | 偏移于基线对齐。 |
2679| ALIGNMENT_ABOVE_BASELINE | 高于基线对齐。 |
2680| ALIGNMENT_BELOW_BASELINE | 低于基线对齐。 |
2681| ALIGNMENT_TOP_OF_ROW_BOX | 行框顶部对齐。 |
2682| ALIGNMENT_BOTTOM_OF_ROW_BOX | 行框底部对齐。 |
2683| ALIGNMENT_CENTER_OF_ROW_BOX | 行框中心对齐。 |
2684
2685
2686### OH_Drawing_PointMode
2687
2688```
2689enum OH_Drawing_PointMode
2690```
2691
2692**描述**
2693
2694绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。
2695
2696**起始版本:** 12
2697
2698| 枚举值 | 描述 |
2699| -------- | -------- |
2700| POINT_MODE_POINTS | 分别绘制每个点。 |
2701| POINT_MODE_LINES | 将每两个点绘制为线段。 |
2702| POINT_MODE_POLYGON | 将点阵列绘制为开放多边形。 |
2703
2704
2705### OH_Drawing_RectHeightStyle
2706
2707```
2708enum OH_Drawing_RectHeightStyle
2709```
2710
2711**描述**
2712
2713矩形框高度样式枚举。
2714
2715**起始版本:** 11
2716
2717| 枚举值 | 描述 |
2718| -------- | -------- |
2719| RECT_HEIGHT_STYLE_TIGHT | 紧密样式。 |
2720| RECT_HEIGHT_STYLE_MAX | 最大样式。 |
2721| RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE | 包含行间距中间样式。 |
2722| RECT_HEIGHT_STYLE_INCLUDELINESPACETOP | 包含行间距顶部样式。 |
2723| RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM | 包含行间距底部样式。 |
2724| RECT_HEIGHT_STYLE_STRUCT | 结构样式。 |
2725
2726
2727### OH_Drawing_RectWidthStyle
2728
2729```
2730enum OH_Drawing_RectWidthStyle
2731```
2732
2733**描述**
2734
2735矩形框宽度样式枚举。
2736
2737**起始版本:** 11
2738
2739| 枚举值 | 描述 |
2740| -------- | -------- |
2741| RECT_WIDTH_STYLE_TIGHT | 紧密样式。 |
2742| RECT_WIDTH_STYLE_MAX | 最大样式。 |
2743
2744
2745### OH_Drawing_ScaleToFit
2746
2747```
2748enum OH_Drawing_ScaleToFit
2749```
2750
2751**描述**
2752
2753矩阵缩放方式枚举。
2754
2755**起始版本:** 12
2756
2757| 枚举值 | 描述 |
2758| -------- | -------- |
2759| SCALE_TO_FIT_FILL | 按水平轴和垂直轴缩放以填充目标矩形。 |
2760| SCALE_TO_FIT_START | 缩放并对齐到左侧和顶部。 |
2761| SCALE_TO_FIT_CENTER | 缩放并居中对齐。 |
2762| SCALE_TO_FIT_END | 缩放并向右和向下对齐。 |
2763
2764
2765### OH_Drawing_SrcRectConstraint
2766
2767```
2768enum OH_Drawing_SrcRectConstraint
2769```
2770
2771**描述**
2772
2773源矩形区域约束类型枚举。
2774
2775**起始版本:** 12
2776
2777| 枚举值 | 描述 |
2778| -------- | -------- |
2779| STRICT_SRC_RECT_CONSTRAINT | 严格约束,源矩形区域必须完全包含在图像中。 |
2780| FAST_SRC_RECT_CONSTRAINT | 快速约束,源矩形区域可以部分位于图像之外。 |
2781
2782
2783### OH_Drawing_TextAlign
2784
2785```
2786enum OH_Drawing_TextAlign
2787```
2788
2789**描述**
2790
2791文字对齐方式。
2792
2793| 枚举值 | 描述 |
2794| -------- | -------- |
2795| TEXT_ALIGN_LEFT | 左对齐。 |
2796| TEXT_ALIGN_RIGHT | 右对齐。 |
2797| TEXT_ALIGN_CENTER | 居中对齐。 |
2798| TEXT_ALIGN_JUSTIFY | 两端对齐,即紧靠左和右边缘,中间单词空隙由空格填充,最后一行除外。 |
2799| 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相同。 |
2800| 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相同。 |
2801
2802
2803### OH_Drawing_TextBaseline
2804
2805```
2806enum OH_Drawing_TextBaseline
2807```
2808
2809**描述**
2810
2811基线位置。
2812
2813| 枚举值 | 描述 |
2814| -------- | -------- |
2815| TEXT_BASELINE_ALPHABETIC | 用于表音文字,基线在中间偏下的位置。 |
2816| TEXT_BASELINE_IDEOGRAPHIC | 用于表意文字,基线位于底部。 |
2817
2818
2819### OH_Drawing_TextDecoration
2820
2821```
2822enum OH_Drawing_TextDecoration
2823```
2824
2825**描述**
2826
2827文本装饰。
2828
2829| 枚举值 | 描述 |
2830| -------- | -------- |
2831| TEXT_DECORATION_NONE | 无装饰。 |
2832| TEXT_DECORATION_UNDERLINE | 下划线。 |
2833| TEXT_DECORATION_OVERLINE | 上划线。 |
2834| TEXT_DECORATION_LINE_THROUGH | 删除线。 |
2835
2836
2837### OH_Drawing_TextDecorationStyle
2838
2839```
2840enum OH_Drawing_TextDecorationStyle
2841```
2842
2843**描述**
2844
2845文本装饰样式枚举。
2846
2847**起始版本:** 11
2848
2849| 枚举值 | 描述 |
2850| -------- | -------- |
2851| TEXT_DECORATION_STYLE_SOLID | 实心样式。 |
2852| TEXT_DECORATION_STYLE_DOUBLE | 双重样式。 |
2853| TEXT_DECORATION_STYLE_DOTTED | 圆点样式。 |
2854| TEXT_DECORATION_STYLE_DASHED | 虚线样式。 |
2855| TEXT_DECORATION_STYLE_WAVY | 波浪样式。 |
2856
2857
2858### OH_Drawing_TextDirection
2859
2860```
2861enum OH_Drawing_TextDirection
2862```
2863
2864**描述**
2865
2866文字方向。
2867
2868| 枚举值 | 描述 |
2869| -------- | -------- |
2870| TEXT_DIRECTION_RTL | 方向:从右到左。 |
2871| TEXT_DIRECTION_LTR | 方向:从左到右。 |
2872
2873
2874### OH_Drawing_TextEncoding
2875
2876```
2877enum OH_Drawing_TextEncoding
2878```
2879
2880**描述**
2881
2882文本编码类型枚举。
2883
2884**起始版本:** 12
2885
2886| 枚举值 | 描述 |
2887| -------- | -------- |
2888| TEXT_ENCODING_UTF8 | 单字节,表示UTF-8或ASCII。 |
2889| TEXT_ENCODING_UTF16 | 双字节,表示大部分Unicode。 |
2890| TEXT_ENCODING_UTF32 | 四字节,表示所有Unicode。 |
2891| TEXT_ENCODING_GLYPH_ID | 双字节,表示字形索引。 |
2892
2893
2894### OH_Drawing_TextHeightBehavior
2895
2896```
2897enum OH_Drawing_TextHeightBehavior
2898```
2899
2900**描述**
2901
2902文本高度修饰符模式枚举。
2903
2904**起始版本:** 12
2905
2906| 枚举值 | 描述 |
2907| -------- | -------- |
2908| TEXT_HEIGHT_ALL | 段落中第一行顶部和段落中最后一行底部[OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight)设置的高度生效 |
2909| TEXT_HEIGHT_DISABLE_FIRST_ASCENT | 禁止段落中第一行顶部[OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight)设置的高度生效 |
2910| TEXT_HEIGHT_DISABLE_LAST_ASCENT | 禁止段落中最后一行底部[OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight)设置的高度生效 |
2911| TEXT_HEIGHT_DISABLE_ALL | 禁止段落中第一行顶部和段落中最后一行底部[OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight)设置的高度生效 |
2912
2913
2914### OH_Drawing_TextStyleType
2915
2916```
2917enum OH_Drawing_TextStyleType
2918```
2919
2920**描述**
2921
2922文本样式类型枚举。
2923
2924**起始版本:** 12
2925
2926| 枚举值 | 描述 |
2927| -------- | -------- |
2928| TEXT_STYLE_NONE | 无文本样式。 |
2929| TEXT_STYLE_ALL_ATTRIBUTES | 所有文本样式。 |
2930| TEXT_STYLE_FONT | 字体样式。 |
2931| TEXT_STYLE_FOREGROUND | 文本前景样式。 |
2932| TEXT_STYLE_BACKGROUND | 文本背景样式。 |
2933| TEXT_STYLE_SHADOW | 文本阴影样式。 |
2934| TEXT_STYLE_DECORATIONS | 文本装饰样式。 |
2935| TEXT_STYLE_LETTER_SPACING | 文本字符间距样式。 |
2936| TEXT_STYLE_WORD_SPACING | 文本单词间距样式。 |
2937
2938
2939### OH_Drawing_TileMode
2940
2941```
2942enum OH_Drawing_TileMode
2943```
2944
2945**描述**
2946
2947着色器效果平铺模式的枚举。
2948
2949**起始版本:** 11
2950
2951| 枚举值 | 描述 |
2952| -------- | -------- |
2953| CLAMP | 如果着色器效果超出其原始边界,则复制边缘颜色。 |
2954| REPEAT | 在水平和垂直方向上重复着色器效果图像。 |
2955| MIRROR | 水平和垂直重复着色器效果图像,交替镜像。 |
2956| DECAL | 只在原始区域内绘制,其他地方返回透明黑色。 |
2957
2958
2959### OH_Drawing_VertexMode
2960
2961```
2962enum OH_Drawing_VertexMode
2963```
2964
2965**描述**
2966
2967用于指定如何解释给定顶点的几何形状的枚举类型。
2968
2969**起始版本:** 12
2970
2971| 枚举值 | 描述 |
2972| -------- | -------- |
2973| VERTEX_MODE_TRIANGLES | 每三个顶点表示一个三角形,如果顶点数不是3的倍数,则多余的顶点会被忽略。 |
2974| VERTEX_MODE_TRIANGLESSTRIP | 相邻三个顶点表示一个三角形,每个新的顶点将与前两个顶点组成一个新的三角形。 |
2975| VERTEX_MODE_TRIANGLEFAN | 第一个顶点作为中心点,后续的每个顶点都与前一个顶点和中心点组成一个三角形。 |
2976
2977
2978### OH_Drawing_WordBreakType
2979
2980```
2981enum OH_Drawing_WordBreakType
2982```
2983
2984**描述**
2985
2986单词的断词方式枚举。
2987
2988**起始版本:** 11
2989
2990| 枚举值 | 描述 |
2991| -------- | -------- |
2992| WORD_BREAK_TYPE_NORMAL | 常规方式。 |
2993| WORD_BREAK_TYPE_BREAK_ALL | 全部中断方式。 |
2994| WORD_BREAK_TYPE_BREAK_WORD | 单词中断方式。 |
2995
2996
2997
2998## 函数说明
2999
3000### OH_Drawing_SurfaceCreateOnScreen()
3001
3002```
3003OH_Drawing_Surface* OH_Drawing_SurfaceCreateOnScreen (OH_Drawing_GpuContext* gpuContext, OH_Drawing_Image_Info imageInfo, void* window )
3004```
3005**描述**
3006
3007使用图形处理器上下文创建一个与屏幕窗口绑定的surface对象,用于管理画布绘制的内容。
3008
3009本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码的取值。 gpuContext或window为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
3010
3011**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3012
3013**起始版本:** 16
3014
3015**参数:**
3016
3017| 名称 | 描述 |
3018| -------- | -------- |
3019| gpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 该图形处理器上下文对象必须由[OH_Drawing_GpuContextCreate](#oh_drawing_gpucontextcreate)创建,否则surface对象会创建失败。  |
3020| imageInfo | 图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)结构体。  |
3021| window | 指向屏幕窗口对象的指针。  |
3022
3023**返回:**
3024
3025返回一个指针,指针指向创建的surface对象[OH_Drawing_Surface](#oh_drawing_surface)。
3026
3027### OH_Drawing_SurfaceFlush()
3028
3029```
3030OH_Drawing_ErrorCode OH_Drawing_SurfaceFlush (OH_Drawing_Surface* surface)
3031```
3032
3033**描述**
3034
3035将surface对象上的画布绘制内容提交给GPU处理,完成绘制内容上屏显示。
3036
3037**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3038
3039**起始版本:** 16
3040
3041**参数:**
3042
3043| 名称 | 描述 |
3044| -------- | -------- |
3045| surface | 指向创建的surface对象的指针[OH_Drawing_Surface](#oh_drawing_surface)。 该surface对象必须由[OH_Drawing_SurfaceCreateOnScreen](#oh_drawing_surfacecreateonscreen)创建,否则该接口调用将没有任何效果。  |
3046
3047**返回:**
3048
3049函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数surface为空。
3050
3051### OH_Drawing_GpuContextCreate()
3052
3053```
3054OH_Drawing_GpuContext* OH_Drawing_GpuContextCreate (void)
3055```
3056
3057**描述**
3058
3059用于创建一个图形处理器上下文对象, 使用的后端类型取决于运行设备。
3060
3061**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3062
3063**起始版本:** 16
3064
3065**返回:**
3066
3067返回一个指针,指针指向创建的图形处理器上下文对象[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。
3068
3069### OH_Drawing_FontSetThemeFontFollowed()
3070
3071```
3072OH_Drawing_ErrorCode OH_Drawing_FontSetThemeFontFollowed (OH_Drawing_Font* font, bool followed )
3073```
3074
3075**描述**
3076
3077设置字型中的字体是否跟随主题字体。设置跟随主题字体后,若系统启用主题字体并且字型未被设置字体,字型会使用该主题字体。
3078
3079**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3080
3081**起始版本:** 15
3082
3083**参数:**
3084
3085| 名称 | 描述 |
3086| -------- | -------- |
3087| font | 指示字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
3088| followed | 字型中的字体是否跟随主题字体,true表示跟随主题字体,false表示不跟随主题字体。 |
3089
3090**返回:**
3091
3092函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font为空。
3093
3094### OH_Drawing_FontIsThemeFontFollowed()
3095
3096```
3097OH_Drawing_ErrorCode OH_Drawing_FontIsThemeFontFollowed (const OH_Drawing_Font* font, bool* followed )
3098```
3099
3100**描述**
3101
3102获取字型中的字体是否跟随主题字体。默认不跟随主题字体。
3103
3104**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3105
3106**起始版本:** 15
3107
3108**参数:**
3109
3110| 名称 | 描述 |
3111| -------- | -------- |
3112| font | 指示字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
3113| followed | 返回字型中的字体是否跟随主题字体的结果,true表示跟随主题字体,false表示不跟随主题字体。作为出参使用。 |
3114
3115**返回:**
3116
3117函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font或者followed其中一个为空。
3118
3119### OH_Drawing_GetFontCollectionGlobalInstance()
3120
3121```
3122OH_Drawing_FontCollection* OH_Drawing_GetFontCollectionGlobalInstance (void )
3123```
3124**描述**
3125
3126获取全局字体集对象OH_Drawing_FontCollection,可感知主题字信息,禁止释放该对象。
3127
3128**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3129
3130**起始版本:** 14
3131
3132**返回:**
3133
3134指向全局字体集对象的指针。
3135
3136### OH_Drawing_GetDrawingArraySize()
3137
3138```
3139size_t OH_Drawing_GetDrawingArraySize (OH_Drawing_Array* drawingArray)
3140```
3141
3142**描述**
3143
3144获取传入类型为对象数组[OH_Drawing_Array](#oh_drawing_array)中的对象个数。
3145
3146**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3147
3148**起始版本:** 14
3149
3150**参数:**
3151
3152| 名称 | 描述 |
3153| -------- | -------- |
3154| drawingArray | 指向对象数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
3155
3156**返回:**
3157
3158数组中的对象个数。
3159
3160### OH_Drawing_DestroySystemFontFullNames()
3161
3162```
3163void OH_Drawing_DestroySystemFontFullNames (OH_Drawing_Array* )
3164```
3165
3166**描述**
3167
3168释放通过字体类型获取的对应字体的字体名称数组占用的内存。
3169
3170**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3171
3172**起始版本:** 14
3173
3174**参数:**
3175
3176| 名称 | 描述 |
3177| -------- | -------- |
3178| OH_Drawing_Array | 表示字体名称数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
3179
3180### OH_Drawing_GetSystemFontFullNameByIndex()
3181
3182```
3183const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex (OH_Drawing_Array* , size_t  )
3184```
3185
3186**描述**
3187
3188在字体名称数组中通过索引获取对应位置的字体名称。
3189
3190**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3191
3192**起始版本:** 14
3193
3194**参数:**
3195
3196| 名称 | 描述 |
3197| -------- | -------- |
3198| OH_Drawing_Array | 表示字体名称数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
3199| size_t | 数组的索引。 |
3200
3201**返回:**
3202
3203返回对应索引的字体名称[OH_Drawing_String](_o_h___drawing___string.md)的指针。
3204
3205### OH_Drawing_GetSystemFontFullNamesByType()
3206
3207```
3208OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType (OH_Drawing_SystemFontType )
3209```
3210
3211**描述**
3212
3213根据字体类型获取对应字体的字体名称数组。
3214
3215**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3216
3217**起始版本:** 14
3218
3219**参数:**
3220
3221| 名称 | 描述 |
3222| -------- | -------- |
3223| OH_Drawing_SystemFontType | 表示字体类型的枚举值[OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)。 |
3224
3225**返回:**
3226
3227返回对应字体类型的字体名称数组[OH_Drawing_Array](#oh_drawing_array)的指针。
3228
3229### OH_Drawing_GetFontDescriptorByFullName()
3230
3231```
3232OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName (const OH_Drawing_String* , OH_Drawing_SystemFontType  )
3233```
3234
3235**描述**
3236
3237根据字体名称和字体类型获取指定的字体描述符,支持系统字体、风格字体和用户已安装字体。 字体描述符是描述字体特征的一种数据结构,它包含了定义字体外观和属性的详细信息。
3238
3239**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3240
3241**起始版本:** 14
3242
3243**参数:**
3244
3245| 名称 | 描述 |
3246| -------- | -------- |
3247| [OH_Drawing_String](_o_h___drawing___string.md) | 表示指向字体名称字符串[OH_Drawing_String](_o_h___drawing___string.md)的指针。 |
3248| OH_Drawing_SystemFontType | 表示字体类型的枚举值[OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)。 |
3249
3250**返回:**
3251
3252指向字体描述符对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针。
3253
3254### OH_Drawing_TypefaceCreateFromFileWithArguments()
3255
3256```
3257OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFileWithArguments (const char* path, const OH_Drawing_FontArguments* fontArguments )
3258```
3259
3260**描述**
3261
3262从指定文件路径创建带有字型参数的字体对象。 如果字体对象不支持字型参数中描述的可变维度,此函数将会创建默认字型参数的字体对象。 在这种情况下,此函数将提供与[OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile)相同的功能。
3263
3264**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3265
3266**起始版本:** 13
3267
3268**参数:**
3269
3270| 名称 | 描述 |
3271| -------- | -------- |
3272| path | 指向字体对象所在文件路径的指针。 |
3273| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 |
3274
3275**返回:**
3276
3277函数返回一个指针,指针指向创建的字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 如果返回的对象指针为空,则表示字体对象创建失败。失败的原因可能为:没有可用的内存、 传入的文件路径对象指针或字型参数为空、传入的路径无效。
3278
3279
3280### OH_Drawing_TypefaceCreateFromCurrent()
3281
3282```
3283OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromCurrent (const OH_Drawing_Typeface* current, const OH_Drawing_FontArguments* fontArguments )
3284```
3285
3286**描述**
3287
3288通过已存在的字体对象创建带有字型参数的字体对象。
3289
3290**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3291
3292**起始版本:** 13
3293
3294**参数:**
3295
3296| 名称 | 描述 |
3297| -------- | -------- |
3298| current | 指向字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)的指针。 |
3299| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 |
3300
3301**返回:**
3302
3303函数返回一个指针,指针指向创建的字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 如果返回的对象指针为空,则表示字体对象创建失败。失败的原因可能为:没有可用的内存、 传入的文件路径对象指针或字型参数为空、传入的字体对象不支持字型参数对象中描述的可变维度。
3304
3305
3306### OH_Drawing_FontArgumentsAddVariation()
3307
3308```
3309OH_Drawing_ErrorCode OH_Drawing_FontArgumentsAddVariation (OH_Drawing_FontArguments* fontArguments, const char* axis, float value )
3310```
3311
3312**描述**
3313
3314给字型参数对象添加可变维度。
3315
3316**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3317
3318**起始版本:** 13
3319
3320**参数:**
3321
3322| 名称 | 描述 |
3323| -------- | -------- |
3324| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 |
3325| axis | 字型参数对象可变维度的标签,必须为4个ASCII字符。具体可支持的标签取决于加载的字体文件,如'wght'即为字重标签。 |
3326| value | 可变维度标签对应的取值。 |
3327
3328**返回:**
3329
3330函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数fontArguments或axis任意一个为NULL或者axis的长度不为4。
3331
3332
3333### OH_Drawing_FontArgumentsCreate()
3334
3335```
3336OH_Drawing_FontArguments* OH_Drawing_FontArgumentsCreate (void)
3337```
3338
3339**描述**
3340
3341用于创建一个字型参数对象。字型参数用于创建带有自定义属性的字体对象。
3342
3343**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3344
3345**起始版本:** 13
3346
3347**返回:**
3348
3349返回一个指针,指针指向创建的字型参数对象。
3350
3351
3352### OH_Drawing_FontArgumentsDestroy()
3353
3354```
3355OH_Drawing_ErrorCode OH_Drawing_FontArgumentsDestroy (OH_Drawing_FontArguments* fontArguments)
3356```
3357
3358**描述**
3359
3360用于销毁一个字型参数对象。
3361
3362**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3363
3364**起始版本:** 13
3365
3366**参数:**
3367
3368| 名称 | 描述 |
3369| -------- | -------- |
3370| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 |
3371
3372**返回:**
3373
3374函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数fontArguments为NULL。
3375
3376
3377### OH_Drawing_TypographyGetLongestLineWithIndent()
3378
3379```
3380double OH_Drawing_TypographyGetLongestLineWithIndent (OH_Drawing_Typography* )
3381```
3382
3383**描述**
3384
3385获取排版对象最长行的宽度(该宽度包含当前行缩进的宽度),该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。
3386
3387**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3388
3389**起始版本:** 13
3390
3391**参数:**
3392
3393| 名称 | 描述 |
3394| -------- | -------- |
3395| OH_Drawing_Typography | 指向[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
3396
3397**返回:**
3398
3399返回最长行的宽度(该宽度包含当前行缩进的宽度),单位:物理像素px。
3400
3401
3402
3403### OH_Drawing_RecordCmdDestroy()
3404
3405```
3406OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy (OH_Drawing_RecordCmd* recordCmd)
3407```
3408
3409**描述**
3410
3411销毁录制指令对象,并回收该对象占有的内存。
3412
3413**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3414
3415**起始版本:** 13
3416
3417**参数:**
3418
3419| 名称 | 描述 |
3420| -------- | -------- |
3421| recordCmd | 指向对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的指针。 |
3422
3423**返回:**
3424
3425函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmd为空。
3426
3427
3428### OH_Drawing_RecordCmdUtilsBeginRecording()
3429
3430```
3431OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, int32_t width, int32_t height, OH_Drawing_Canvas** canvas )
3432```
3433
3434**描述**
3435
3436开始录制。此接口需要与[OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording)接口成对使用。
3437
3438指令录制工具生成录制类型的画布对象,可调用drawing的绘制接口,记录接下来所有的绘制指令。
3439
3440**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3441
3442**起始版本:** 13
3443
3444**参数:**
3445
3446| 名称 | 描述 |
3447| -------- | -------- |
3448| recordCmdUtils | 指向录制工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 |
3449| width | 画布的宽度。 |
3450| height | 画布的高度。 |
3451| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的二级指针,作为出参,开发者无需释放。 该画布对象不支持嵌套调用[OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd)接口。 |
3452
3453**返回:**
3454
3455函数返回执行错误码。 返回OH_DRAWING_SUCCESS, 表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER, 表示参数recordCmdUtils或者canvas为空。 当width和height小于等于0的时,也会返回OH_DRAWING_ERROR_INVALID_PARAMETER。 返回OH_DRAWING_ERROR_ALLOCATION_FAILED,表示系统内存不足。
3456
3457
3458### OH_Drawing_RecordCmdUtilsCreate()
3459
3460```
3461OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate (void )
3462```
3463
3464**描述**
3465
3466创建一个录制指令工具对象。
3467
3468**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3469
3470**起始版本:** 13
3471
3472**返回:**
3473
3474返回用于录制指令的工具对象。
3475
3476
3477### OH_Drawing_RecordCmdUtilsDestroy()
3478
3479```
3480OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy (OH_Drawing_RecordCmdUtils* recordCmdUtils)
3481```
3482
3483**描述**
3484
3485销毁一个录制指令工具对象,并回收该对象占有的内存。
3486
3487**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3488
3489**起始版本:** 13
3490
3491**参数:**
3492
3493| 名称 | 描述 |
3494| -------- | -------- |
3495| recordCmdUtils | 指向录制指令工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 |
3496
3497**返回:**
3498
3499函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmdUtils为空。
3500
3501
3502### OH_Drawing_RecordCmdUtilsFinishRecording()
3503
3504```
3505OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, OH_Drawing_RecordCmd** recordCmd )
3506```
3507
3508**描述**
3509
3510结束录制。在调用此接口前,需要先调用[OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording)接口。
3511
3512指令录制工具结束录制指令,将录制类型画布对象记录的绘制指令存入生成的录制指令对象。
3513
3514**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3515
3516**起始版本:** 13
3517
3518**参数:**
3519
3520| 名称 | 描述 |
3521| -------- | -------- |
3522| recordCmdUtils | 指向录制指令工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 |
3523| recordCmd | 指向录制指令对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的二级指针,作为出参,开发者调用[OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd)接口绘制该对象。 需要调用[OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy)接口释放。 |
3524
3525**返回:**
3526
3527函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmdUtils或者recordCmd为空。 返回OH_DRAWING_ERROR_ALLOCATION_FAILED,表示系统内存不足。
3528
3529
3530### OH_Drawing_CanvasDrawRecordCmd()
3531
3532```
3533OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd (OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd )
3534```
3535
3536**描述**
3537
3538用于绘制录制指令对象。
3539
3540**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3541
3542**起始版本:** 13
3543
3544**参数:**
3545
3546| 名称 | 描述 |
3547| -------- | -------- |
3548| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针,仅支持录制类型画布。 |
3549| recordCmd | 指向录制指令对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的指针。 |
3550
3551**返回:**
3552
3553函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者recordCmd为空。
3554
3555
3556
3557### OH_Drawing_TypographyDestroyTextBox()
3558
3559```
3560void OH_Drawing_TypographyDestroyTextBox (OH_Drawing_TextBox* )
3561```
3562
3563**描述**
3564
3565释放文本框占用的内存。
3566
3567**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3568
3569**起始版本:** 12
3570
3571**参数:**
3572
3573| 名称 | 描述 |
3574| -------- | -------- |
3575| OH_Drawing_TextBox | 指向文本框对象[OH_Drawing_TextBox](#oh_drawing_textbox)的指针。 |
3576
3577
3578### OH_Drawing_SetTextShadow()
3579
3580```
3581void OH_Drawing_SetTextShadow (OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius )
3582```
3583
3584**描述**
3585
3586设置字体阴影对象的参数。
3587
3588**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3589
3590**起始版本:** 12
3591
3592**参数:**
3593
3594| 名称 | 描述 |
3595| -------- | -------- |
3596| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 |
3597| color | 字体阴影的颜色,例如入参为0xAABBCCDD,AA代表透明度,BB代表红色分量的值,CC代表绿色分量的值,DD代表蓝色分量的值。 |
3598| OH_Drawing_Point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针,字体阴影基于当前文本的偏移位置。 |
3599| blurRadius | 模糊半径,浮点数,没有单位,值为0.0时表示没有模糊效果。 |
3600
3601
3602
3603### OH_Drawing_CanvasDrawSingleCharacter()
3604
3605```
3606OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter (OH_Drawing_Canvas* canvas, const char* str, const OH_Drawing_Font* font, float x, float y )
3607```
3608
3609**描述**
3610
3611用于绘制单个字符。当前字型中的字体不支持待绘制字符时,退化到使用系统字体绘制字符。
3612
3613**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3614
3615**起始版本:** 12
3616
3617**参数:**
3618
3619| 名称 | 描述 |
3620| -------- | -------- |
3621| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
3622| str | 待绘制的单个字符。可以传入字符串,但只会以UTF-8编码解析并绘制字符串中的首个字符。 |
3623| font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
3624| x | 字符对象基线左端点(靠近字符左下角)的横坐标。 |
3625| y | 字符对象基线左端点(靠近字符左下角)的纵坐标。 |
3626
3627**返回:**
3628
3629函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas、str、font任意一个为NULL或者str的长度为0。
3630
3631
3632
3633### OH_Drawing_FontMeasureSingleCharacter()
3634
3635```
3636OH_Drawing_ErrorCode OH_Drawing_FontMeasureSingleCharacter (const OH_Drawing_Font* font, const char* str, float* textWidth )
3637```
3638
3639**描述**
3640
3641用于测量单个字符的宽度。当前字型中的字体不支持待测量字符时,退化到使用系统字体测量字符宽度。
3642
3643**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3644
3645**起始版本:** 12
3646
3647**参数:**
3648
3649| 名称 | 描述 |
3650| -------- | -------- |
3651| font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
3652| str | 待测量的单个字符。可以传入字符串,但只会以UTF-8编码解析并测量字符串中的首个字符。 |
3653| textWidth | 用于存储得到的字符宽度。 |
3654
3655**返回:**
3656
3657函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font、str、textWidth任意一个为NULL或者str的长度为0。
3658
3659
3660
3661### OH_Drawing_TypographyPaintOnPath()
3662
3663```
3664void OH_Drawing_TypographyPaintOnPath (OH_Drawing_Typography* , OH_Drawing_Canvas* , OH_Drawing_Path* , double , double  )
3665```
3666
3667**描述**
3668
3669沿路径绘制文本。
3670
3671**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3672
3673**起始版本:** 12
3674
3675**参数:**
3676
3677| 名称 | 描述 |
3678| -------- | -------- |
3679| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
3680| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针,由[OH_Drawing_CanvasCreate](#oh_drawing_canvascreate)获取。 |
3681| OH_Drawing_Path | 指向OH_Drawing_Path对象的指针,由[OH_Drawing_PathCreate](#oh_drawing_pathcreate)获取。 |
3682| double | 沿路径方向偏置,从路径起点向前为正,向后为负。 |
3683| double | 沿路径垂直方向偏置,沿路径方向左侧为负,右侧为正。 |
3684
3685
3686### OH_Drawing_RoundRectOffset()
3687
3688```
3689OH_Drawing_ErrorCode OH_Drawing_RoundRectOffset (OH_Drawing_RoundRect* roundRect, float dx, float dy )
3690```
3691
3692**描述**
3693
3694用于将圆角矩形沿x轴方向和y轴方向平移指定距离。
3695
3696**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3697
3698**起始版本:** 12
3699
3700**参数:**
3701
3702| 名称 | 描述 |
3703| -------- | -------- |
3704| roundRect | 指向圆角矩形对象[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)的指针。 |
3705| dx | x轴方向偏移量。 |
3706| dy | y轴方向偏移量。 |
3707
3708**返回:**
3709
3710函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数roundRect为空。
3711
3712
3713### OH_Drawing_PointGetX()
3714
3715```
3716OH_Drawing_ErrorCode OH_Drawing_PointGetX (const OH_Drawing_Point* point, float* x )
3717```
3718
3719**描述**
3720
3721用于获取点的x轴坐标。
3722
3723**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3724
3725**起始版本:** 12
3726
3727**参数:**
3728
3729| 名称 | 描述 |
3730| -------- | -------- |
3731| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 |
3732| x | 表示点的x轴坐标。 |
3733
3734**返回:**
3735
3736函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point或者x为空。
3737
3738
3739### OH_Drawing_PointGetY()
3740
3741```
3742OH_Drawing_ErrorCode OH_Drawing_PointGetY (const OH_Drawing_Point* point, float* y )
3743```
3744
3745**描述**
3746
3747用于获取点的y轴坐标。
3748
3749**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3750
3751**起始版本:** 12
3752
3753**参数:**
3754
3755| 名称 | 描述 |
3756| -------- | -------- |
3757| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 |
3758| y | 表示点的y轴坐标。 |
3759
3760**返回:**
3761
3762函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point或者y为空。
3763
3764
3765### OH_Drawing_PointSet()
3766
3767```
3768OH_Drawing_ErrorCode OH_Drawing_PointSet (OH_Drawing_Point* point, float x, float y )
3769```
3770
3771**描述**
3772
3773用于设置点的x轴和y轴坐标。
3774
3775**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3776
3777**起始版本:** 12
3778
3779**参数:**
3780
3781| 名称 | 描述 |
3782| -------- | -------- |
3783| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 |
3784| x | 表示点的x轴坐标。 |
3785| y | 表示点的y轴坐标。 |
3786
3787**返回:**
3788
3789函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point为空。
3790
3791
3792### OH_Drawing_FontMeasureText()
3793
3794```
3795OH_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 )
3796```
3797
3798**描述**
3799
3800用于获取文本的宽度和边界框。
3801
3802**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3803
3804**起始版本:** 12
3805
3806**参数:**
3807
3808| 名称 | 描述 |
3809| -------- | -------- |
3810| font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
3811| text | 指向文本的指针。 |
3812| byteLength | 表示以字节为单位的文本长度。 |
3813| encoding | 文本编码类型。 |
3814| bounds | 用于承载获取的边界框,可以为NULL。 |
3815| textWidth | 表示文本宽度。 |
3816
3817**返回:**
3818
3819函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font,text,textWidth至少有一个为空, 或者byteLength为0。
3820
3821
3822### OH_Drawing_CanvasClipRegion()
3823
3824```
3825OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion (OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region, OH_Drawing_CanvasClipOp clipOp )
3826```
3827
3828**描述**
3829
3830用于裁剪一个区域。
3831
3832**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3833
3834**起始版本:** 12
3835
3836**参数:**
3837
3838| 名称 | 描述 |
3839| -------- | -------- |
3840| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
3841| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
3842| clipOp | 表示裁剪类型。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 |
3843
3844**返回:**
3845
3846函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者region为空。返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示clipOp不在枚举范围内。
3847
3848
3849### OH_Drawing_CanvasDrawColor()
3850
3851```
3852OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor (OH_Drawing_Canvas* canvas, uint32_t color, OH_Drawing_BlendMode blendMode )
3853```
3854
3855**描述**
3856
3857用于使用指定的颜色及混合模式来填充整个画布。
3858
3859**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3860
3861**起始版本:** 12
3862
3863**参数:**
3864
3865| 名称 | 描述 |
3866| -------- | -------- |
3867| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
3868| color | 表示指定的颜色,用一个32位(ARGB)的变量表示。 |
3869| blendMode | 表示指定的混合模式。 |
3870
3871**返回:**
3872
3873函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas为空。返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示blendMode不在枚举范围内。
3874
3875
3876### OH_Drawing_CanvasGetImageInfo()
3877
3878```
3879OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo (OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo )
3880```
3881
3882**描述**
3883
3884用于获取画布的图像信息。
3885
3886**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3887
3888**起始版本:** 12
3889
3890**参数:**
3891
3892| 名称 | 描述 |
3893| -------- | -------- |
3894| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
3895| imageInfo | 指向图像信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
3896
3897**返回:**
3898
3899函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者imageInfo为空。
3900
3901
3902### OH_Drawing_CanvasIsClipEmpty()
3903
3904```
3905OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty (OH_Drawing_Canvas* canvas, bool* isClipEmpty )
3906```
3907
3908**描述**
3909
3910用于判断裁剪后可绘制区域是否为空。
3911
3912**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3913
3914**起始版本:** 12
3915
3916**参数:**
3917
3918| 名称 | 描述 |
3919| -------- | -------- |
3920| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
3921| isClipEmpty | 表示裁剪后可绘制区域是否为空。true表示为空,false表示不为空。 |
3922
3923**返回:**
3924
3925函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者isClipEmpty为空。
3926
3927
3928### OH_Drawing_CanvasDrawPoint()
3929
3930```
3931OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint (OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point )
3932```
3933
3934**描述**
3935
3936用于画一个点。
3937
3938**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3939
3940**起始版本:** 12
3941
3942**参数:**
3943
3944| 名称 | 描述 |
3945| -------- | -------- |
3946| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
3947| point | 指向点对象[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)的指针。 |
3948
3949**返回:**
3950
3951函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者point为空。
3952
3953
3954### OH_Drawing_MatrixGetAll()
3955
3956```
3957OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll (OH_Drawing_Matrix* matrix, float value[9] )
3958```
3959
3960**描述**
3961
3962获取矩阵所有元素值。
3963
3964**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3965
3966**起始版本:** 12
3967
3968**参数:**
3969
3970| 名称 | 描述 |
3971| -------- | -------- |
3972| matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
3973| value | 用于存储得到的矩阵元素值的数组。 |
3974
3975**返回:**
3976
3977返回错误码。 返回OH_DRAWING_SUCCESS,表示成功获取矩阵的所有元素值。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示获取矩阵元素值失败,原因是矩阵对象或者存储矩阵元素值数组为空。
3978
3979
3980
3981### OH_Drawing_ErrorCodeGet()
3982
3983```
3984OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet ()
3985```
3986
3987**描述**
3988
3989获取本模块的最近一次的错误码。当函数成功运行后,本函数返回的错误码不会被修改。
3990
3991**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3992
3993**起始版本:** 12
3994
3995**返回:**
3996
3997函数返回错误码枚举值。
3998
3999### OH_Drawing_BrushCopy()
4000
4001```
4002OH_Drawing_Brush* OH_Drawing_BrushCopy (OH_Drawing_Brush* brush)
4003```
4004
4005**描述**
4006
4007创建一个画刷对象副本[OH_Drawing_Brush](#oh_drawing_brush),用于拷贝一个已有画刷对象。
4008
4009本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4010
4011brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4012
4013**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4014
4015**起始版本:** 12
4016
4017**参数:**
4018
4019| 名称 | 描述 |
4020| -------- | -------- |
4021| brush | 指向画刷对象的指针。 |
4022
4023**返回:**
4024
4025函数会返回一个指针,指针指向创建的画刷对象副本[OH_Drawing_Brush](#oh_drawing_brush)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是brush为NULL。
4026
4027
4028
4029### OH_Drawing_FilterSetImageFilter()
4030
4031```
4032void OH_Drawing_FilterSetImageFilter (OH_Drawing_Filter* , OH_Drawing_ImageFilter* )
4033```
4034
4035**描述**
4036
4037为滤波器对象设置图像滤波器对象。
4038
4039本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4040
4041OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4042
4043**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4044
4045**起始版本:** 12
4046
4047**参数:**
4048
4049| 名称 | 描述 |
4050| -------- | -------- |
4051| OH_Drawing_Filter | 指示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 |
4052| OH_Drawing_ImageFilter | 指示指向图像滤波器[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)对象的指针,为NULL表示清空滤波器对象中的图像滤波器效果。 |
4053
4054
4055### OH_Drawing_ImageFilterCreateBlur()
4056
4057```
4058OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur (float sigmaX, float sigmaY, OH_Drawing_TileMode , OH_Drawing_ImageFilter* input )
4059```
4060
4061**描述**
4062
4063创建具有模糊效果的图像滤波器。
4064
4065**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4066
4067**起始版本:** 12
4068
4069**参数:**
4070
4071| 名称 | 描述 |
4072| -------- | -------- |
4073| sigmaX | 表示沿x轴方向上高斯模糊的标准差,必须大于0。 |
4074| sigmaY | 表示沿y轴方向上高斯模糊的标准差,必须大于0。 |
4075| OH_Drawing_TileMode | 图像滤波器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 |
4076| input | 表示将要和当前图像滤波器叠加的输入滤波器, 如果为NULL,表示直接将当前图像滤波器作用于原始图像。 |
4077
4078**返回:**
4079
4080函数会返回一个指针,指针指向创建的图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空。
4081
4082
4083### OH_Drawing_ImageFilterCreateFromColorFilter()
4084
4085```
4086OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter (OH_Drawing_ColorFilter* colorFilter, OH_Drawing_ImageFilter* input )
4087```
4088
4089**描述**
4090
4091创建具有颜色变换效果的图像滤波器。
4092
4093本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4094
4095colorFilter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4096
4097**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4098
4099**起始版本:** 12
4100
4101**参数:**
4102
4103| 名称 | 描述 |
4104| -------- | -------- |
4105| colorFilter | 指向具有颜色变换效果的颜色滤波器对象[OH_Drawing_ColorFilter](#oh_drawing_colorfilter)。 |
4106| input | 表示将要和当前图像滤波器叠加的输入滤波器, 如果为NULL,表示直接将当前图像滤波器作用于原始图像。 |
4107
4108**返回:**
4109
4110函数会返回一个指针,指针指向创建的图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是colorFilter为NULL。
4111
4112
4113### OH_Drawing_ImageFilterDestroy()
4114
4115```
4116void OH_Drawing_ImageFilterDestroy (OH_Drawing_ImageFilter* )
4117```
4118
4119**描述**
4120
4121销毁图像滤波器对象并回收该对象占有内存。
4122
4123**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4124
4125**起始版本:** 12
4126
4127**参数:**
4128
4129| 名称 | 描述 |
4130| -------- | -------- |
4131| OH_Drawing_ImageFilter | 指向图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)的指针。 |
4132
4133
4134### OH_Drawing_MatrixMapPoints()
4135
4136```
4137void OH_Drawing_MatrixMapPoints (const OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, OH_Drawing_Point2D* dst, int count )
4138```
4139
4140**描述**
4141
4142通过矩阵变换将源点数组映射到目标点数组。
4143
4144本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4145
4146OH_Drawing_Matrix、src、dst任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4147
4148**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4149
4150**起始版本:** 12
4151
4152**参数:**
4153
4154| 名称 | 描述 |
4155| -------- | -------- |
4156| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
4157| src | 源点数组。 |
4158| dst | 目标点数组,个数要与源点相等。 |
4159| count | 源点数组以及目标点数组的个数。 |
4160
4161
4162### OH_Drawing_MatrixMapRect()
4163
4164```
4165bool OH_Drawing_MatrixMapRect (const OH_Drawing_Matrix* , const OH_Drawing_Rect* src, OH_Drawing_Rect* dst )
4166```
4167
4168**描述**
4169
4170将目标矩形设置为一个新的矩形,该矩形是能够包围源矩形的四个顶点通过矩阵变换映射后形成的新顶点的最小矩形。
4171
4172本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4173
4174OH_Drawing_Matrix、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4175
4176**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4177
4178**起始版本:** 12
4179
4180**参数:**
4181
4182| 名称 | 描述 |
4183| -------- | -------- |
4184| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
4185| src | 源矩形。 |
4186| dst | 目标矩形。 |
4187
4188**返回:**
4189
4190函数返回源矩形与映射后的目标矩形是否相等。true表示相等,false表示不相等。
4191
4192
4193### OH_Drawing_PathAddPolygon()
4194
4195```
4196void OH_Drawing_PathAddPolygon (OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed )
4197```
4198
4199**描述**
4200
4201向路径添加多边形。
4202
4203本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4204
4205path、points任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4206
4207**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4208
4209**起始版本:** 12
4210
4211**参数:**
4212
4213| 名称 | 描述 |
4214| -------- | -------- |
4215| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4216| points | 表示多边形的顶点坐标数组。 |
4217| count | 表示多边形顶点坐标数组的大小。 |
4218| isClosed | 是否添加连接起始点和终止点的线,true表示添加,false表示不添加。 |
4219
4220
4221### OH_Drawing_PathAddCircle()
4222
4223```
4224void OH_Drawing_PathAddCircle (OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection  )
4225```
4226
4227**描述**
4228
4229按指定方向,向路径添加圆形。
4230
4231本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4232
4233path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
4234
4235radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE;
4236
4237OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
4238
4239**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4240
4241**起始版本:** 12
4242
4243**参数:**
4244
4245| 名称 | 描述 |
4246| -------- | -------- |
4247| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4248| x | 表示圆心的x轴坐标。 |
4249| y | 表示圆心的y轴坐标。 |
4250| radius | 表示圆形的半径。 |
4251| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
4252
4253
4254### OH_Drawing_PathBuildFromSvgString()
4255
4256```
4257bool OH_Drawing_PathBuildFromSvgString (OH_Drawing_Path* path, const char* str )
4258```
4259
4260**描述**
4261
4262解析SVG字符串表示的路径。
4263
4264本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4265
4266path、str任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4267
4268**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4269
4270**起始版本:** 12
4271
4272**参数:**
4273
4274| 名称 | 描述 |
4275| -------- | -------- |
4276| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4277| str | 表示SVG字符串。 |
4278
4279**返回:**
4280
4281函数返回解析SVG字符串是否成功。true表示成功,false表示不成功。
4282
4283
4284### OH_Drawing_PathGetBounds()
4285
4286```
4287void OH_Drawing_PathGetBounds (OH_Drawing_Path* , OH_Drawing_Rect*  )
4288```
4289
4290**描述**
4291
4292获取包含路径的最小边界框。
4293
4294本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4295
4296OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4297
4298**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4299
4300**起始版本:** 12
4301
4302**参数:**
4303
4304| 名称 | 描述 |
4305| -------- | -------- |
4306| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4307| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
4308
4309
4310### OH_Drawing_PathIsClosed()
4311
4312```
4313bool OH_Drawing_PathIsClosed (OH_Drawing_Path* path, bool forceClosed )
4314```
4315
4316**描述**
4317
4318获取路径是否闭合。
4319
4320本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4321
4322path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4323
4324**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4325
4326**起始版本:** 12
4327
4328**参数:**
4329
4330| 名称 | 描述 |
4331| -------- | -------- |
4332| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4333| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
4334
4335**返回:**
4336
4337返回路径是否闭合。true表示路径的测量结果为已闭合,false表示路径的测量结果为未闭合。
4338
4339
4340### OH_Drawing_PathGetPositionTangent()
4341
4342```
4343bool OH_Drawing_PathGetPositionTangent (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent )
4344```
4345
4346**描述**
4347
4348获取距路径起始点指定距离的坐标点和切线值。
4349
4350本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4351
4352path、position、tangent任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4353
4354**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4355
4356**起始版本:** 12
4357
4358**参数:**
4359
4360| 名称 | 描述 |
4361| -------- | -------- |
4362| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4363| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
4364| distance | 表示距离起始点的距离,小于0时会被视作0,大于路径长度时会被视作路径长度。 |
4365| position | 表示距路径起始点指定距离的坐标点。 |
4366| tangent | 表示距路径起始点指定距离的切线值,tangent.x表示该点切线的余弦值,tangent.y表示该点切线的正弦值。 |
4367
4368**返回:**
4369
4370返回测量是否成功。true表示成功,false表示失败。
4371
4372
4373### OH_Drawing_PathOp()
4374
4375```
4376bool OH_Drawing_PathOp (OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op )
4377```
4378
4379**描述**
4380
4381将两个路径按照指定的路径操作类型合并。
4382
4383本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4384
4385path、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
4386
4387op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
4388
4389**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4390
4391**起始版本:** 12
4392
4393**参数:**
4394
4395| 名称 | 描述 |
4396| -------- | -------- |
4397| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,操作完成后的路径结果将会保存在此路径对象中。 |
4398| other | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4399| op | 路径操作枚举类型,支持可选的具体模式可见[OH_Drawing_PathOpMode](#oh_drawing_pathopmode)枚举。 |
4400
4401**返回:**
4402
4403返回操作后的路径是否为空。true表示路径不为空,false表示路径为空。
4404
4405
4406### OH_Drawing_PathGetMatrix()
4407
4408```
4409bool OH_Drawing_PathGetMatrix (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag )
4410```
4411
4412**描述**
4413
4414获取距路径起始点指定距离的相应变换矩阵。
4415
4416本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4417
4418path、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
4419
4420flag不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
4421
4422**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4423
4424**起始版本:** 12
4425
4426**参数:**
4427
4428| 名称 | 描述 |
4429| -------- | -------- |
4430| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4431| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
4432| distance | 表示距离起始点的距离,小于0时会被视作0,大于路径长度时会被视作路径长度。 |
4433| matrix | 表示要获取的变换矩阵。 |
4434| flag | 矩阵信息维度枚举,支持可选的具体模式可见[OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags)枚举。 |
4435
4436**返回:**
4437
4438返回获取变换矩阵是否成功。true表示获取成功,false表示获取失败,失败的原因可能是path为NULL或者长度为0。
4439
4440
4441### OH_Drawing_PenGetFillPath()
4442
4443```
4444bool OH_Drawing_PenGetFillPath (OH_Drawing_Pen* , const OH_Drawing_Path* src, OH_Drawing_Path* dst, const OH_Drawing_Rect* , const OH_Drawing_Matrix*  )
4445```
4446
4447**描述**
4448
4449获取使用画笔绘制的源路径轮廓,并用目标路径表示。
4450
4451本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4452
4453OH_Drawing_Pen、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4454
4455**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4456
4457**起始版本:** 12
4458
4459**参数:**
4460
4461| 名称 | 描述 |
4462| -------- | -------- |
4463| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
4464| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4465| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4466| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,推荐使用NULL。 |
4467| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,推荐使用NULL, 默认是一个单位矩阵。 |
4468
4469**返回:**
4470
4471获取目标路径是否成功。true表示获取成功,false表示获取失败。
4472
4473
4474### OH_Drawing_PenCopy()
4475
4476```
4477OH_Drawing_Pen* OH_Drawing_PenCopy (OH_Drawing_Pen* pen)
4478```
4479
4480**描述**
4481
4482创建一个画笔对象副本[OH_Drawing_Pen](#oh_drawing_pen),用于拷贝一个已有画笔对象。
4483
4484本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4485
4486pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4487
4488**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4489
4490**起始版本:** 12
4491
4492**参数:**
4493
4494| 名称 | 描述 |
4495| -------- | -------- |
4496| pen | 指向画笔对象的指针。 |
4497
4498**返回:**
4499
4500函数会返回一个指针,指针指向创建的画笔对象副本[OH_Drawing_Pen](#oh_drawing_pen)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是pen为NULL。
4501
4502
4503### OH_Drawing_PixelMapGetFromNativePixelMap()
4504
4505```
4506OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap (NativePixelMap_* )
4507```
4508
4509**描述**
4510
4511从图像框架定义的像素图对象中获取本模块定义的像素图对象。
4512
4513**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4514
4515**起始版本:** 12
4516
4517**参数:**
4518
4519| 名称 | 描述 |
4520| -------- | -------- |
4521| NativePixelMap_ | 指向图像框架定义的像素图对象**NativePixelMap_**的指针。 |
4522
4523**返回:**
4524
4525函数会返回一个指向本模块定义的像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。如果对象返回NULL,表示创建失败; 可能的原因是NativePixelMap_为NULL。
4526
4527
4528### OH_Drawing_PixelMapGetFromOhPixelMapNative()
4529
4530```
4531OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative (OH_PixelmapNative* )
4532```
4533
4534**描述**
4535
4536从图像框架定义的像素图对象中获取本模块定义的像素图对象。
4537
4538**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4539
4540**起始版本:** 12
4541
4542**参数:**
4543
4544| 名称 | 描述 |
4545| -------- | -------- |
4546| OH_PixelmapNative | 指向图像框架定义的像素图对象**OH_PixelmapNative**的指针。 |
4547
4548**返回:**
4549
4550函数会返回一个指向本模块定义的像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。如果对象返回NULL,表示创建失败; 可能的原因是OH_PixelmapNative为NULL。
4551
4552
4553### OH_Drawing_PixelMapDissolve()
4554
4555```
4556void OH_Drawing_PixelMapDissolve (OH_Drawing_PixelMap* )
4557```
4558
4559**描述**
4560
4561解除本模块定义的像素图对象和图像框架定义的像素图对象之间的关系,该关系通过调用 [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap)或[OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative)建立。
4562
4563**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4564
4565**起始版本:** 12
4566
4567**参数:**
4568
4569| 名称 | 描述 |
4570| -------- | -------- |
4571| OH_Drawing_PixelMap | 指向像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。 |
4572
4573
4574### OH_Drawing_RectJoin()
4575
4576```
4577bool OH_Drawing_RectJoin (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other )
4578```
4579
4580**描述**
4581
4582将两个矩形取并集。
4583
4584本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4585
4586rect、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4587
4588**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4589
4590**起始版本:** 12
4591
4592**参数:**
4593
4594| 名称 | 描述 |
4595| -------- | -------- |
4596| rect | 指向矩形对象的指针。 |
4597| other | 指向矩形对象的指针。 |
4598
4599**返回:**
4600
4601返回两个矩形取并集的结果。true表示成功,false表示失败,失败的原因可能是两个矩形至少有一个为NULL或者other矩形大小为空。
4602
4603
4604### OH_Drawing_RegionContains()
4605
4606```
4607bool OH_Drawing_RegionContains (OH_Drawing_Region* region, int32_t x, int32_t y )
4608```
4609
4610**描述**
4611
4612判断区域是否包含指定坐标点。
4613
4614本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4615
4616region为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4617
4618**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4619
4620**起始版本:** 12
4621
4622**参数:**
4623
4624| 名称 | 描述 |
4625| -------- | -------- |
4626| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
4627| int32_t | 表示指定坐标点的x轴坐标。 |
4628| int32_t | 表示指定坐标点的y轴坐标。 |
4629
4630**返回:**
4631
4632返回区域是否包含指定坐标点。true表示区域包含该坐标点,false表示区域不包含该坐标点。
4633
4634
4635### OH_Drawing_RegionOp()
4636
4637```
4638bool OH_Drawing_RegionOp (OH_Drawing_Region* region, const OH_Drawing_Region* other, OH_Drawing_RegionOpMode op )
4639```
4640
4641**描述**
4642
4643将两个区域按照指定的区域操作类型合并。
4644
4645本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4646
4647region、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
4648
4649op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
4650
4651**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4652
4653**起始版本:** 12
4654
4655**参数:**
4656
4657| 名称 | 描述 |
4658| -------- | -------- |
4659| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针,操作完成后的区域结果将会保存在此区域对象中。 |
4660| other | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
4661| op | 区域操作枚举类型,支持可选的具体模式可见[OH_Drawing_RegionOpMode](#oh_drawing_regionopmode)枚举。 |
4662
4663**返回:**
4664
4665返回操作后的区域是否为空。true表示区域不为空,false表示区域为空。
4666
4667
4668### OH_Drawing_RegionSetPath()
4669
4670```
4671bool OH_Drawing_RegionSetPath (OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip )
4672```
4673
4674**描述**
4675
4676给区域对象设置为指定区域内路径表示的范围。
4677
4678本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4679
4680region、path、clip任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4681
4682**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4683
4684**起始版本:** 12
4685
4686**参数:**
4687
4688| 名称 | 描述 |
4689| -------- | -------- |
4690| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
4691| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
4692| clip | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
4693
4694**返回:**
4695
4696返回操作后的区域是否为空。true表示区域不为空,false表示区域为空。
4697
4698
4699### OH_Drawing_ShaderEffectCreateColorShader()
4700
4701```
4702OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader (const uint32_t color)
4703```
4704
4705**描述**
4706
4707创建具有单一颜色的着色器。
4708
4709**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4710
4711**起始版本:** 12
4712
4713**参数:**
4714
4715| 名称 | 描述 |
4716| -------- | -------- |
4717| color | 表示着色器的ARGB格式颜色,该参数为32位无符号整数。|
4718
4719**返回:**
4720
4721函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空。
4722
4723
4724### OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix()
4725
4726```
4727OH_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*  )
4728```
4729
4730**描述**
4731
4732创建着色器,在两个指定点之间生成线性渐变。
4733
4734本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4735
4736startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4737
4738OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
4739
4740**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4741
4742**起始版本:** 12
4743
4744**参数:**
4745
4746| 名称 | 描述 |
4747| -------- | -------- |
4748| startPt | 表示渐变的起点。 |
4749| endPt | 表示渐变的终点。 |
4750| colors | 表示在两个点之间分布的颜色。 |
4751| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在起点和终点之间。 |
4752| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
4753| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 |
4754| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 |
4755
4756**返回:**
4757
4758函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是startPt、endPt、colors至少一个为NULL。
4759
4760
4761### OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix()
4762
4763```
4764OH_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*  )
4765```
4766
4767**描述**
4768
4769创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。
4770
4771本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4772
4773centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4774
4775OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
4776
4777**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4778
4779**起始版本:** 12
4780
4781**参数:**
4782
4783| 名称 | 描述 |
4784| -------- | -------- |
4785| centerPt | 表示渐变的圆心。 |
4786| radius | 表示渐变的半径。 |
4787| colors | 表示在径向上分布的颜色。 |
4788| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在径向上。 |
4789| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
4790| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 |
4791| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 |
4792
4793**返回:**
4794
4795函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是centerPt、colors至少一个为NULL。
4796
4797
4798### OH_Drawing_ShaderEffectCreateTwoPointConicalGradient()
4799
4800```
4801OH_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*  )
4802```
4803
4804**描述**
4805
4806创建着色器,在给定两个圆之间生成渐变。
4807
4808本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4809
4810startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4811
4812OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
4813
4814**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4815
4816**起始版本:** 12
4817
4818**参数:**
4819
4820| 名称 | 描述 |
4821| -------- | -------- |
4822| startPt | 表示渐变的起点圆心。 |
4823| startRadius | 表示渐变的起点半径,需为非负数。 |
4824| endPt | 表示渐变的终点圆心。 |
4825| endRadius | 表示渐变的终点半径,需为非负数。 |
4826| colors | 表示在两个圆之间分布的颜色。 |
4827| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在两个圆之间。 |
4828| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
4829| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
4830| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 |
4831
4832**返回:**
4833
4834函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是startPt、endPt、colors至少一个为NULL。
4835
4836
4837
4838### OH_Drawing_TextBlobUniqueID()
4839
4840```
4841uint32_t OH_Drawing_TextBlobUniqueID (const OH_Drawing_TextBlob* )
4842```
4843
4844**描述**
4845
4846获取文本的标识符,该标识符是唯一的非零值。
4847
4848本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4849
4850OH_Drawing_TextBlob为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4851
4852**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4853
4854**起始版本:** 12
4855
4856**参数:**
4857
4858| 名称 | 描述 |
4859| -------- | -------- |
4860| OH_Drawing_TextBlob | 指向文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)的指针。 |
4861
4862**返回:**
4863
4864返回文本对象的标识符。
4865
4866
4867### OH_Drawing_PenSetShadowLayer()
4868
4869```
4870void OH_Drawing_PenSetShadowLayer (OH_Drawing_Pen* , OH_Drawing_ShadowLayer* )
4871```
4872
4873**描述**
4874
4875设置画笔阴影层效果,设置的阴影层效果当前仅在绘制文字时生效。
4876
4877本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4878
4879OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4880
4881**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4882
4883**起始版本:** 12
4884
4885**参数:**
4886
4887| 名称 | 描述 |
4888| -------- | -------- |
4889| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
4890| OH_Drawing_ShadowLayer | 指向阴影层对象[OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer)的指针,为NULL表示清空阴影层效果。 |
4891
4892
4893### OH_Drawing_BrushSetShadowLayer()
4894
4895```
4896void OH_Drawing_BrushSetShadowLayer (OH_Drawing_Brush* , OH_Drawing_ShadowLayer* )
4897```
4898
4899**描述**
4900
4901为画刷设置阴影层,设置的阴影层效果当前仅在绘制文字时生效。
4902
4903本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4904
4905OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4906
4907**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4908
4909**起始版本:** 12
4910
4911**参数:**
4912
4913| 名称 | 描述 |
4914| -------- | -------- |
4915| OH_Drawing_Brush | 指向画刷对象的指针。 |
4916| OH_Drawing_ShadowLayer | 表示指向阴影层的指针,为NULL表示清空画刷的阴影层效果。 |
4917
4918
4919### OH_Drawing_ShadowLayerCreate()
4920
4921```
4922OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate (float blurRadius, float x, float y, uint32_t color )
4923```
4924
4925**描述**
4926
4927创建一个阴影层对象。
4928
4929本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4930
4931blurRadius小于0等于时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
4932
4933**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4934
4935**起始版本:** 12
4936
4937**参数:**
4938
4939| 名称 | 描述 |
4940| -------- | -------- |
4941| blurRadius | 表示阴影的半径,必须大于零。 |
4942| x | 表示x轴上的偏移点。 |
4943| y | 表示y轴上的偏移点。 |
4944| color | 表示阴影的颜色。 |
4945
4946**返回:**
4947
4948返回创建的阴影层对象的指针。
4949
4950
4951### OH_Drawing_ShadowLayerDestroy()
4952
4953```
4954void OH_Drawing_ShadowLayerDestroy (OH_Drawing_ShadowLayer* )
4955```
4956
4957**描述**
4958
4959销毁阴影层对象,并收回该对象占用的内存。
4960
4961**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4962
4963**起始版本:** 12
4964
4965**参数:**
4966
4967| 名称 | 描述 |
4968| -------- | -------- |
4969| OH_Drawing_ShadowLayer | 表示指向阴影层对象的指针。 |
4970
4971
4972### OH_Drawing_FontSetBaselineSnap()
4973
4974```
4975void OH_Drawing_FontSetBaselineSnap (OH_Drawing_Font* , bool baselineSnap )
4976```
4977
4978**描述**
4979
4980当前画布矩阵轴对齐时,将字型基线设置为是否与像素对齐。
4981
4982本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
4983
4984OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
4985
4986**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4987
4988**起始版本:** 12
4989
4990**参数:**
4991
4992| 名称 | 描述 |
4993| -------- | -------- |
4994| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
4995| baselineSnap | 指示字型基线是否和像素对齐,true表示对齐,false表示不对齐。 |
4996
4997
4998### OH_Drawing_FontIsBaselineSnap()
4999
5000```
5001bool OH_Drawing_FontIsBaselineSnap (const OH_Drawing_Font* )
5002```
5003
5004**描述**
5005
5006当前画布矩阵轴对齐时,获取字型基线是否与像素对齐。
5007
5008本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5009
5010OH_Drawing_Font为NULL时返回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
5022**返回:**
5023
5024返回字型基线是否与像素对齐,true为对齐,false为没有对齐。
5025
5026
5027### OH_Drawing_FontSetEdging()
5028
5029```
5030void OH_Drawing_FontSetEdging (OH_Drawing_Font* , OH_Drawing_FontEdging  )
5031```
5032
5033**描述**
5034
5035用于设置字型边缘效果。
5036
5037本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5038
5039OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
5040
5041OH_Drawing_FontEdging不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
5042
5043**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5044
5045**起始版本:** 12
5046
5047**参数:**
5048
5049| 名称 | 描述 |
5050| -------- | -------- |
5051| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5052| OH_Drawing_FontEdging | 字型边缘效果。 |
5053
5054
5055### OH_Drawing_FontGetEdging()
5056
5057```
5058OH_Drawing_FontEdging OH_Drawing_FontGetEdging (const OH_Drawing_Font* )
5059```
5060
5061**描述**
5062
5063获取字型边缘效果。
5064
5065本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5066
5067OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5068
5069**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5070
5071**起始版本:** 12
5072
5073**参数:**
5074
5075| 名称 | 描述 |
5076| -------- | -------- |
5077| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5078
5079**返回:**
5080
5081返回字型边缘效果。
5082
5083
5084
5085### OH_Drawing_FontSetForceAutoHinting()
5086
5087```
5088void OH_Drawing_FontSetForceAutoHinting (OH_Drawing_Font* , bool isForceAutoHinting )
5089```
5090
5091**描述**
5092
5093用于设置是否自动调整字型轮廓。
5094
5095本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5096
5097OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5098
5099**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5100
5101**起始版本:** 12
5102
5103**参数:**
5104
5105| 名称 | 描述 |
5106| -------- | -------- |
5107| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5108| isForceAutoHinting | 是否自动调整字型轮廓,true为自动调整,false为不自动调整。 |
5109
5110
5111### OH_Drawing_FontIsForceAutoHinting()
5112
5113```
5114bool OH_Drawing_FontIsForceAutoHinting (const OH_Drawing_Font* )
5115```
5116
5117**描述**
5118
5119获取字型轮廓是否自动调整。
5120
5121本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5122
5123OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5124
5125**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5126
5127**起始版本:** 12
5128
5129**参数:**
5130
5131| 名称 | 描述 |
5132| -------- | -------- |
5133| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5134
5135**返回:**
5136
5137返回字型轮廓是否自动调整,true为自动调整,false为不自动调整。
5138
5139
5140### OH_Drawing_FontSetSubpixel()
5141
5142```
5143void OH_Drawing_FontSetSubpixel (OH_Drawing_Font* , bool isSubpixel )
5144```
5145
5146**描述**
5147
5148设置字型是否使用次像素渲染。
5149
5150本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5151
5152OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5153
5154**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5155
5156**起始版本:** 12
5157
5158**参数:**
5159
5160| 名称 | 描述 |
5161| -------- | -------- |
5162| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5163| isSubpixel | 字型是否使用次像素渲染,true为使用,false为不使用。 |
5164
5165
5166### OH_Drawing_FontIsSubpixel()
5167
5168```
5169bool OH_Drawing_FontIsSubpixel (const OH_Drawing_Font* )
5170```
5171
5172**描述**
5173
5174获取字型是否使用次像素渲染。
5175
5176本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5177
5178OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5179
5180**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5181
5182**起始版本:** 12
5183
5184**参数:**
5185
5186| 名称 | 描述 |
5187| -------- | -------- |
5188| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5189
5190**返回:**
5191
5192返回字型是否使用次像素渲染,true为使用,false为不使用。
5193
5194
5195### OH_Drawing_FontGetTextSize()
5196
5197```
5198float OH_Drawing_FontGetTextSize (const OH_Drawing_Font* )
5199```
5200
5201**描述**
5202
5203获取字型文字大小。
5204
5205本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5206
5207OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5208
5209**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5210
5211**起始版本:** 12
5212
5213**参数:**
5214
5215| 名称 | 描述 |
5216| -------- | -------- |
5217| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5218
5219**返回:**
5220
5221返回一个浮点数,表示字型文字大小。
5222
5223
5224### OH_Drawing_FontTextToGlyphs()
5225
5226```
5227uint32_t OH_Drawing_FontTextToGlyphs (const OH_Drawing_Font* , const void* text, uint32_t byteLength, OH_Drawing_TextEncoding encoding, uint16_t* glyphs, int maxGlyphCount )
5228```
5229
5230**描述**
5231
5232用于将文本转换为字形索引。
5233
5234本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5235
5236OH_Drawing_Font、text、glyphs任意一个为NULL或者byteLength等于0或者maxGlyphCount小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5237
5238**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5239
5240**起始版本:** 12
5241
5242**参数:**
5243
5244| 名称 | 描述 |
5245| -------- | -------- |
5246| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5247| text | 文本存储首地址。 |
5248| byteLength | 文本长度,单位为字节。 |
5249| encoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 |
5250| glyphs | 字形索引存储首地址,用于存储得到的字形索引。 |
5251| maxGlyphCount | 文本所表示的最大字符数量。 |
5252
5253**返回:**
5254
5255返回字形索引数量。
5256
5257
5258### OH_Drawing_FontGetWidths()
5259
5260```
5261void OH_Drawing_FontGetWidths (const OH_Drawing_Font* , const uint16_t* glyphs, int count, float* widths )
5262```
5263
5264**描述**
5265
5266用于获取字符串中每个字符的宽度。
5267
5268本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5269
5270OH_Drawing_Font、glyphs、widths任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5271
5272**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5273
5274**起始版本:** 12
5275
5276**参数:**
5277
5278| 名称 | 描述 |
5279| -------- | -------- |
5280| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5281| glyphs | 字形索引存储首地址。 |
5282| count | 字形索引的数量。 |
5283| widths | 字形宽度存储首地址,用于存储得到的字形宽度。 |
5284
5285
5286### OH_Drawing_FontIsLinearText()
5287
5288```
5289bool OH_Drawing_FontIsLinearText (const OH_Drawing_Font* )
5290```
5291
5292**描述**
5293
5294获取字型是否使用线性缩放。
5295
5296本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5297
5298OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5299
5300**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5301
5302**起始版本:** 12
5303
5304**参数:**
5305
5306| 名称 | 描述 |
5307| -------- | -------- |
5308| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5309
5310**返回:**
5311
5312返回字型是否使用线性缩放,true为使用,false为不使用。
5313
5314
5315### OH_Drawing_FontGetTextSkewX()
5316
5317```
5318float OH_Drawing_FontGetTextSkewX (const OH_Drawing_Font* )
5319```
5320
5321**描述**
5322
5323获取字型文本在x轴上的倾斜度。
5324
5325本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5326
5327OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5328
5329**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5330
5331**起始版本:** 12
5332
5333**参数:**
5334
5335| 名称 | 描述 |
5336| -------- | -------- |
5337| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5338
5339**返回:**
5340
5341返回一个浮点数,表示x轴上的文本倾斜度。
5342
5343
5344### OH_Drawing_FontIsFakeBoldText()
5345
5346```
5347bool OH_Drawing_FontIsFakeBoldText (const OH_Drawing_Font* )
5348```
5349
5350**描述**
5351
5352获取是否增加笔画宽度以接近粗体字体。
5353
5354本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5355
5356OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5357
5358**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5359
5360**起始版本:** 12
5361
5362**参数:**
5363
5364| 名称 | 描述 |
5365| -------- | -------- |
5366| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5367
5368**返回:**
5369
5370返回是否增加笔画宽度以接近粗体字体,true为增加,false为不增加。
5371
5372
5373### OH_Drawing_FontSetScaleX()
5374
5375```
5376void OH_Drawing_FontSetScaleX (OH_Drawing_Font* , float scaleX )
5377```
5378
5379**描述**
5380
5381用于设置字型对象在x轴上的缩放比例。
5382
5383本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5384
5385OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5386
5387**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5388
5389**起始版本:** 12
5390
5391**参数:**
5392
5393| 名称 | 描述 |
5394| -------- | -------- |
5395| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5396| scaleX | 文本在x轴上的缩放比例。 |
5397
5398
5399### OH_Drawing_FontGetScaleX()
5400
5401```
5402float OH_Drawing_FontGetScaleX (const OH_Drawing_Font* )
5403```
5404
5405**描述**
5406
5407获取字型对象在x轴上的缩放比例。
5408
5409本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5410
5411OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5412
5413**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5414
5415**起始版本:** 12
5416
5417**参数:**
5418
5419| 名称 | 描述 |
5420| -------- | -------- |
5421| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5422
5423**返回:**
5424
5425返回文本在x轴上的缩放比例。
5426
5427
5428### OH_Drawing_FontSetHinting()
5429
5430```
5431void OH_Drawing_FontSetHinting (OH_Drawing_Font* , OH_Drawing_FontHinting  )
5432```
5433
5434**描述**
5435
5436用于设置字型轮廓效果。
5437
5438本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5439
5440OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
5441
5442OH_Drawing_FontHinting不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
5443
5444**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5445
5446**起始版本:** 12
5447
5448**参数:**
5449
5450| 名称 | 描述 |
5451| -------- | -------- |
5452| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5453| OH_Drawing_FontHinting | 字型轮廓枚举类型[OH_Drawing_FontHinting](#oh_drawing_fonthinting)。 |
5454
5455
5456### OH_Drawing_FontGetHinting()
5457
5458```
5459OH_Drawing_FontHinting OH_Drawing_FontGetHinting (const OH_Drawing_Font* )
5460```
5461
5462**描述**
5463
5464获取字型轮廓效果枚举类型。
5465
5466本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5467
5468OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5469
5470**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5471
5472**起始版本:** 12
5473
5474**参数:**
5475
5476| 名称 | 描述 |
5477| -------- | -------- |
5478| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5479
5480**返回:**
5481
5482OH_Drawing_FontHinting 返回字型轮廓效果枚举类型[OH_Drawing_FontHinting](#oh_drawing_fonthinting)。
5483
5484
5485### OH_Drawing_FontSetEmbeddedBitmaps()
5486
5487```
5488void OH_Drawing_FontSetEmbeddedBitmaps (OH_Drawing_Font* , bool isEmbeddedBitmaps )
5489```
5490
5491**描述**
5492
5493用于设置字型是否转换成位图处理。
5494
5495本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5496
5497OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5498
5499**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5500
5501**起始版本:** 12
5502
5503**参数:**
5504
5505| 名称 | 描述 |
5506| -------- | -------- |
5507| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5508| isEmbeddedBitmaps | 设置字型是否转换成位图处理,true表示转换成位图处理,false表示不转换成位图处理。 |
5509
5510
5511### OH_Drawing_FontIsEmbeddedBitmaps()
5512
5513```
5514bool OH_Drawing_FontIsEmbeddedBitmaps (const OH_Drawing_Font* )
5515```
5516
5517**描述**
5518
5519获取字型是否转换成位图处理。
5520
5521本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5522
5523OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5524
5525**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5526
5527**起始版本:** 12
5528
5529**参数:**
5530
5531| 名称 | 描述 |
5532| -------- | -------- |
5533| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5534
5535**返回:**
5536
5537返回字型是否转换成位图处理,true表示转换成位图处理,false表示不转换成位图处理。
5538
5539
5540### OH_Drawing_BitmapBuild()
5541
5542```
5543void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap* , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat*  )
5544```
5545
5546**描述**
5547
5548用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。
5549
5550本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5551
5552OH_Drawing_Bitmap、OH_Drawing_BitmapFormat任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5553
5554**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5555
5556**起始版本:** 8
5557
5558**参数:**
5559
5560| 名称 | 描述 |
5561| -------- | -------- |
5562| OH_Drawing_Bitmap | 指向位图对象的指针。 |
5563| width | 位图要初始化设置的宽度。 |
5564| height | 位图要初始化设置的高度。 |
5565| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型。 |
5566
5567
5568### OH_Drawing_BitmapCreate()
5569
5570```
5571OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void )
5572```
5573
5574**描述**
5575
5576用于创建一个位图对象。
5577
5578**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5579
5580**起始版本:** 8
5581
5582**返回:**
5583
5584函数会返回一个指针,指针指向创建的位图对象。
5585
5586
5587### OH_Drawing_BitmapCreateFromPixels()
5588
5589```
5590OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels (OH_Drawing_Image_Info* , void* pixels, uint32_t rowBytes )
5591```
5592
5593**描述**
5594
5595用于创建一个位图对象,并将位图像素存储内存地址设置为开发者申请内存的地址。
5596
5597本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5598
5599OH_Drawing_Image_Info、pixels任意一个为NULL或者rowBytes等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5600
5601**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5602
5603**起始版本:** 12
5604
5605**参数:**
5606
5607| 名称 | 描述 |
5608| -------- | -------- |
5609| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
5610| pixels | 指向像素存储的内存首地址,内存由开发者申请,保证有效性。 |
5611| rowBytes | 每行像素的大小,小于等于0时无效。 |
5612
5613**返回:**
5614
5615函数返回一个指针,指针指向创建的位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)。
5616
5617
5618### OH_Drawing_BitmapDestroy()
5619
5620```
5621void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap* )
5622```
5623
5624**描述**
5625
5626用于销毁位图对象并回收该对象占有内存。
5627
5628**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5629
5630**起始版本:** 8
5631
5632**参数:**
5633
5634| 名称 | 描述 |
5635| -------- | -------- |
5636| OH_Drawing_Bitmap | 指向位图对象的指针。 |
5637
5638
5639### OH_Drawing_BitmapGetAlphaFormat()
5640
5641```
5642OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat (OH_Drawing_Bitmap* )
5643```
5644
5645**描述**
5646
5647用于获取指定位图的像素透明度分量。
5648
5649本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5650
5651OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5652
5653**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5654
5655**起始版本:** 12
5656
5657**参数:**
5658
5659| 名称 | 描述 |
5660| -------- | -------- |
5661| OH_Drawing_Bitmap | 指向位图对象的指针。 |
5662
5663**返回:**
5664
5665函数返回位图的像素透明度分量,支持格式参考[OH_Drawing_AlphaFormat](#oh_drawing_alphaformat)。
5666
5667
5668### OH_Drawing_BitmapGetColorFormat()
5669
5670```
5671OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat (OH_Drawing_Bitmap* )
5672```
5673
5674**描述**
5675
5676用于获取指定位图的像素存储格式。
5677
5678本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5679
5680OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5681
5682**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5683
5684**起始版本:** 12
5685
5686**参数:**
5687
5688| 名称 | 描述 |
5689| -------- | -------- |
5690| OH_Drawing_Bitmap | 指向位图对象的指针。 |
5691
5692**返回:**
5693
5694函数返回位图的像素存储格式,支持格式参考[OH_Drawing_ColorFormat](#oh_drawing_colorformat)。
5695
5696
5697### OH_Drawing_BitmapGetHeight()
5698
5699```
5700uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap* )
5701```
5702
5703**描述**
5704
5705用于获取指定位图的高度。
5706
5707本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5708
5709OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5710
5711**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5712
5713**起始版本:** 8
5714
5715**参数:**
5716
5717| 名称 | 描述 |
5718| -------- | -------- |
5719| OH_Drawing_Bitmap | 指向位图对象的指针。 |
5720
5721**返回:**
5722
5723函数返回位图的高度。
5724
5725
5726### OH_Drawing_BitmapGetImageInfo()
5727
5728```
5729void OH_Drawing_BitmapGetImageInfo (OH_Drawing_Bitmap* , OH_Drawing_Image_Info*  )
5730```
5731
5732**描述**
5733
5734用于获取指定位图的信息。
5735
5736本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5737
5738OH_Drawing_Bitmap、OH_Drawing_Image_Info任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5739
5740**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5741
5742**起始版本:** 12
5743
5744**参数:**
5745
5746| 名称 | 描述 |
5747| -------- | -------- |
5748| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
5749| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
5750
5751
5752### OH_Drawing_BitmapGetPixels()
5753
5754```
5755void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap* )
5756```
5757
5758**描述**
5759
5760用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。
5761
5762本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5763
5764OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5765
5766**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5767
5768**起始版本:** 8
5769
5770**参数:**
5771
5772| 名称 | 描述 |
5773| -------- | -------- |
5774| OH_Drawing_Bitmap | 指向位图对象的指针。 |
5775
5776**返回:**
5777
5778函数返回位图的像素地址。
5779
5780
5781### OH_Drawing_BitmapGetWidth()
5782
5783```
5784uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap* )
5785```
5786
5787**描述**
5788
5789用于获取指定位图的宽度。
5790
5791本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5792
5793OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5794
5795**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5796
5797**起始版本:** 8
5798
5799**参数:**
5800
5801| 名称 | 描述 |
5802| -------- | -------- |
5803| OH_Drawing_Bitmap | 指向位图对象的指针。 |
5804
5805**返回:**
5806
5807函数返回位图的宽度。
5808
5809### OH_Drawing_BitmapReadPixels()
5810
5811```
5812bool OH_Drawing_BitmapReadPixels (OH_Drawing_Bitmap* , const OH_Drawing_Image_Info* dstInfo, void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY )
5813```
5814
5815**描述**
5816
5817将位图中的矩形区域像素数据读取到指定的内存缓冲区中。
5818
5819本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5820
5821OH_Drawing_Bitmap、dstInfo、dstPixels任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5822
5823**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5824
5825**起始版本:** 12
5826
5827**参数:**
5828
5829| 名称 | 描述 |
5830| -------- | -------- |
5831| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
5832| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
5833| dstPixels | 目标像素存储区域。 |
5834| dstRowBytes | 目标像素数据每行的字节数,应大于或等于图片信息对象中的最小每行字节数。 |
5835| srcX | 源位图中读取像素数据的起始x轴坐标,应小于源位图的宽度。 |
5836| srcY | 源位图中读取像素数据的起始y轴坐标,应小于源位图的高度。 |
5837
5838**返回:**
5839
5840返回接口调用成功与否的结果。true表示复制成功,false表示复制失败。
5841
5842
5843### OH_Drawing_BrushCreate()
5844
5845```
5846OH_Drawing_Brush* OH_Drawing_BrushCreate (void )
5847```
5848
5849**描述**
5850
5851用于创建一个画刷对象。
5852
5853**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5854
5855**起始版本:** 8
5856
5857**返回:**
5858
5859函数会返回一个指针,指针指向创建的画刷对象。
5860
5861
5862### OH_Drawing_BrushDestroy()
5863
5864```
5865void OH_Drawing_BrushDestroy (OH_Drawing_Brush* )
5866```
5867
5868**描述**
5869
5870用于销毁画刷对象并回收该对象占有的内存。
5871
5872**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5873
5874**起始版本:** 8
5875
5876**参数:**
5877
5878| 名称 | 描述 |
5879| -------- | -------- |
5880| OH_Drawing_Brush | 指向画刷对象的指针。 |
5881
5882
5883### OH_Drawing_BrushGetAlpha()
5884
5885```
5886uint8_t OH_Drawing_BrushGetAlpha (const OH_Drawing_Brush* )
5887```
5888
5889**描述**
5890
5891获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。
5892
5893本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5894
5895OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5896
5897**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5898
5899**起始版本:** 11
5900
5901**参数:**
5902
5903| 名称 | 描述 |
5904| -------- | -------- |
5905| OH_Drawing_Brush | 表示指向画刷对象的指针。 |
5906
5907**返回:**
5908
5909返回一个8位变量,用于表示透明度值。
5910
5911
5912### OH_Drawing_BrushGetColor()
5913
5914```
5915uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush* )
5916```
5917
5918**描述**
5919
5920用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。
5921
5922本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5923
5924OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5925
5926**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5927
5928**起始版本:** 8
5929
5930**参数:**
5931
5932| 名称 | 描述 |
5933| -------- | -------- |
5934| OH_Drawing_Brush | 指向画刷对象的指针。 |
5935
5936**返回:**
5937
5938函数返回一个描述颜色的32位(ARGB)变量。
5939
5940
5941### OH_Drawing_BrushGetFilter()
5942
5943```
5944void OH_Drawing_BrushGetFilter (OH_Drawing_Brush* , OH_Drawing_Filter*  )
5945```
5946
5947**描述**
5948
5949从画刷获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。
5950
5951本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5952
5953OH_Drawing_Brush、OH_Drawing_Filter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5954
5955**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5956
5957**起始版本:** 12
5958
5959**参数:**
5960
5961| 名称 | 描述 |
5962| -------- | -------- |
5963| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 |
5964| OH_Drawing_Filter | 表示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 |
5965
5966
5967### OH_Drawing_BrushIsAntiAlias()
5968
5969```
5970bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush* )
5971```
5972
5973**描述**
5974
5975用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
5976
5977本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5978
5979OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5980
5981**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5982
5983**起始版本:** 8
5984
5985**参数:**
5986
5987| 名称 | 描述 |
5988| -------- | -------- |
5989| OH_Drawing_Brush | 指向画刷对象的指针。 |
5990
5991**返回:**
5992
5993函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。
5994
5995
5996### OH_Drawing_BrushReset()
5997
5998```
5999void OH_Drawing_BrushReset (OH_Drawing_Brush* )
6000```
6001
6002**描述**
6003
6004将画刷重置至初始状态,清空所有已设置的属性。
6005
6006本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6007
6008OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6009
6010**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6011
6012**起始版本:** 12
6013
6014**参数:**
6015
6016| 名称 | 描述 |
6017| -------- | -------- |
6018| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 |
6019
6020
6021### OH_Drawing_BrushSetAlpha()
6022
6023```
6024void OH_Drawing_BrushSetAlpha (OH_Drawing_Brush* , uint8_t alpha )
6025```
6026
6027**描述**
6028
6029为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。
6030
6031本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6032
6033OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6034
6035**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6036
6037**起始版本:** 11
6038
6039**参数:**
6040
6041| 名称 | 描述 |
6042| -------- | -------- |
6043| OH_Drawing_Brush | 指向画刷对象的指针。 |
6044| alpha | 表示要设置的透明度值,是一个8位变量。 |
6045
6046
6047### OH_Drawing_BrushSetAntiAlias()
6048
6049```
6050void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush* , bool  )
6051```
6052
6053**描述**
6054
6055用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
6056
6057本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6058
6059OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6060
6061**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6062
6063**起始版本:** 8
6064
6065**参数:**
6066
6067| 名称 | 描述 |
6068| -------- | -------- |
6069| OH_Drawing_Brush | 指向画刷对象的指针。 |
6070| bool | 真为抗锯齿,假则不做抗锯齿处理。 |
6071
6072
6073### OH_Drawing_BrushSetBlendMode()
6074
6075```
6076void OH_Drawing_BrushSetBlendMode (OH_Drawing_Brush* , OH_Drawing_BlendMode  )
6077```
6078
6079**描述**
6080
6081为画刷设置一个混合器,该混合器实现了指定的混合模式枚举。
6082
6083本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6084
6085OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6086
6087OH_Drawing_BlendMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6088
6089**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6090
6091**起始版本:** 12
6092
6093**参数:**
6094
6095| 名称 | 描述 |
6096| -------- | -------- |
6097| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 |
6098| OH_Drawing_BlendMode | 混合模式枚举类型[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 |
6099
6100
6101### OH_Drawing_BrushSetColor()
6102
6103```
6104void OH_Drawing_BrushSetColor (OH_Drawing_Brush* , uint32_t color )
6105```
6106
6107**描述**
6108
6109用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。
6110
6111本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6112
6113OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6114
6115**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6116
6117**起始版本:** 8
6118
6119**参数:**
6120
6121| 名称 | 描述 |
6122| -------- | -------- |
6123| OH_Drawing_Brush | 指向画刷对象的指针。 |
6124| color | 描述颜色的32位(ARGB)变量。 |
6125
6126
6127### OH_Drawing_BrushSetFilter()
6128
6129```
6130void OH_Drawing_BrushSetFilter (OH_Drawing_Brush* , OH_Drawing_Filter*  )
6131```
6132
6133**描述**
6134
6135为画刷设置滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。
6136
6137本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6138
6139OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6140
6141**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6142
6143**起始版本:** 11
6144
6145**参数:**
6146
6147| 名称 | 描述 |
6148| -------- | -------- |
6149| OH_Drawing_Brush | 指向画刷对象的指针。 |
6150| OH_Drawing_Filter | 表示指向滤波器对象的指针,为NULL表示清空画刷滤波器。 |
6151
6152
6153### OH_Drawing_BrushSetShaderEffect()
6154
6155```
6156void OH_Drawing_BrushSetShaderEffect (OH_Drawing_Brush* , OH_Drawing_ShaderEffect*  )
6157```
6158
6159**描述**
6160
6161为画刷设置着色器效果。
6162
6163本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6164
6165OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6166
6167**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6168
6169**起始版本:** 11
6170
6171**参数:**
6172
6173| 名称 | 描述 |
6174| -------- | -------- |
6175| OH_Drawing_Brush | 指向画刷对象的指针。 |
6176| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针,为NULL表示清空画刷的着色器效果。 |
6177
6178
6179### OH_Drawing_CanvasAttachBrush()
6180
6181```
6182void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas* , const OH_Drawing_Brush*  )
6183```
6184
6185**描述**
6186
6187用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。执行该方法后,若画刷的效果发生改变并且开发者希望该变化生效于接下来的绘制动作,需要再次执行该方法以确保变化生效。
6188
6189本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6190
6191OH_Drawing_Canvas、OH_Drawing_Brush任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6192
6193**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6194
6195**起始版本:** 8
6196
6197**参数:**
6198
6199| 名称 | 描述 |
6200| -------- | -------- |
6201| OH_Drawing_Canvas | 指向画布对象的指针。 |
6202| OH_Drawing_Brush | 指向画刷对象的指针。 |
6203
6204
6205### OH_Drawing_CanvasAttachPen()
6206
6207```
6208void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas* , const OH_Drawing_Pen*  )
6209```
6210
6211**描述**
6212
6213用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。执行该方法后,若画笔的效果发生改变并且开发者希望该变化生效于接下来的绘制动作,需要再次执行该方法以确保变化生效。
6214
6215本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6216
6217OH_Drawing_Canvas、OH_Drawing_Pen任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6218
6219**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6220
6221**起始版本:** 8
6222
6223**参数:**
6224
6225| 名称 | 描述 |
6226| -------- | -------- |
6227| OH_Drawing_Canvas | 指向画布对象的指针。 |
6228| OH_Drawing_Pen | 指向画笔对象的指针。 |
6229
6230
6231### OH_Drawing_CanvasBind()
6232
6233```
6234void OH_Drawing_CanvasBind (OH_Drawing_Canvas* , OH_Drawing_Bitmap*  )
6235```
6236
6237**描述**
6238
6239用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。绑定位图对象后的画布为非录制类型画布。
6240
6241本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6242
6243OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6244
6245**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6246
6247**起始版本:** 8
6248
6249**参数:**
6250
6251| 名称 | 描述 |
6252| -------- | -------- |
6253| OH_Drawing_Canvas | 指向画布对象的指针。 |
6254| OH_Drawing_Bitmap | 指向位图对象的指针。 |
6255
6256
6257### OH_Drawing_CanvasClear()
6258
6259```
6260void OH_Drawing_CanvasClear (OH_Drawing_Canvas* , uint32_t color )
6261```
6262
6263**描述**
6264
6265用于使用指定颜色去清空画布。
6266
6267本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6268
6269OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6270
6271**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6272
6273**起始版本:** 8
6274
6275**参数:**
6276
6277| 名称 | 描述 |
6278| -------- | -------- |
6279| OH_Drawing_Canvas | 指向画布对象的指针。 |
6280| color | 描述颜色的32位(ARGB)变量。 |
6281
6282
6283### OH_Drawing_CanvasClipPath()
6284
6285```
6286void OH_Drawing_CanvasClipPath (OH_Drawing_Canvas* , const OH_Drawing_Path* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
6287```
6288
6289**描述**
6290
6291用于裁剪一个自定义路径。
6292
6293本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6294
6295OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6296
6297clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6298
6299**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6300
6301**起始版本:** 11
6302
6303**参数:**
6304
6305| 名称 | 描述 |
6306| -------- | -------- |
6307| OH_Drawing_Canvas | 指向画布对象的指针。 |
6308| OH_Drawing_Path | 指向路径对象的指针。 |
6309| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 |
6310| doAntiAlias | 真为抗锯齿,假则不做抗锯齿处理。 |
6311
6312
6313### OH_Drawing_CanvasClipRect()
6314
6315```
6316void OH_Drawing_CanvasClipRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
6317```
6318
6319**描述**
6320
6321用于裁剪一个矩形。
6322
6323本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6324
6325OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6326
6327clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6328
6329**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6330
6331**起始版本:** 11
6332
6333**参数:**
6334
6335| 名称 | 描述 |
6336| -------- | -------- |
6337| OH_Drawing_Canvas | 指向画布对象的指针。 |
6338| OH_Drawing_Rect | 指向矩形对象的指针。 |
6339| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 |
6340| doAntiAlias | 值为true则做抗锯齿处理,反之不做。 |
6341
6342### OH_Drawing_CanvasClipRoundRect()
6343
6344```
6345void OH_Drawing_CanvasClipRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
6346```
6347
6348**描述**
6349
6350用于裁剪一个圆角矩形。
6351
6352本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6353
6354OH_Drawing_Canvas、OH_Drawing_RoundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6355
6356clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6357
6358**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6359
6360**起始版本:** 12
6361
6362**参数:**
6363
6364| 名称 | 描述 |
6365| -------- | -------- |
6366| OH_Drawing_Canvas | 指向画布对象的指针。 |
6367| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
6368| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 |
6369| doAntiAlias | 表示是否需要做抗锯齿处理,值为true时为需要,为false时为不需要。 |
6370
6371### OH_Drawing_CanvasConcatMatrix()
6372
6373```
6374void OH_Drawing_CanvasConcatMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
6375```
6376
6377**描述**
6378
6379画布现有矩阵左乘以传入矩阵,不影响该接口之前的绘制操作。
6380
6381本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6382
6383OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6384
6385**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6386
6387**起始版本:** 12
6388
6389**参数:**
6390
6391| 名称 | 描述 |
6392| -------- | -------- |
6393| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
6394| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
6395
6396
6397### OH_Drawing_CanvasCreate()
6398
6399```
6400OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void )
6401```
6402
6403**描述**
6404
6405用于创建一个画布对象。
6406
6407**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6408
6409**起始版本:** 8
6410
6411**返回:**
6412
6413函数会返回一个指针,指针指向创建的画布对象。
6414
6415
6416### OH_Drawing_CanvasDestroy()
6417
6418```
6419void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas* )
6420```
6421
6422**描述**
6423
6424用于销毁画布对象并回收该对象占有的内存。
6425
6426**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6427
6428**起始版本:** 8
6429
6430**参数:**
6431
6432| 名称 | 描述 |
6433| -------- | -------- |
6434| OH_Drawing_Canvas | 指向画布对象的指针。 |
6435
6436
6437### OH_Drawing_CanvasDetachBrush()
6438
6439```
6440void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas* )
6441```
6442
6443**描述**
6444
6445用于去除掉画布中的画刷,使用后画布将不使用此前设置的画刷去填充图形形状。
6446
6447本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6448
6449OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6450
6451**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6452
6453**起始版本:** 8
6454
6455**参数:**
6456
6457| 名称 | 描述 |
6458| -------- | -------- |
6459| OH_Drawing_Canvas | 指向画布对象的指针。 |
6460
6461
6462### OH_Drawing_CanvasDetachPen()
6463
6464```
6465void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas* )
6466```
6467
6468**描述**
6469
6470用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。
6471
6472本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6473
6474OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6475
6476**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6477
6478**起始版本:** 8
6479
6480**参数:**
6481
6482| 名称 | 描述 |
6483| -------- | -------- |
6484| OH_Drawing_Canvas | 指向画布对象的指针。 |
6485
6486
6487### OH_Drawing_CanvasDrawArc()
6488
6489```
6490void OH_Drawing_CanvasDrawArc (OH_Drawing_Canvas* , const OH_Drawing_Rect* , float startAngle, float sweepAngle )
6491```
6492
6493**描述**
6494
6495用于画一个弧。当扫描角度的绝对值大于360度时,本接口绘制的是一个椭圆。
6496
6497本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6498
6499OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6500
6501**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6502
6503**起始版本:** 11
6504
6505**参数:**
6506
6507| 名称 | 描述 |
6508| -------- | -------- |
6509| OH_Drawing_Canvas | 指向画布对象的指针。 |
6510| OH_Drawing_Rect | 指向矩形对象的指针。 |
6511| startAngle | 弧的起始角度,0度时起始点位于椭圆的右端点,正数时以顺时针方向放置起始点,负数时以逆时针方向放置起始点。 |
6512| sweepAngle | 弧的扫描角度,正数时顺时针扫描,负数时逆时针扫描。它的有效范围在-360度到360度之间,当绝对值大于360度时,该函数绘制的是一个椭圆。 |
6513
6514
6515### OH_Drawing_CanvasDrawBackground()
6516
6517```
6518void OH_Drawing_CanvasDrawBackground (OH_Drawing_Canvas* , const OH_Drawing_Brush*  )
6519```
6520
6521**描述**
6522
6523用于画一个背景,此背景以画刷填充。
6524
6525本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6526
6527OH_Drawing_Canvas、OH_Drawing_Brush任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6528
6529**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6530
6531**起始版本:** 12
6532
6533**参数:**
6534
6535| 名称 | 描述 |
6536| -------- | -------- |
6537| OH_Drawing_Canvas | 指向画布对象的指针。 |
6538| OH_Drawing_Brush | 指向画刷对象的指针。 |
6539
6540
6541### OH_Drawing_CanvasDrawBitmap()
6542
6543```
6544void OH_Drawing_CanvasDrawBitmap (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , float left, float top )
6545```
6546
6547**描述**
6548
6549用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。
6550
6551本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6552
6553OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6554
6555**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6556
6557**起始版本:** 11
6558
6559**参数:**
6560
6561| 名称 | 描述 |
6562| -------- | -------- |
6563| OH_Drawing_Canvas | 指向画布对象的指针。 |
6564| OH_Drawing_Bitmap | 指向位图对象的指针。 |
6565| left | 位图对象左上角的横坐标。 |
6566| top | 位图对象左上角的纵坐标。 |
6567
6568
6569### OH_Drawing_CanvasDrawBitmapRect()
6570
6571```
6572void OH_Drawing_CanvasDrawBitmapRect (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*  )
6573```
6574
6575**描述**
6576
6577将位图的指定区域绘制到画布的指定区域。
6578
6579本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6580
6581OH_Drawing_Canvas、OH_Drawing_Bitmap、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6582
6583**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6584
6585**起始版本:** 12
6586
6587**参数:**
6588
6589| 名称 | 描述 |
6590| -------- | -------- |
6591| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
6592| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
6593| src | 源位图指定矩形区域,为NULL将指定整个源位图区域。 |
6594| dst | 目标画布指定矩形区域。 |
6595| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 |
6596
6597
6598### OH_Drawing_CanvasDrawCircle()
6599
6600```
6601void OH_Drawing_CanvasDrawCircle (OH_Drawing_Canvas* , const OH_Drawing_Point* , float radius )
6602```
6603
6604**描述**
6605
6606用于画一个圆形。
6607
6608本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6609
6610OH_Drawing_Canvas、OH_Drawing_Point任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6611
6612radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6613
6614**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6615
6616**起始版本:** 11
6617
6618**参数:**
6619
6620| 名称 | 描述 |
6621| -------- | -------- |
6622| OH_Drawing_Canvas | 指向画布对象的指针。 |
6623| OH_Drawing_Point | 指向坐标点对象的指针,表示圆心。 |
6624| radius | 圆形的半径,小于等于0时无效。 |
6625
6626
6627### OH_Drawing_CanvasDrawImageRect()
6628
6629```
6630void OH_Drawing_CanvasDrawImageRect (OH_Drawing_Canvas* , OH_Drawing_Image* , OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*  )
6631```
6632
6633**描述**
6634
6635将图片绘制到画布的指定区域上。
6636
6637本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6638
6639OH_Drawing_Canvas、OH_Drawing_Image、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6640
6641**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6642
6643**起始版本:** 12
6644
6645**参数:**
6646
6647| 名称 | 描述 |
6648| -------- | -------- |
6649| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
6650| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
6651| dst | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
6652| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 |
6653
6654
6655### OH_Drawing_CanvasDrawImageRectWithSrc()
6656
6657```
6658void 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  )
6659```
6660
6661**描述**
6662
6663将图片绘制到画布的指定区域上,源矩形选定的区域会缩放平移到目标矩形。
6664
6665本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6666
6667OH_Drawing_Canvas、OH_Drawing_Image、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6668
6669**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6670
6671**起始版本:** 12
6672
6673**参数:**
6674
6675| 名称 | 描述 |
6676| -------- | -------- |
6677| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
6678| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
6679| src | 指向源矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
6680| dst | 指向目标矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
6681| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 |
6682| OH_Drawing_SrcRectConstraint | 约束类型,支持可选的具体类型可见[OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1)枚举。 |
6683
6684
6685### OH_Drawing_CanvasDrawLine()
6686
6687```
6688void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas* , float x1, float y1, float x2, float y2 )
6689```
6690
6691**描述**
6692
6693用于画一条直线段。
6694
6695本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6696
6697OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6698
6699**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6700
6701**起始版本:** 8
6702
6703**参数:**
6704
6705| 名称 | 描述 |
6706| -------- | -------- |
6707| OH_Drawing_Canvas | 指向画布对象的指针。 |
6708| x1 | 线段起始点的横坐标。 |
6709| y1 | 线段起始点的纵坐标。 |
6710| x2 | 线段结束点的横坐标。 |
6711| y2 | 线段结束点的纵坐标。 |
6712
6713
6714### OH_Drawing_CanvasDrawOval()
6715
6716```
6717void OH_Drawing_CanvasDrawOval (OH_Drawing_Canvas* , const OH_Drawing_Rect*  )
6718```
6719
6720**描述**
6721
6722用于画一个椭圆。
6723
6724本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6725
6726OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6727
6728**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6729
6730**起始版本:** 11
6731
6732**参数:**
6733
6734| 名称 | 描述 |
6735| -------- | -------- |
6736| OH_Drawing_Canvas | 指向画布对象的指针。 |
6737| OH_Drawing_Rect | 指向矩形对象的指针。 |
6738
6739
6740### OH_Drawing_CanvasDrawPath()
6741
6742```
6743void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas* , const OH_Drawing_Path*  )
6744```
6745
6746**描述**
6747
6748用于画一个自定义路径。
6749
6750本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6751
6752OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6753
6754**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6755
6756**起始版本:** 8
6757
6758**参数:**
6759
6760| 名称 | 描述 |
6761| -------- | -------- |
6762| OH_Drawing_Canvas | 指向画布对象的指针。 |
6763| OH_Drawing_Path | 指向路径对象的指针。 |
6764
6765
6766### OH_Drawing_CanvasDrawPixelMapRect()
6767
6768```
6769void OH_Drawing_CanvasDrawPixelMapRect (OH_Drawing_Canvas* , OH_Drawing_PixelMap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*  )
6770```
6771
6772**描述**
6773
6774用于将像素图的指定区域绘制到画布的指定区域。
6775
6776本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6777
6778OH_Drawing_Canvas、OH_Drawing_PixelMap、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6779
6780**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6781
6782**起始版本:** 12
6783
6784**参数:**
6785
6786| 名称 | 描述 |
6787| -------- | -------- |
6788| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
6789| OH_Drawing_PixelMap | 指向像素图[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。 |
6790| src | 像素图指定矩形区域,为NULL将指定整个像素图区域。 |
6791| dst | 目标画布指定矩形区域。 |
6792| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 |
6793
6794
6795### OH_Drawing_CanvasDrawPoints()
6796
6797```
6798void OH_Drawing_CanvasDrawPoints (OH_Drawing_Canvas* , OH_Drawing_PointMode mode, uint32_t count, const OH_Drawing_Point2D*  )
6799```
6800
6801**描述**
6802
6803用于画多个点,绘制方式分为绘制单独的点、绘制成线段或绘制成开放多边形。
6804
6805本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6806
6807OH_Drawing_Canvas、OH_Drawing_Point2D任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6808
6809mode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6810
6811**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6812
6813**起始版本:** 12
6814
6815**参数:**
6816
6817| 名称 | 描述 |
6818| -------- | -------- |
6819| OH_Drawing_Canvas | 指向画布对象的指针。 |
6820| mode | 绘制多个点的方式,支持方式参考[OH_Drawing_PointMode](#oh_drawing_pointmode)。 |
6821| count | 点的数量,即点数组中点的个数。 |
6822| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 指向多个点的数组。 |
6823
6824
6825### OH_Drawing_CanvasDrawRect()
6826
6827```
6828void OH_Drawing_CanvasDrawRect (OH_Drawing_Canvas* , const OH_Drawing_Rect*  )
6829```
6830
6831**描述**
6832
6833用于画一个矩形。
6834
6835本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6836
6837OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6838
6839**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6840
6841**起始版本:** 11
6842
6843**参数:**
6844
6845| 名称 | 描述 |
6846| -------- | -------- |
6847| OH_Drawing_Canvas | 指向画布对象的指针。 |
6848| OH_Drawing_Rect | 指向矩形对象的指针。 |
6849
6850
6851### OH_Drawing_CanvasDrawRegion()
6852
6853```
6854void OH_Drawing_CanvasDrawRegion (OH_Drawing_Canvas* , const OH_Drawing_Region*  )
6855```
6856
6857**描述**
6858
6859用于画一块区域。
6860
6861本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6862
6863OH_Drawing_Canvas、OH_Drawing_Region任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6864
6865**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6866
6867**起始版本:** 12
6868
6869**参数:**
6870
6871| 名称 | 描述 |
6872| -------- | -------- |
6873| OH_Drawing_Canvas | 指向画布对象的指针。 |
6874| OH_Drawing_Region | 指向区域对象的指针。 |
6875
6876
6877### OH_Drawing_CanvasDrawRoundRect()
6878
6879```
6880void OH_Drawing_CanvasDrawRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect*  )
6881```
6882
6883**描述**
6884
6885用于画一个圆角矩形。
6886
6887本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6888
6889OH_Drawing_Canvas、OH_Drawing_RoundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6890
6891**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6892
6893**起始版本:** 11
6894
6895**参数:**
6896
6897| 名称 | 描述 |
6898| -------- | -------- |
6899| OH_Drawing_Canvas | 指向画布对象的指针。 |
6900| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
6901
6902
6903### OH_Drawing_CanvasDrawShadow()
6904
6905```
6906void 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 )
6907```
6908
6909**描述**
6910
6911绘制射灯类型阴影,使用路径描述环境光阴影的轮廓。
6912
6913本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6914
6915OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6916
6917flag不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6918
6919**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6920
6921**起始版本:** 12
6922
6923**参数:**
6924
6925| 名称 | 描述 |
6926| -------- | -------- |
6927| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
6928| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,用于生成阴影。 |
6929| planeParams | 表示遮挡物相对于画布在Z轴上的偏移量,其值取决于x与y坐标。 |
6930| devLightPos | 光线相对于画布的位置。 |
6931| lightRadius | 光源半径,需大于或等于0。 |
6932| ambientColor | 环境阴影颜色,是一个32位(ARGB)变量。 |
6933| spotColor | 点阴影颜色,是一个32位(ARGB)变量。 |
6934| flag | 阴影标志枚举[OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags)。 |
6935
6936
6937### OH_Drawing_CanvasDrawTextBlob()
6938
6939```
6940void OH_Drawing_CanvasDrawTextBlob (OH_Drawing_Canvas* , const OH_Drawing_TextBlob* , float x, float y )
6941```
6942
6943**描述**
6944
6945用于画一段文字。若构造OH_Drawing_TextBlob的字体不支持待绘制字符,则该部分字符无法绘制。
6946
6947本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6948
6949OH_Drawing_Canvas、OH_Drawing_TextBlob任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6950
6951**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6952
6953**起始版本:** 11
6954
6955**参数:**
6956
6957| 名称 | 描述 |
6958| -------- | -------- |
6959| OH_Drawing_Canvas | 指向画布对象的指针。 |
6960| OH_Drawing_TextBlob | 指向文本对象的指针。 |
6961| x | 文本对象左下角的横坐标。 |
6962| y | 文本对象左下角的纵坐标。 |
6963
6964
6965### OH_Drawing_CanvasDrawVertices()
6966
6967```
6968void 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 )
6969```
6970
6971**描述**
6972
6973用于画顶点数组描述的三角网格。
6974
6975本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6976
6977OH_Drawing_Canvas或positions为NULL、vertexCount值小于3、indexCount值小于3且不为0,存在以上任意一种情况时设置错误码为OH_DRAWING_ERROR_INVALID_PARAMETER;
6978
6979vertexMmode、mode任意一个不在枚举范围内时设置错误码为OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6980
6981**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6982
6983**起始版本:** 12
6984
6985**参数:**
6986
6987| 名称 | 描述 |
6988| -------- | -------- |
6989| OH_Drawing_Canvas | 指向画布对象的指针。 |
6990| vertexMmode | 绘制顶点的连接方式,支持方式参考[OH_Drawing_VertexMode](#oh_drawing_vertexmode)。 |
6991| vertexCount | 顶点数组元素的数量,值必须大于等于3。 |
6992| positions | 描述顶点位置的数组指针,不能为空,其长度必须等于vertexCount。 |
6993| texs | 描述顶点对应纹理空间坐标的数组指针,可以为空,若不为空其长度必须等于vertexCount。 |
6994| colors | 描述顶点对应颜色的数组指针,用于在三角形中进行插值,可以为空,若不为空其长度必须等于vertexCount。 |
6995| indexCount | 索引的数量,可以为0,若不为0则值必须大于等于3。 |
6996| indices | 描述顶点对应索引的数组指针,可以为空,若不为空其长度必须等于indexCount。 |
6997| mode | 混合模式枚举,支持方式参考[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 |
6998
6999
7000### OH_Drawing_CanvasGetHeight()
7001
7002```
7003int32_t OH_Drawing_CanvasGetHeight (OH_Drawing_Canvas* )
7004```
7005
7006**描述**
7007
7008获取画布高度。
7009
7010本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7011
7012OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7013
7014**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7015
7016**起始版本:** 12
7017
7018**参数:**
7019
7020| 名称 | 描述 |
7021| -------- | -------- |
7022| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
7023
7024**返回:**
7025
7026函数返回画布高度,单位为像素。
7027
7028
7029### OH_Drawing_CanvasGetLocalClipBounds()
7030
7031```
7032void OH_Drawing_CanvasGetLocalClipBounds (OH_Drawing_Canvas* , OH_Drawing_Rect*  )
7033```
7034
7035**描述**
7036
7037获取画布裁剪区域的边界。该接口不可用于录制类型画布。
7038
7039本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7040
7041OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7042
7043**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7044
7045**起始版本:** 12
7046
7047**参数:**
7048
7049| 名称 | 描述 |
7050| -------- | -------- |
7051| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
7052| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针, 开发者可调用[OH_Drawing_RectCreate](#oh_drawing_rectcreate)接口创建。 |
7053
7054
7055### OH_Drawing_CanvasGetSaveCount()
7056
7057```
7058uint32_t OH_Drawing_CanvasGetSaveCount (OH_Drawing_Canvas* )
7059```
7060
7061**描述**
7062
7063用于获取栈中保存的画布状态(画布矩阵)的数量。
7064
7065本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7066
7067OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7068
7069**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7070
7071**起始版本:** 11
7072
7073**参数:**
7074
7075| 名称 | 描述 |
7076| -------- | -------- |
7077| OH_Drawing_Canvas | 指向画布对象的指针。 |
7078
7079**返回:**
7080
7081函数会返回一个32位的值描述画布状态(画布矩阵)的数量,画布初始状态数量为1。
7082
7083
7084### OH_Drawing_CanvasGetTotalMatrix()
7085
7086```
7087void OH_Drawing_CanvasGetTotalMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
7088```
7089
7090**描述**
7091
7092获取画布3x3矩阵。
7093
7094本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7095
7096OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7097
7098**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7099
7100**起始版本:** 12
7101
7102**参数:**
7103
7104| 名称 | 描述 |
7105| -------- | -------- |
7106| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
7107| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 |
7108
7109
7110### OH_Drawing_CanvasGetWidth()
7111
7112```
7113int32_t OH_Drawing_CanvasGetWidth (OH_Drawing_Canvas* )
7114```
7115
7116**描述**
7117
7118获取画布宽度。
7119
7120本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7121
7122OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7123
7124**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7125
7126**起始版本:** 12
7127
7128**参数:**
7129
7130| 名称 | 描述 |
7131| -------- | -------- |
7132| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
7133
7134**返回:**
7135
7136函数返回画布宽度,单位为像素。
7137
7138
7139### OH_Drawing_CanvasReadPixels()
7140
7141```
7142bool OH_Drawing_CanvasReadPixels (OH_Drawing_Canvas* , OH_Drawing_Image_Info* , void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY )
7143```
7144
7145**描述**
7146
7147从画布中拷贝像素数据到指定地址。该接口不可用于录制类型画布。
7148
7149本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7150
7151OH_Drawing_Canvas、OH_Drawing_Image_Info、dstPixels任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7152
7153**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7154
7155**起始版本:** 12
7156
7157**参数:**
7158
7159| 名称 | 描述 |
7160| -------- | -------- |
7161| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
7162| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 指向图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
7163| dstPixels | 目标像素存储首地址。 |
7164| dstRowBytes | 一行像素的大小,小于等于0时无效。 |
7165| srcX | 画布像素的x轴偏移量,单位为像素。 |
7166| srcY | 画布像素的y轴偏移量,单位为像素。 |
7167
7168**返回:**
7169
7170函数返回true表示像素成功拷贝到目标像素存储首地址,函数返回false表示拷贝失败。
7171
7172
7173### OH_Drawing_CanvasReadPixelsToBitmap()
7174
7175```
7176bool OH_Drawing_CanvasReadPixelsToBitmap (OH_Drawing_Canvas* , OH_Drawing_Bitmap* , int32_t srcX, int32_t srcY )
7177```
7178
7179**描述**
7180
7181从画布拷贝像素数据到位图中。该接口不可用于录制类型画布。
7182
7183本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7184
7185OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7186
7187**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7188
7189**起始版本:** 12
7190
7191**参数:**
7192
7193| 名称 | 描述 |
7194| -------- | -------- |
7195| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
7196| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
7197| srcX | 画布像素的x轴偏移量,单位为像素。 |
7198| srcY | 画布像素的y轴偏移量,单位为像素。 |
7199
7200**返回:**
7201
7202函数返回true表示像素成功拷贝到位图,函数返回false表示拷贝失败。
7203
7204
7205### OH_Drawing_CanvasResetMatrix()
7206
7207```
7208void OH_Drawing_CanvasResetMatrix (OH_Drawing_Canvas* )
7209```
7210
7211**描述**
7212
7213重置当前画布的矩阵为单位矩阵。
7214
7215本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7216
7217OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7218
7219**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7220
7221**起始版本:** 12
7222
7223**参数:**
7224
7225| 名称 | 描述 |
7226| -------- | -------- |
7227| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
7228
7229
7230### OH_Drawing_CanvasRestore()
7231
7232```
7233void OH_Drawing_CanvasRestore (OH_Drawing_Canvas* )
7234```
7235
7236**描述**
7237
7238用于恢复保存在栈顶的画布状态(画布矩阵)。
7239
7240本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7241
7242OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7243
7244**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7245
7246**起始版本:** 8
7247
7248**参数:**
7249
7250| 名称 | 描述 |
7251| -------- | -------- |
7252| OH_Drawing_Canvas | 指向画布对象的指针。 |
7253
7254
7255### OH_Drawing_CanvasRestoreToCount()
7256
7257```
7258void OH_Drawing_CanvasRestoreToCount (OH_Drawing_Canvas* , uint32_t saveCount )
7259```
7260
7261**描述**
7262
7263用于恢复到指定数量的画布状态(画布矩阵)。
7264
7265本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7266
7267OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7268
7269**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7270
7271**起始版本:** 11
7272
7273**参数:**
7274
7275| 名称 | 描述 |
7276| -------- | -------- |
7277| OH_Drawing_Canvas | 指向画布对象的指针。 |
7278| saveCount | 要恢复的画布状态深度。小于等于1时,恢复为初始状态;大于已保存的画布状态数量时,不执行任何操作。 |
7279
7280
7281### OH_Drawing_CanvasRotate()
7282
7283```
7284void OH_Drawing_CanvasRotate (OH_Drawing_Canvas* , float degrees, float px, float py )
7285```
7286
7287**描述**
7288
7289用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。
7290
7291本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7292
7293OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7294
7295**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7296
7297**起始版本:** 11
7298
7299**参数:**
7300
7301| 名称 | 描述 |
7302| -------- | -------- |
7303| OH_Drawing_Canvas | 指向画布对象的指针。 |
7304| degrees | 旋转角度。 |
7305| px | 旋转中心的横坐标。 |
7306| py | 旋转中心的纵坐标。 |
7307
7308
7309### OH_Drawing_CanvasSave()
7310
7311```
7312void OH_Drawing_CanvasSave (OH_Drawing_Canvas* )
7313```
7314
7315**描述**
7316
7317用于保存当前画布的状态(画布矩阵)到一个栈顶。需要与恢复接口 [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)配合使用。
7318
7319本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7320
7321OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7322
7323**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7324
7325**起始版本:** 8
7326
7327**参数:**
7328
7329| 名称 | 描述 |
7330| -------- | -------- |
7331| OH_Drawing_Canvas | 指向画布对象的指针。 |
7332
7333
7334### OH_Drawing_CanvasSaveLayer()
7335
7336```
7337void OH_Drawing_CanvasSaveLayer (OH_Drawing_Canvas* , const OH_Drawing_Rect* , const OH_Drawing_Brush*  )
7338```
7339
7340**描述**
7341
7342保存矩阵和裁剪区域,为后续绘制分配位图。调用恢复接口 [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)将放弃对矩阵和剪切区域所做的更改,并绘制位图。
7343
7344本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7345
7346OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7347
7348**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7349
7350**起始版本:** 12
7351
7352**参数:**
7353
7354| 名称 | 描述 |
7355| -------- | -------- |
7356| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
7357| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,用于限制图层大小,为NULL表示无限制。 |
7358| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针,绘制位图时会应用画刷对象的透明度,滤波器效果,混合模式,为NULL表示不应用任何效果。 |
7359
7360
7361### OH_Drawing_CanvasScale()
7362
7363```
7364void OH_Drawing_CanvasScale (OH_Drawing_Canvas* , float sx, float sy )
7365```
7366
7367**描述**
7368
7369用于画布缩放。
7370
7371本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7372
7373OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7374
7375**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7376
7377**起始版本:** 11
7378
7379**参数:**
7380
7381| 名称 | 描述 |
7382| -------- | -------- |
7383| OH_Drawing_Canvas | 指向画布对象的指针。 |
7384| sx | x轴方向的缩放比例。 |
7385| sy | y轴方向的缩放比例。 |
7386
7387
7388### OH_Drawing_CanvasSetMatrix()
7389
7390```
7391void OH_Drawing_CanvasSetMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
7392```
7393
7394**描述**
7395
7396设置画布的矩阵状态。
7397
7398本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7399
7400OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7401
7402**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7403
7404**起始版本:** 12
7405
7406**参数:**
7407
7408| 名称 | 描述 |
7409| -------- | -------- |
7410| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
7411| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 |
7412
7413
7414### OH_Drawing_CanvasSkew()
7415
7416```
7417void OH_Drawing_CanvasSkew (OH_Drawing_Canvas* , float sx, float sy )
7418```
7419
7420**描述**
7421
7422用于画布倾斜变换。等同于将当前画布矩阵左乘(premultiply)倾斜变换矩阵,并应用到画布上。其中倾斜变换矩阵为:\|1 sx 0\| \|sy 1 0\| \|0 0 1\|。
7423
7424本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7425
7426OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7427
7428**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7429
7430**起始版本:** 12
7431
7432**参数:**
7433
7434| 名称 | 描述 |
7435| -------- | -------- |
7436| OH_Drawing_Canvas | 指向画布对象的指针。 |
7437| sx | 沿x轴的倾斜量。正值会使绘制沿y轴增量方向向右倾斜;负值会使绘制沿y轴增量方向向左倾斜。 |
7438| sy | 沿y轴的倾斜量。正值会使绘制沿x轴增量方向向下倾斜;负值会使绘制沿x轴增量方向向上倾斜。 |
7439
7440
7441### OH_Drawing_CanvasTranslate()
7442
7443```
7444void OH_Drawing_CanvasTranslate (OH_Drawing_Canvas* , float dx, float dy )
7445```
7446
7447**描述**
7448
7449用于平移画布一段距离。
7450
7451本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7452
7453OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7454
7455**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7456
7457**起始版本:** 11
7458
7459**参数:**
7460
7461| 名称 | 描述 |
7462| -------- | -------- |
7463| OH_Drawing_Canvas | 指向画布对象的指针。 |
7464| dx | x轴方向的移动距离。 |
7465| dy | y轴方向的移动距离。 |
7466
7467
7468### OH_Drawing_ColorFilterCreateBlendMode()
7469
7470```
7471OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode (uint32_t color, OH_Drawing_BlendMode  )
7472```
7473
7474**描述**
7475
7476创建具有混合模式的颜色滤波器。
7477
7478**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7479
7480**起始版本:** 11
7481
7482**参数:**
7483
7484| 名称 | 描述 |
7485| -------- | -------- |
7486| color | 表示颜色,是一个32位(ARGB)变量。 |
7487| OH_Drawing_BlendMode | 表示混合模式。支持可选的混合模式具体可见[OH_Drawing_BlendMode](#oh_drawing_blendmode)枚举。 |
7488
7489**返回:**
7490
7491返回创建的颜色滤波器对象的指针。
7492
7493
7494### OH_Drawing_ColorFilterCreateCompose()
7495
7496```
7497OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose (OH_Drawing_ColorFilter* colorFilter1, OH_Drawing_ColorFilter* colorFilter2 )
7498```
7499
7500**描述**
7501
7502将两个颜色滤波器合成一个新的颜色滤波器。
7503
7504本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7505
7506colorFilter1、colorFilter2任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7507
7508**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7509
7510**起始版本:** 11
7511
7512**参数:**
7513
7514| 名称 | 描述 |
7515| -------- | -------- |
7516| colorFilter1 | 指向颜色滤波器对象一的指针。 |
7517| colorFilter2 | 指向颜色滤波器对象二的指针。 |
7518
7519**返回:**
7520
7521返回创建的颜色滤波器对象的指针。
7522
7523
7524### OH_Drawing_ColorFilterCreateLinearToSrgbGamma()
7525
7526```
7527OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma (void )
7528```
7529
7530**描述**
7531
7532创建一个从线性颜色空间转换到SRGB颜色空间的颜色滤波器。
7533
7534**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7535
7536**起始版本:** 11
7537
7538**返回:**
7539
7540返回创建的颜色滤波器对象的指针。
7541
7542
7543### OH_Drawing_ColorFilterCreateLuma()
7544
7545```
7546OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma (void )
7547```
7548
7549**描述**
7550
7551创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。
7552
7553**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7554
7555**起始版本:** 11
7556
7557**返回:**
7558
7559返回创建的颜色滤波器对象的指针。
7560
7561
7562### OH_Drawing_ColorFilterCreateMatrix()
7563
7564```
7565OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix (const float matrix[20])
7566```
7567
7568**描述**
7569
7570创建具有5x4颜色矩阵的颜色滤波器。
7571
7572本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7573
7574matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7575
7576**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7577
7578**起始版本:** 11
7579
7580**参数:**
7581
7582| 名称 | 描述 |
7583| -------- | -------- |
7584| matrix | 表示矩阵,以长度为20的浮点数组表示。 |
7585
7586**返回:**
7587
7588返回创建的颜色滤波器对象的指针。
7589
7590
7591### OH_Drawing_ColorFilterCreateSrgbGammaToLinear()
7592
7593```
7594OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear (void )
7595```
7596
7597**描述**
7598
7599创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。
7600
7601**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7602
7603**起始版本:** 11
7604
7605**返回:**
7606
7607返回创建的颜色滤波器对象的指针。
7608
7609
7610### OH_Drawing_ColorFilterDestroy()
7611
7612```
7613void OH_Drawing_ColorFilterDestroy (OH_Drawing_ColorFilter* )
7614```
7615
7616**描述**
7617
7618销毁颜色滤波器对象,并收回该对象占用的内存。
7619
7620**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7621
7622**起始版本:** 11
7623
7624**参数:**
7625
7626| 名称 | 描述 |
7627| -------- | -------- |
7628| OH_Drawing_ColorFilter | 表示指向颜色滤波器对象的指针。 |
7629
7630
7631### OH_Drawing_ColorSetArgb()
7632
7633```
7634uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue )
7635```
7636
7637**描述**
7638
7639用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。
7640
7641**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7642
7643**起始版本:** 8
7644
7645**参数:**
7646
7647| 名称 | 描述 |
7648| -------- | -------- |
7649| alpha | 描述透明度的变量, 变量范围是0x00~0xFF。 |
7650| red | 描述红色的变量, 变量范围是0x00~0xFF。 |
7651| green | 描述绿色的变量, 变量范围是0x00~0xFF。 |
7652| blue | 描述蓝色的变量, 变量范围是0x00~0xFF。 |
7653
7654**返回:**
7655
7656函数返回一个描述颜色的32位(ARGB)变量。
7657
7658
7659### OH_Drawing_ColorSpaceCreateSrgb()
7660
7661```
7662OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgb (void )
7663```
7664
7665**描述**
7666
7667创建一个标准颜色空间。
7668
7669**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7670
7671**起始版本:** 12
7672
7673**返回:**
7674
7675函数返回一个指针,指针指向创建的颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)。
7676
7677
7678### OH_Drawing_ColorSpaceCreateSrgbLinear()
7679
7680```
7681OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgbLinear (void )
7682```
7683
7684**描述**
7685
7686创建一个Gamma 1.0空间上的颜色空间。
7687
7688**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7689
7690**起始版本:** 12
7691
7692**返回:**
7693
7694函数返回一个指针,指针指向创建的颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)。
7695
7696
7697### OH_Drawing_ColorSpaceDestroy()
7698
7699```
7700void OH_Drawing_ColorSpaceDestroy (OH_Drawing_ColorSpace* )
7701```
7702
7703**描述**
7704
7705销毁颜色空间对象,并回收该对象占有内存。
7706
7707**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7708
7709**起始版本:** 12
7710
7711**参数:**
7712
7713| 名称 | 描述 |
7714| -------- | -------- |
7715| OH_Drawing_ColorSpace | 指向颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)的指针。 |
7716
7717
7718### OH_Drawing_CreateDashPathEffect()
7719
7720```
7721OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect (float* intervals, int count, float phase )
7722```
7723
7724**描述**
7725
7726创建一个虚线效果的路径效果对象。虚线效果由一组虚线开的间隔、虚线关的间隔数据决定。
7727
7728本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7729
7730intervals为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7731
7732**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7733
7734**起始版本:** 12
7735
7736**参数:**
7737
7738| 名称 | 描述 |
7739| -------- | -------- |
7740| intervals | 虚线间隔数组首地址,偶数项的值表示虚线开的间隔长度, 奇数项的值表示虚线关的间隔长度,单位为像素。 |
7741| count | 虚线间隔数组元素的个数,必须为大于0的偶数。 |
7742| phase | 虚线间隔数组中偏移量。 |
7743
7744**返回:**
7745
7746函数返回一个指针,指针指向创建的路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)。
7747
7748
7749### OH_Drawing_CreateFontCollection()
7750
7751```
7752OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void )
7753```
7754
7755**描述**
7756
7757创建字体集对象[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)对象。
7758
7759**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7760
7761**起始版本:** 8
7762
7763**返回:**
7764
7765指向创建的字体集对象的指针。
7766
7767
7768### OH_Drawing_CreateFontDescriptor()
7769
7770```
7771OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor (void )
7772```
7773
7774**描述**
7775
7776构造字体描述对象,用于描述系统字体详细信息。
7777
7778**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7779
7780**起始版本:** 12
7781
7782**返回:**
7783
7784返回指向已创建的字体描述对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针。
7785
7786
7787### OH_Drawing_CreateFontParser()
7788
7789```
7790OH_Drawing_FontParser* OH_Drawing_CreateFontParser (void )
7791```
7792
7793**描述**
7794
7795构造字体解析对象,用于解析系统字体。
7796
7797**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7798
7799**起始版本:** 12
7800
7801**返回:**
7802
7803返回指向已创建的字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针。
7804
7805
7806### OH_Drawing_CreateSharedFontCollection()
7807
7808```
7809OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection (void )
7810```
7811
7812**描述**
7813
7814创建可共享的字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。
7815
7816**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7817
7818**起始版本:** 12
7819
7820**返回:**
7821
7822指向创建的字体集对象的指针。
7823
7824### OH_Drawing_ClearFontCaches()
7825
7826```
7827void OH_Drawing_ClearFontCaches (OH_Drawing_FontCollection* )
7828```
7829
7830**描述**
7831
7832清理字体排版缓存(字体排版缓存本身设有内存上限和清理机制,所占内存有限,如无内存要求,不建议清理)。
7833
7834**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7835
7836**起始版本:** 12
7837
7838**参数:**
7839
7840| 名称 | 描述 |
7841| -------- | -------- |
7842| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 |
7843
7844### OH_Drawing_CreateTextShadow()
7845
7846```
7847OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow (void )
7848```
7849
7850**描述**
7851
7852创建指向字体阴影对象的指针。不再需要[OH_Drawing_TextShadow](#oh_drawing_textshadow)时,请使用[OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow)接口释放该对象的指针。
7853
7854**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7855
7856**起始版本:** 12
7857
7858**返回:**
7859
7860指向创建的字体阴影对象。
7861
7862
7863### OH_Drawing_CreateTextStyle()
7864
7865```
7866OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void )
7867```
7868
7869**描述**
7870
7871创建指向OH_Drawing_TextStyle对象的指针。
7872
7873**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7874
7875**起始版本:** 8
7876
7877**返回:**
7878
7879指向创建的OH_Drawing_TextStyle对象的指针。
7880
7881
7882### OH_Drawing_CreateTypography()
7883
7884```
7885OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate* )
7886```
7887
7888**描述**
7889
7890创建指向OH_Drawing_Typography对象的指针。不再需要[OH_Drawing_Typography](#oh_drawing_typography)时,请使用[OH_Drawing_DestroyTypography](#oh_drawing_destroytypography)接口释放该对象的指针。
7891
7892**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7893
7894**起始版本:** 8
7895
7896**参数:**
7897
7898| 名称 | 描述 |
7899| -------- | -------- |
7900| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
7901
7902**返回:**
7903
7904指向OH_Drawing_Typography对象的指针。
7905
7906
7907### OH_Drawing_CreateTypographyHandler()
7908
7909```
7910OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle* , OH_Drawing_FontCollection*  )
7911```
7912
7913**描述**
7914
7915创建指向OH_Drawing_TypographyCreate对象的指针。不再需要[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)时,请使用[OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler)接口释放该对象的指针。
7916
7917**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7918
7919**起始版本:** 8
7920
7921**参数:**
7922
7923| 名称 | 描述 |
7924| -------- | -------- |
7925| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
7926| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针,可由[OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection)或[OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection)获取,建议使用[OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection)。 |
7927
7928**返回:**
7929
7930指向新创建的OH_Drawing_TypographyCreate对象的指针。
7931
7932
7933### OH_Drawing_CreateTypographyStyle()
7934
7935```
7936OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void )
7937```
7938
7939**描述**
7940
7941创建指向OH_Drawing_TypographyStyle对象的指针。不再需要[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)时,请使用[OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle)接口释放该对象的指针。
7942
7943**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7944
7945**起始版本:** 8
7946
7947**返回:**
7948
7949指向创建的OH_Drawing_TypographyStyle对象的指针。
7950
7951
7952### OH_Drawing_DestroyFontCollection()
7953
7954```
7955void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection* )
7956```
7957
7958**描述**
7959
7960释放被字体集对象占据的内存。
7961
7962**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7963
7964**起始版本:** 8
7965
7966**参数:**
7967
7968| 名称 | 描述 |
7969| -------- | -------- |
7970| OH_Drawing_FontCollection | 指向字体集对象的指针。 |
7971
7972
7973### OH_Drawing_DestroyFontDescriptor()
7974
7975```
7976void OH_Drawing_DestroyFontDescriptor (OH_Drawing_FontDescriptor* )
7977```
7978
7979**描述**
7980
7981释放字体描述对象占用的内存。
7982
7983**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7984
7985**起始版本:** 12
7986
7987**参数:**
7988
7989| 名称 | 描述 |
7990| -------- | -------- |
7991| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | 指向字体描述对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针,由[OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor)获取。 |
7992
7993
7994### OH_Drawing_DestroyFontParser()
7995
7996```
7997void OH_Drawing_DestroyFontParser (OH_Drawing_FontParser* )
7998```
7999
8000**描述**
8001
8002释放字体解析对象占用的内存。
8003
8004**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8005
8006**起始版本:** 12
8007
8008**参数:**
8009
8010| 名称 | 描述 |
8011| -------- | -------- |
8012| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 |
8013
8014
8015### OH_Drawing_DestroyLineMetrics()
8016
8017```
8018void OH_Drawing_DestroyLineMetrics (OH_Drawing_LineMetrics* )
8019```
8020
8021**描述**
8022
8023释放行位置信息对象占用的内存。
8024
8025**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8026
8027**起始版本:** 12
8028
8029**参数:**
8030
8031| 名称 | 描述 |
8032| -------- | -------- |
8033| OH_Drawing_LineMetrics | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 |
8034
8035
8036### OH_Drawing_DestroySystemFontConfigInfo()
8037
8038```
8039void OH_Drawing_DestroySystemFontConfigInfo (OH_Drawing_FontConfigInfo* )
8040```
8041
8042**描述**
8043
8044释放系统字体配置信息占用的的内存。
8045
8046**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8047
8048**起始版本:** 12
8049
8050**参数:**
8051
8052| 名称 | 描述 |
8053| -------- | -------- |
8054| OH_Drawing_FontConfigInfo | 指向系统字体配置信息[OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md)的指针, 由[OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo)获取。 |
8055
8056
8057### OH_Drawing_DestroySystemFontList()
8058
8059```
8060void OH_Drawing_DestroySystemFontList (char** , size_t  )
8061```
8062
8063**描述**
8064
8065释放系统字体名称列表占用的内存。
8066
8067**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8068
8069**起始版本:** 12
8070
8071**参数:**
8072
8073| 名称 | 描述 |
8074| -------- | -------- |
8075| char\*\* | 指向系统字体名称列表的指针。 |
8076| size_t\* | 系统字体名称列表的数量。 |
8077
8078
8079### OH_Drawing_DestroyTextShadow()
8080
8081```
8082void OH_Drawing_DestroyTextShadow (OH_Drawing_TextShadow* )
8083```
8084
8085**描述**
8086
8087释放被字体阴影对象占据的内存。
8088
8089**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8090
8091**起始版本:** 12
8092
8093**参数:**
8094
8095| 名称 | 描述 |
8096| -------- | -------- |
8097| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 |
8098
8099
8100### OH_Drawing_DestroyTextShadows()
8101
8102```
8103void OH_Drawing_DestroyTextShadows (OH_Drawing_TextShadow* )
8104```
8105
8106**描述**
8107
8108释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。
8109
8110**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8111
8112**起始版本:** 12
8113
8114**参数:**
8115
8116| 名称 | 描述 |
8117| -------- | -------- |
8118| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 |
8119
8120
8121### OH_Drawing_DestroyTextStyle()
8122
8123```
8124void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle* )
8125```
8126
8127**描述**
8128
8129释放被OH_Drawing_TextStyle对象占据的内存。
8130
8131**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8132
8133**起始版本:** 8
8134
8135**参数:**
8136
8137| 名称 | 描述 |
8138| -------- | -------- |
8139| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
8140
8141
8142### OH_Drawing_DestroyTypography()
8143
8144```
8145void OH_Drawing_DestroyTypography (OH_Drawing_Typography* )
8146```
8147
8148**描述**
8149
8150释放OH_Drawing_Typography对象占据的内存。
8151
8152**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8153
8154**起始版本:** 8
8155
8156**参数:**
8157
8158| 名称 | 描述 |
8159| -------- | -------- |
8160| OH_Drawing_Typography | 指向[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
8161
8162
8163### OH_Drawing_DestroyTypographyHandler()
8164
8165```
8166void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate* )
8167```
8168
8169**描述**
8170
8171释放被OH_Drawing_TypographyCreate对象占据的内存。
8172
8173**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8174
8175**起始版本:** 8
8176
8177**参数:**
8178
8179| 名称 | 描述 |
8180| -------- | -------- |
8181| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
8182
8183
8184### OH_Drawing_DestroyTypographyStyle()
8185
8186```
8187void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle* )
8188```
8189
8190**描述**
8191
8192释放被OH_Drawing_TypographyStyle对象占据的内存。
8193
8194**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8195
8196**起始版本:** 8
8197
8198**参数:**
8199
8200| 名称 | 描述 |
8201| -------- | -------- |
8202| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
8203
8204
8205### OH_Drawing_DisableFontCollectionFallback()
8206
8207```
8208void OH_Drawing_DisableFontCollectionFallback (OH_Drawing_FontCollection* fontCollection)
8209```
8210
8211**描述**
8212
8213禁用备用字体。
8214
8215**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8216
8217**起始版本:** 12
8218
8219**参数:**
8220
8221| 名称 | 描述 |
8222| -------- | -------- |
8223| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 |
8224
8225
8226### OH_Drawing_DisableFontCollectionSystemFont()
8227
8228```
8229void OH_Drawing_DisableFontCollectionSystemFont (OH_Drawing_FontCollection* fontCollection)
8230```
8231
8232**描述**
8233
8234禁用系统字体。
8235
8236**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8237
8238**起始版本:** 12
8239
8240**参数:**
8241
8242| 名称 | 描述 |
8243| -------- | -------- |
8244| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 |
8245
8246
8247### OH_Drawing_FilterCreate()
8248
8249```
8250OH_Drawing_Filter* OH_Drawing_FilterCreate (void )
8251```
8252
8253**描述**
8254
8255创建一个滤波器对象。
8256
8257**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8258
8259**起始版本:** 11
8260
8261**返回:**
8262
8263返回创建的滤波器对象的指针。
8264
8265
8266### OH_Drawing_FilterDestroy()
8267
8268```
8269void OH_Drawing_FilterDestroy (OH_Drawing_Filter* )
8270```
8271
8272**描述**
8273
8274销毁滤波器对象,并收回该对象占用的内存。
8275
8276**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8277
8278**起始版本:** 11
8279
8280**参数:**
8281
8282| 名称 | 描述 |
8283| -------- | -------- |
8284| OH_Drawing_Filter | 指示指向滤波器对象的指针。 |
8285
8286
8287### OH_Drawing_FilterGetColorFilter()
8288
8289```
8290void OH_Drawing_FilterGetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter*  )
8291```
8292
8293**描述**
8294
8295从滤波器对象获取颜色滤波器对象。
8296
8297本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8298
8299OH_Drawing_Filter、OH_Drawing_ColorFilter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8300
8301**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8302
8303**起始版本:** 12
8304
8305**参数:**
8306
8307| 名称 | 描述 |
8308| -------- | -------- |
8309| OH_Drawing_Filter | 指示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 |
8310| OH_Drawing_ColorFilter | 指示指向颜色滤波器对象[OH_Drawing_ColorFilter](#oh_drawing_colorfilter)的指针。 |
8311
8312
8313### OH_Drawing_FilterSetColorFilter()
8314
8315```
8316void OH_Drawing_FilterSetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter*  )
8317```
8318
8319**描述**
8320
8321为滤波器对象设置颜色滤波器对象。
8322
8323本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8324
8325OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8326
8327**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8328
8329**起始版本:** 11
8330
8331**参数:**
8332
8333| 名称 | 描述 |
8334| -------- | -------- |
8335| OH_Drawing_Filter | 指示指向滤波器对象的指针。 |
8336| OH_Drawing_ColorFilter | 指示指向颜色滤波器对象的指针,为NULL表示清空滤波器对象中的颜色滤波器效果。 |
8337
8338
8339### OH_Drawing_FilterSetMaskFilter()
8340
8341```
8342void OH_Drawing_FilterSetMaskFilter (OH_Drawing_Filter* , OH_Drawing_MaskFilter*  )
8343```
8344
8345**描述**
8346
8347为滤波器对象设置蒙版滤波器对象。
8348
8349本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8350
8351OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8352
8353**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8354
8355**起始版本:** 11
8356
8357**参数:**
8358
8359| 名称 | 描述 |
8360| -------- | -------- |
8361| OH_Drawing_Filter | 指示指向滤波器对象的指针。 |
8362| OH_Drawing_MaskFilter | 指示指向蒙版滤波器对象的指针,为NULL表示清空滤波器对象中的蒙版滤波器效果。 |
8363
8364
8365### OH_Drawing_FontCountText()
8366
8367```
8368int OH_Drawing_FontCountText (OH_Drawing_Font* , const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding )
8369```
8370
8371**描述**
8372
8373获取文本所表示的字符数量。
8374
8375本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8376
8377OH_Drawing_Font、text任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8378
8379**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8380
8381**起始版本:** 12
8382
8383**参数:**
8384
8385| 名称 | 描述 |
8386| -------- | -------- |
8387| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
8388| text | 文本存储首地址。 |
8389| byteLength | 文本长度,单位为字节。 |
8390| encoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 |
8391
8392
8393### OH_Drawing_FontCreate()
8394
8395```
8396OH_Drawing_Font* OH_Drawing_FontCreate (void )
8397```
8398
8399**描述**
8400
8401用于创建一个字体对象。
8402
8403**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8404
8405**起始版本:** 11
8406
8407**返回:**
8408
8409函数会返回一个指针,指针指向创建的字体对象。
8410
8411
8412### OH_Drawing_FontDestroy()
8413
8414```
8415void OH_Drawing_FontDestroy (OH_Drawing_Font* )
8416```
8417
8418**描述**
8419
8420用于销毁字体对象并回收该对象占有的内存。
8421
8422**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8423
8424**起始版本:** 11
8425
8426**参数:**
8427
8428| 名称 | 描述 |
8429| -------- | -------- |
8430| OH_Drawing_Font | 指向字体对象的指针。 |
8431
8432
8433### OH_Drawing_FontGetMetrics()
8434
8435```
8436float OH_Drawing_FontGetMetrics (OH_Drawing_Font* , OH_Drawing_Font_Metrics*  )
8437```
8438
8439**描述**
8440
8441获取字体度量信息。
8442
8443本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8444
8445OH_Drawing_Font、OH_Drawing_Font_Metrics任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8446
8447**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8448
8449**起始版本:** 12
8450
8451**参数:**
8452
8453| 名称 | 描述 |
8454| -------- | -------- |
8455| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
8456| OH_Drawing_Font_Metrics | 指向字体度量信息对象[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)的指针。 |
8457
8458**返回:**
8459
8460函数返回一个浮点数变量,表示建议的行间距。
8461
8462
8463### OH_Drawing_FontGetTypeface()
8464
8465```
8466OH_Drawing_Typeface* OH_Drawing_FontGetTypeface (OH_Drawing_Font* )
8467```
8468
8469**描述**
8470
8471获取字体对象。
8472
8473本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8474
8475OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8476
8477**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8478
8479**起始版本:** 12
8480
8481**参数:**
8482
8483| 名称 | 描述 |
8484| -------- | -------- |
8485| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
8486
8487**返回:**
8488
8489OH_Drawing_Typeface 函数返回一个指针,指字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
8490
8491
8492### OH_Drawing_FontMgrCreate()
8493
8494```
8495OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate (void )
8496```
8497
8498**描述**
8499
8500构造字体管理对象。
8501
8502**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8503
8504**起始版本:** 12
8505
8506**返回:**
8507
8508返回指向已创建的字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针。
8509
8510
8511### OH_Drawing_FontMgrCreateFontStyleSet()
8512
8513```
8514OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet (OH_Drawing_FontMgr* , int index )
8515```
8516
8517**描述**
8518
8519由字体管理对象构造字体样式集对象。
8520
8521**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8522
8523**起始版本:** 12
8524
8525**参数:**
8526
8527| 名称 | 描述 |
8528| -------- | -------- |
8529| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
8530| index | 用于从字体管理对象获取字体样式集对象的索引值。 |
8531
8532**返回:**
8533
8534返回指向已创建的字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。
8535
8536
8537### OH_Drawing_FontMgrDestroy()
8538
8539```
8540void OH_Drawing_FontMgrDestroy (OH_Drawing_FontMgr* )
8541```
8542
8543**描述**
8544
8545释放字体管理对象占用的内存。
8546
8547**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8548
8549**起始版本:** 12
8550
8551**参数:**
8552
8553| 名称 | 描述 |
8554| -------- | -------- |
8555| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
8556
8557
8558### OH_Drawing_FontMgrDestroyFamilyName()
8559
8560```
8561void OH_Drawing_FontMgrDestroyFamilyName (char* familyName)
8562```
8563
8564**描述**
8565
8566释放指定字体家族名称占用的内存。
8567
8568**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8569
8570**起始版本:** 12
8571
8572**参数:**
8573
8574| 名称 | 描述 |
8575| -------- | -------- |
8576| familyName | 指定字体家族名称数组。 |
8577
8578
8579### OH_Drawing_FontMgrDestroyFontStyleSet()
8580
8581```
8582void OH_Drawing_FontMgrDestroyFontStyleSet (OH_Drawing_FontStyleSet* )
8583```
8584
8585**描述**
8586
8587释放字体样式集对象占用的内存。
8588
8589**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8590
8591**起始版本:** 12
8592
8593**参数:**
8594
8595| 名称 | 描述 |
8596| -------- | -------- |
8597| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
8598
8599
8600### OH_Drawing_FontMgrGetFamilyCount()
8601
8602```
8603int OH_Drawing_FontMgrGetFamilyCount (OH_Drawing_FontMgr* )
8604```
8605
8606**描述**
8607
8608获取字体家族的数量。
8609
8610**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8611
8612**起始版本:** 12
8613
8614**参数:**
8615
8616| 名称 | 描述 |
8617| -------- | -------- |
8618| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
8619
8620**返回:**
8621
8622返回字体家族的数量。
8623
8624
8625### OH_Drawing_FontMgrGetFamilyName()
8626
8627```
8628char* OH_Drawing_FontMgrGetFamilyName (OH_Drawing_FontMgr* , int index )
8629```
8630
8631**描述**
8632
8633由索引值获取字体家族名称。
8634
8635**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8636
8637**起始版本:** 12
8638
8639**参数:**
8640
8641| 名称 | 描述 |
8642| -------- | -------- |
8643| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
8644| index | 用于获取对应字体家族名称的索引值。 |
8645
8646**返回:**
8647
8648返回索引值对应的字体家族名称。
8649
8650
8651### OH_Drawing_FontMgrMatchFamily()
8652
8653```
8654OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily (OH_Drawing_FontMgr* , const char* familyName )
8655```
8656
8657**描述**
8658
8659由指定的字体家族名称,获取字体样式集对象。
8660
8661**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8662
8663**起始版本:** 12
8664
8665**参数:**
8666
8667| 名称 | 描述 |
8668| -------- | -------- |
8669| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
8670| familyName | 指定的字体家族名称。 |
8671
8672**返回:**
8673
8674返回对应的字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)。
8675
8676
8677### OH_Drawing_FontMgrMatchFamilyStyle()
8678
8679```
8680OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct  )
8681```
8682
8683**描述**
8684
8685根据指定的字体样式信息和字体家族名称,获取字型对象。
8686
8687**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8688
8689**起始版本:** 12
8690
8691**参数:**
8692
8693| 名称 | 描述 |
8694| -------- | -------- |
8695| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
8696| familyName | 指定的字体家族名称。 |
8697| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 |
8698
8699**返回:**
8700
8701返回对应的字体样式的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
8702
8703
8704### OH_Drawing_FontMgrMatchFamilyStyleCharacter()
8705
8706```
8707OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct , const char* bcp47[], int bcp47Count, int32_t character )
8708```
8709
8710**描述**
8711
8712为指定字符获取字型对象,仅在传入字体管理对象中无法找到传入UTF8字符值对应的字型对象时返回空指针。
8713
8714**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8715
8716**起始版本:** 12
8717
8718**参数:**
8719
8720| 名称 | 描述 |
8721| -------- | -------- |
8722| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
8723| familyName | 指定的字体家族名称。 |
8724| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 |
8725| bcp47 | 用来指示character语言编码数组,是ISO 639、15924和3166-1语言编码的组合。 |
8726| bcp47Count | 参数bcp47数组大小。 |
8727| character | 待匹配的UTF8字符值。 |
8728
8729**返回:**
8730
8731返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
8732
8733
8734### OH_Drawing_FontParserGetFontByName()
8735
8736```
8737OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName (OH_Drawing_FontParser* , const char*  )
8738```
8739
8740**描述**
8741
8742根据传入的系统字体名称获取系统字体的相关信息。
8743
8744**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8745
8746**起始版本:** 12
8747
8748**参数:**
8749
8750| 名称 | 描述 |
8751| -------- | -------- |
8752| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 |
8753| char\* | 系统字体名。 |
8754
8755**返回:**
8756
8757返回系统字体。
8758
8759
8760### OH_Drawing_FontParserGetSystemFontList()
8761
8762```
8763char** OH_Drawing_FontParserGetSystemFontList (OH_Drawing_FontParser* , size_t*  )
8764```
8765
8766**描述**
8767
8768获取系统字体名称列表,此接口仅在2in1设备上可用。
8769
8770**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8771
8772**起始版本:** 12
8773
8774**参数:**
8775
8776| 名称 | 描述 |
8777| -------- | -------- |
8778| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 |
8779| size_t | 返回获取到的系统字体名称数量。 |
8780
8781**返回:**
8782
8783返回获取到的系统字体列表。
8784
8785
8786### OH_Drawing_FontSetFakeBoldText()
8787
8788```
8789void OH_Drawing_FontSetFakeBoldText (OH_Drawing_Font* , bool isFakeBoldText )
8790```
8791
8792**描述**
8793
8794用于设置增加描边宽度以近似粗体字体效果。
8795
8796本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8797
8798OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8799
8800**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8801
8802**起始版本:** 11
8803
8804**参数:**
8805
8806| 名称 | 描述 |
8807| -------- | -------- |
8808| OH_Drawing_Font | 指向字体对象的指针。 |
8809| isFakeBoldText | 真为使能增加描边宽度,假为不使能。 |
8810
8811
8812### OH_Drawing_FontSetLinearText()
8813
8814```
8815void OH_Drawing_FontSetLinearText (OH_Drawing_Font* , bool isLinearText )
8816```
8817
8818**描述**
8819
8820用于设置线性可缩放字体。
8821
8822本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8823
8824OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8825
8826**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8827
8828**起始版本:** 11
8829
8830**参数:**
8831
8832| 名称 | 描述 |
8833| -------- | -------- |
8834| OH_Drawing_Font | 指向字体对象的指针。 |
8835| isLinearText | 真为使能线性可缩放字体,假为不使能。 |
8836
8837
8838### OH_Drawing_FontSetTextSize()
8839
8840```
8841void OH_Drawing_FontSetTextSize (OH_Drawing_Font* , float textSize )
8842```
8843
8844**描述**
8845
8846用于给字体设置文字大小。
8847
8848本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8849
8850OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8851
8852**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8853
8854**起始版本:** 11
8855
8856**参数:**
8857
8858| 名称 | 描述 |
8859| -------- | -------- |
8860| OH_Drawing_Font | 指向字体对象的指针。 |
8861| textSize | 字体大小,该参数为浮点数,为负数时字体大小会被置为0。字体大小为0时,绘制的文字不会显示。 |
8862
8863
8864### OH_Drawing_FontSetTextSkewX()
8865
8866```
8867void OH_Drawing_FontSetTextSkewX (OH_Drawing_Font* , float skewX )
8868```
8869
8870**描述**
8871
8872用于给字体设置文本倾斜。
8873
8874本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8875
8876OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8877
8878**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8879
8880**起始版本:** 11
8881
8882**参数:**
8883
8884| 名称 | 描述 |
8885| -------- | -------- |
8886| OH_Drawing_Font | 指向字体对象的指针。 |
8887| skewX | X轴相对于Y轴的倾斜度。 |
8888
8889
8890### OH_Drawing_FontSetTypeface()
8891
8892```
8893void OH_Drawing_FontSetTypeface (OH_Drawing_Font* , OH_Drawing_Typeface*  )
8894```
8895
8896**描述**
8897
8898用于给字型设置字体。
8899
8900本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8901
8902OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8903
8904**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8905
8906**起始版本:** 11
8907
8908**参数:**
8909
8910| 名称 | 描述 |
8911| -------- | -------- |
8912| OH_Drawing_Font | 指向字型对象的指针。 |
8913| OH_Drawing_Typeface | 指向字体对象的指针,为NULL会使用系统默认字体对象。 |
8914
8915
8916### OH_Drawing_FontStyleSetCount()
8917
8918```
8919int OH_Drawing_FontStyleSetCount (OH_Drawing_FontStyleSet* )
8920```
8921
8922**描述**
8923
8924获取字体样式集中字体的个数。
8925
8926**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8927
8928**起始版本:** 12
8929
8930**参数:**
8931
8932| 名称 | 描述 |
8933| -------- | -------- |
8934| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
8935
8936**返回:**
8937
8938返回此字体样式集中字体的个数。
8939
8940
8941### OH_Drawing_FontStyleSetCreateTypeface()
8942
8943```
8944OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface (OH_Drawing_FontStyleSet* , int index )
8945```
8946
8947**描述**
8948
8949为指定索引获取字型对象。
8950
8951**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8952
8953**起始版本:** 12
8954
8955**参数:**
8956
8957| 名称 | 描述 |
8958| -------- | -------- |
8959| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
8960| index | 指定的字型对象的索引。 |
8961
8962**返回:**
8963
8964如果成功,返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface); 如果失败,返回nullptr。
8965
8966
8967### OH_Drawing_FontStyleSetFreeStyleName()
8968
8969```
8970void OH_Drawing_FontStyleSetFreeStyleName (char** styleName)
8971```
8972
8973**描述**
8974
8975释放指定字体样式的内存。
8976
8977**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8978
8979**起始版本:** 12
8980
8981**参数:**
8982
8983| 名称 | 描述 |
8984| -------- | -------- |
8985| styleName | 指定字体样式名称的字符串。 |
8986
8987
8988### OH_Drawing_FontStyleSetGetStyle()
8989
8990```
8991OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle (OH_Drawing_FontStyleSet* , int32_t index, char** styleName )
8992```
8993
8994**描述**
8995
8996获取字体样式。
8997
8998**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8999
9000**起始版本:** 12
9001
9002**参数:**
9003
9004| 名称 | 描述 |
9005| -------- | -------- |
9006| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
9007| index | 指定的字体样式的索引。 |
9008| styleName | 指定字体样式名称的字符串。 |
9009
9010**返回:**
9011
9012返回对应的字体样式。
9013
9014
9015### OH_Drawing_FontStyleSetMatchStyle()
9016
9017```
9018OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle (OH_Drawing_FontStyleSet* , OH_Drawing_FontStyleStruct fontStyleStruct )
9019```
9020
9021**描述**
9022
9023获取最接近字体样式的字型对象。
9024
9025**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9026
9027**起始版本:** 12
9028
9029**参数:**
9030
9031| 名称 | 描述 |
9032| -------- | -------- |
9033| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
9034| fontStyleStruct | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 |
9035
9036**返回:**
9037
9038返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
9039
9040
9041### OH_Drawing_GetAffinityFromPositionAndAffinity()
9042
9043```
9044int OH_Drawing_GetAffinityFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* )
9045```
9046
9047**描述**
9048
9049获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本。
9050
9051**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9052
9053**起始版本:** 11
9054
9055**参数:**
9056
9057| 名称 | 描述 |
9058| -------- | -------- |
9059| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针, 由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或 [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。 |
9060
9061**返回:**
9062
9063返回OH_Drawing_PositionAndAffinity对象的亲和性。
9064
9065
9066### OH_Drawing_GetBottomFromTextBox()
9067
9068```
9069float OH_Drawing_GetBottomFromTextBox (OH_Drawing_TextBox* , int  )
9070```
9071
9072**描述**
9073
9074获取文本框底部位置。
9075
9076**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9077
9078**起始版本:** 11
9079
9080**参数:**
9081
9082| 名称 | 描述 |
9083| -------- | -------- |
9084| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
9085| int | 文本框的索引。 |
9086
9087**返回:**
9088
9089返回文本框底部位置。
9090
9091
9092### OH_Drawing_GetEndFromRange()
9093
9094```
9095size_t OH_Drawing_GetEndFromRange (OH_Drawing_Range* )
9096```
9097
9098**描述**
9099
9100获取OH_Drawing_Range对象结束位置。
9101
9102**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9103
9104**起始版本:** 11
9105
9106**参数:**
9107
9108| 名称 | 描述 |
9109| -------- | -------- |
9110| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 |
9111
9112**返回:**
9113
9114返回OH_Drawing_Range对象结束位置。
9115
9116
9117### OH_Drawing_GetLeftFromTextBox()
9118
9119```
9120float OH_Drawing_GetLeftFromTextBox (OH_Drawing_TextBox* , int  )
9121```
9122
9123**描述**
9124
9125获取文本框左侧位置。
9126
9127**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9128
9129**起始版本:** 11
9130
9131**参数:**
9132
9133| 名称 | 描述 |
9134| -------- | -------- |
9135| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
9136| int | 文本框的索引。 |
9137
9138**返回:**
9139
9140返回文本框左侧位置。
9141
9142
9143### OH_Drawing_GetPositionFromPositionAndAffinity()
9144
9145```
9146size_t OH_Drawing_GetPositionFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* )
9147```
9148
9149**描述**
9150
9151获取OH_Drawing_PositionAndAffinity对象的位置属性。
9152
9153**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9154
9155**起始版本:** 11
9156
9157**参数:**
9158
9159| 名称 | 描述 |
9160| -------- | -------- |
9161| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针, 由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或 [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。 |
9162
9163**返回:**
9164
9165返回OH_Drawing_PositionAndAffinity对象的位置属性。
9166
9167
9168### OH_Drawing_GetRightFromTextBox()
9169
9170```
9171float OH_Drawing_GetRightFromTextBox (OH_Drawing_TextBox* , int  )
9172```
9173
9174**描述**
9175
9176获取文本框右侧位置。
9177
9178**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9179
9180**起始版本:** 11
9181
9182**参数:**
9183
9184| 名称 | 描述 |
9185| -------- | -------- |
9186| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
9187| int | 文本框的索引。 |
9188
9189**返回:**
9190
9191返回文本框右侧位置。
9192
9193
9194### OH_Drawing_GetSizeOfTextBox()
9195
9196```
9197size_t OH_Drawing_GetSizeOfTextBox (OH_Drawing_TextBox* )
9198```
9199
9200**描述**
9201
9202获取文本框数量大小。
9203
9204**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9205
9206**起始版本:** 11
9207
9208**参数:**
9209
9210| 名称 | 描述 |
9211| -------- | -------- |
9212| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
9213
9214**返回:**
9215
9216返回文本框数量大小。
9217
9218
9219### OH_Drawing_GetStartFromRange()
9220
9221```
9222size_t OH_Drawing_GetStartFromRange (OH_Drawing_Range* )
9223```
9224
9225**描述**
9226
9227获取OH_Drawing_Range对象开始位置。
9228
9229**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9230
9231**起始版本:** 11
9232
9233**参数:**
9234
9235| 名称 | 描述 |
9236| -------- | -------- |
9237| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 |
9238
9239**返回:**
9240
9241返回OH_Drawing_Range对象开始位置。
9242
9243
9244### OH_Drawing_GetSystemFontConfigInfo()
9245
9246```
9247OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo (OH_Drawing_FontConfigInfoErrorCode* )
9248```
9249
9250**描述**
9251
9252获取系统字体配置信息。
9253
9254**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9255
9256**起始版本:** 12
9257
9258**参数:**
9259
9260| 名称 | 描述 |
9261| -------- | -------- |
9262| OH_Drawing_FontConfigJsonInfoCode | 错误码,具体可见[OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode)枚举。 |
9263
9264**返回:**
9265
9266返回系统字体配置信息的指针。
9267
9268
9269### OH_Drawing_GetTextDirectionFromTextBox()
9270
9271```
9272int OH_Drawing_GetTextDirectionFromTextBox (OH_Drawing_TextBox* , int  )
9273```
9274
9275**描述**
9276
9277获取文本框方向。
9278
9279**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9280
9281**起始版本:** 11
9282
9283**参数:**
9284
9285| 名称 | 描述 |
9286| -------- | -------- |
9287| OH_Drawing_TextBox | 指向[OH_Drawing_TextBox](#oh_drawing_textbox)对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
9288| int | 文本框的索引。 |
9289
9290**返回:**
9291
9292返回文本框方向。
9293
9294
9295### OH_Drawing_GetTopFromTextBox()
9296
9297```
9298float OH_Drawing_GetTopFromTextBox (OH_Drawing_TextBox* , int  )
9299```
9300
9301**描述**
9302
9303获取文本框顶部位置。
9304
9305**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9306
9307**起始版本:** 11
9308
9309**参数:**
9310
9311| 名称 | 描述 |
9312| -------- | -------- |
9313| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
9314| int | 文本框的索引。 |
9315
9316**返回:**
9317
9318返回文本框顶部位置。
9319
9320
9321### OH_Drawing_GpuContextCreateFromGL()
9322
9323```
9324OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL (OH_Drawing_GpuContextOptions )
9325```
9326
9327**描述**
9328
9329用于创建一个使用OpenGL作为后端接口的图形处理器上下文对象。
9330
9331**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9332
9333**起始版本:** 12
9334
9335**参数:**
9336
9337| 名称 | 描述 |
9338| -------- | -------- |
9339| OH_Drawing_GpuContextOptions | 图形处理器上下文选项[OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)。 |
9340
9341**返回:**
9342
9343返回一个指针,指针指向创建的图形处理器上下文对象[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。
9344
9345
9346### OH_Drawing_GpuContextDestroy()
9347
9348```
9349void OH_Drawing_GpuContextDestroy (OH_Drawing_GpuContext* )
9350```
9351
9352**描述**
9353
9354用于销毁图形处理器上下文对象并回收该对象占用的内存。
9355
9356**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9357
9358**起始版本:** 12
9359
9360**参数:**
9361
9362| 名称 | 描述 |
9363| -------- | -------- |
9364| OH_Drawing_GpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 |
9365
9366
9367### OH_Drawing_ImageBuildFromBitmap()
9368
9369```
9370bool OH_Drawing_ImageBuildFromBitmap (OH_Drawing_Image* , OH_Drawing_Bitmap*  )
9371```
9372
9373**描述**
9374
9375从位图构造图片对象内容,共享或复制位图像素。如果位图被标记为不可变状态, 像素内存是共享的,不是复制。
9376
9377本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9378
9379OH_Drawing_Image、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9380
9381**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9382
9383**起始版本:** 12
9384
9385**参数:**
9386
9387| 名称 | 描述 |
9388| -------- | -------- |
9389| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
9390| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
9391
9392**返回:**
9393
9394函数返回true表示构造图片内容成功,函数返回false表示构建图片内容失败。
9395
9396
9397### OH_Drawing_ImageCreate()
9398
9399```
9400OH_Drawing_Image* OH_Drawing_ImageCreate (void )
9401```
9402
9403**描述**
9404
9405创建一个图片对象,描述了要绘制的二维像素数组。
9406
9407**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9408
9409**起始版本:** 12
9410
9411**返回:**
9412
9413函数返回一个指针,指针指向创建的图片对象[OH_Drawing_Image](#oh_drawing_image)。
9414
9415
9416### OH_Drawing_ImageDestroy()
9417
9418```
9419void OH_Drawing_ImageDestroy (OH_Drawing_Image* )
9420```
9421
9422**描述**
9423
9424销毁图片对象并回收该对象占有内存。
9425
9426**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9427
9428**起始版本:** 12
9429
9430**参数:**
9431
9432| 名称 | 描述 |
9433| -------- | -------- |
9434| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
9435
9436
9437### OH_Drawing_ImageGetHeight()
9438
9439```
9440int32_t OH_Drawing_ImageGetHeight (OH_Drawing_Image* )
9441```
9442
9443**描述**
9444
9445获取图片高度,即像素行数。
9446
9447本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9448
9449OH_Drawing_Image为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9450
9451**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9452
9453**起始版本:** 12
9454
9455**参数:**
9456
9457| 名称 | 描述 |
9458| -------- | -------- |
9459| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
9460
9461**返回:**
9462
9463函数返回图片高度。
9464
9465
9466### OH_Drawing_ImageGetImageInfo()
9467
9468```
9469void OH_Drawing_ImageGetImageInfo (OH_Drawing_Image* , OH_Drawing_Image_Info*  )
9470```
9471
9472**描述**
9473
9474获取图片信息。调用该接口后,传入的图片信息对象被填充。
9475
9476本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9477
9478OH_Drawing_Image、OH_Drawing_Image_Info任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9479
9480**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9481
9482**起始版本:** 12
9483
9484**参数:**
9485
9486| 名称 | 描述 |
9487| -------- | -------- |
9488| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
9489| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针, 开发者可调用[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)创建。 |
9490
9491
9492### OH_Drawing_ImageGetWidth()
9493
9494```
9495int32_t OH_Drawing_ImageGetWidth (OH_Drawing_Image* )
9496```
9497
9498**描述**
9499
9500获取图片宽度,即每行的像素个数。
9501
9502本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9503
9504OH_Drawing_Image为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9505
9506**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9507
9508**起始版本:** 12
9509
9510**参数:**
9511
9512| 名称 | 描述 |
9513| -------- | -------- |
9514| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
9515
9516**返回:**
9517
9518函数返回图片宽度。
9519
9520
9521### OH_Drawing_LineMetricsGetSize()
9522
9523```
9524size_t OH_Drawing_LineMetricsGetSize (OH_Drawing_LineMetrics* )
9525```
9526
9527**描述**
9528
9529获取行数量。
9530
9531**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9532
9533**起始版本:** 12
9534
9535**参数:**
9536
9537| 名称 | 描述 |
9538| -------- | -------- |
9539| [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)获取。 |
9540
9541**返回:**
9542
9543返回行数量。
9544
9545
9546### OH_Drawing_MaskFilterCreateBlur()
9547
9548```
9549OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur (OH_Drawing_BlurType blurType, float sigma, bool respectCTM )
9550```
9551
9552**描述**
9553
9554创建具有模糊效果的蒙版滤波器。
9555
9556**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9557
9558**起始版本:** 11
9559
9560**参数:**
9561
9562| 名称 | 描述 |
9563| -------- | -------- |
9564| blurType | 表示模糊类型。 |
9565| sigma | 表示要应用的高斯模糊的标准偏差。必须大于0。 |
9566| respectCTM | 表示模糊标准差值被CTM修改,默认为真。 |
9567
9568**返回:**
9569
9570返回创建的蒙版滤波器对象的指针。
9571
9572
9573### OH_Drawing_MaskFilterDestroy()
9574
9575```
9576void OH_Drawing_MaskFilterDestroy (OH_Drawing_MaskFilter* )
9577```
9578
9579**描述**
9580
9581销毁蒙版滤波器对象,并收回该对象占用的内存。
9582
9583**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9584
9585**起始版本:** 11
9586
9587**参数:**
9588
9589| 名称 | 描述 |
9590| -------- | -------- |
9591| OH_Drawing_MaskFilter | 表示指向蒙版滤波器对象的指针。 |
9592
9593
9594### OH_Drawing_MatrixConcat()
9595
9596```
9597void OH_Drawing_MatrixConcat (OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, const OH_Drawing_Matrix* b )
9598```
9599
9600**描述**
9601
9602将矩阵total设置为矩阵a乘以矩阵b。
9603
9604本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9605
9606total、a、b任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9607
9608**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9609
9610**起始版本:** 12
9611
9612**参数:**
9613
9614| 名称 | 描述 |
9615| -------- | -------- |
9616| total | 指向最终的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9617| a | 指向矩阵对象a[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9618| b | 指向矩阵对象b[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9619
9620
9621### OH_Drawing_MatrixCreate()
9622
9623```
9624OH_Drawing_Matrix* OH_Drawing_MatrixCreate (void )
9625```
9626
9627**描述**
9628
9629用于创建一个矩阵对象。
9630
9631**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9632
9633**起始版本:** 11
9634
9635**返回:**
9636
9637函数会返回一个指针,指针指向创建的矩阵对象。
9638
9639
9640### OH_Drawing_MatrixCreateRotation()
9641
9642```
9643OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation (float deg, float x, float y )
9644```
9645
9646**描述**
9647
9648创建一个带旋转属性的矩阵对象。 该矩阵对象为:单位矩阵在(x, y)旋转点以度为单位进行旋转后得到的矩阵。
9649
9650**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9651
9652**起始版本:** 12
9653
9654**参数:**
9655
9656| 名称 | 描述 |
9657| -------- | -------- |
9658| deg | 旋转的角度,单位为度。正数表示按顺时针旋转,负数表示按逆时针旋转。 |
9659| x | x轴上坐标点。 |
9660| y | y轴上坐标点。 |
9661
9662**返回:**
9663
9664函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。
9665
9666
9667### OH_Drawing_MatrixCreateScale()
9668
9669```
9670OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale (float sx, float sy, float px, float py )
9671```
9672
9673**描述**
9674
9675创建一个带缩放属性的矩阵对象。 该矩阵对象为:单位矩阵在(px, py)旋转点以sx和sy为缩放因子进行缩放后得到的矩阵。
9676
9677**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9678
9679**起始版本:** 12
9680
9681**参数:**
9682
9683| 名称 | 描述 |
9684| -------- | -------- |
9685| sx | x轴方向缩放系数,为负数时可看作是先关于y = px作镜像翻转后再进行缩放,该参数为浮点数。 |
9686| sy | y轴方向缩放系数,为负数时可看作是先关于x = py作镜像翻转后再进行缩放,该参数为浮点数。 |
9687| px | x轴上坐标点。 |
9688| py | y轴上坐标点。 |
9689
9690**返回:**
9691
9692函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。
9693
9694
9695### OH_Drawing_MatrixCreateTranslation()
9696
9697```
9698OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation (float dx, float dy )
9699```
9700
9701**描述**
9702
9703创建一个带平移属性的矩阵对象。 该矩阵对象为:单位矩阵平移(dx, dy)后得到的矩阵。
9704
9705**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9706
9707**起始版本:** 12
9708
9709**参数:**
9710
9711| 名称 | 描述 |
9712| -------- | -------- |
9713| dx | 水平方向平移距离,正数表示往x轴正方向平移,负数表示往x轴负方向平移,该参数为浮点数。 |
9714| dy | 垂直方向平移距离,正数表示往y轴正方向平移,负数表示往y轴负方向平移,该参数为浮点数。 |
9715
9716**返回:**
9717
9718函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。
9719
9720
9721### OH_Drawing_MatrixDestroy()
9722
9723```
9724void OH_Drawing_MatrixDestroy (OH_Drawing_Matrix* )
9725```
9726
9727**描述**
9728
9729用于销毁矩阵对象并回收该对象占有的内存。
9730
9731**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9732
9733**起始版本:** 11
9734
9735**参数:**
9736
9737| 名称 | 描述 |
9738| -------- | -------- |
9739| OH_Drawing_Matrix | 指向字体对象的指针。 |
9740
9741
9742### OH_Drawing_MatrixGetValue()
9743
9744```
9745float OH_Drawing_MatrixGetValue (OH_Drawing_Matrix* , int index )
9746```
9747
9748**描述**
9749
9750获取矩阵给定索引位的值。索引范围0-8。
9751
9752本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9753
9754OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
9755
9756index小于0或者大于8时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
9757
9758**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9759
9760**起始版本:** 12
9761
9762**参数:**
9763
9764| 名称 | 描述 |
9765| -------- | -------- |
9766| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9767| index | 索引位置,范围0-8。 |
9768
9769**返回:**
9770
9771函数返回矩阵给定索引位对应的值。
9772
9773
9774### OH_Drawing_MatrixInvert()
9775
9776```
9777bool OH_Drawing_MatrixInvert (OH_Drawing_Matrix* , OH_Drawing_Matrix* inverse )
9778```
9779
9780**描述**
9781
9782将矩阵inverse设置为矩阵的倒数,并返回结果。
9783
9784本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9785
9786OH_Drawing_Matrix、inverse任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9787
9788**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9789
9790**起始版本:** 12
9791
9792**参数:**
9793
9794| 名称 | 描述 |
9795| -------- | -------- |
9796| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9797| inverse | 指向逆矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 |
9798
9799**返回:**
9800
9801函数返回true表示矩阵可逆,inverse被填充为逆矩阵;函数返回false表示矩阵不可逆,inverse不被改变。
9802
9803
9804### OH_Drawing_MatrixIsEqual()
9805
9806```
9807bool OH_Drawing_MatrixIsEqual (OH_Drawing_Matrix* , OH_Drawing_Matrix* other )
9808```
9809
9810**描述**
9811
9812判断两个矩阵是否相等。
9813
9814本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9815
9816OH_Drawing_Matrix、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9817
9818**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9819
9820**起始版本:** 12
9821
9822**参数:**
9823
9824| 名称 | 描述 |
9825| -------- | -------- |
9826| OH_Drawing_Matrix | 指向用于判断的其中一个矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9827| other | 指向用于判断的另一个矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9828
9829**返回:**
9830
9831函数返回两个矩阵的比较结果,返回true表示两个矩阵相等,返回false表示两个矩阵不相等。
9832
9833
9834### OH_Drawing_MatrixIsIdentity()
9835
9836```
9837bool OH_Drawing_MatrixIsIdentity (OH_Drawing_Matrix* )
9838```
9839
9840**描述**
9841
9842判断矩阵是否是单位矩阵。
9843
9844本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9845
9846OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9847
9848**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9849
9850**起始版本:** 12
9851
9852**参数:**
9853
9854| 名称 | 描述 |
9855| -------- | -------- |
9856| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9857
9858**返回:**
9859
9860函数返回true表示矩阵是单位矩阵,函数返回false表示矩阵不是单位矩阵。
9861
9862
9863### OH_Drawing_MatrixPostRotate()
9864
9865```
9866void OH_Drawing_MatrixPostRotate (OH_Drawing_Matrix* , float degree, float px, float py )
9867```
9868
9869**描述**
9870
9871将矩阵设置为矩阵右乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。
9872
9873本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9874
9875OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9876
9877**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9878
9879**起始版本:** 12
9880
9881**参数:**
9882
9883| 名称 | 描述 |
9884| -------- | -------- |
9885| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9886| degree | 旋转角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 |
9887| px | 旋转中心点的横坐标。 |
9888| py | 旋转中心点的纵坐标。 |
9889
9890
9891### OH_Drawing_MatrixPostScale()
9892
9893```
9894void OH_Drawing_MatrixPostScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
9895```
9896
9897**描述**
9898
9899将矩阵设置为矩阵右乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。
9900
9901本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
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| sx | x轴方向的缩放比例因子,为负数时可看作是先关于y = px作镜像翻转后再进行缩放,该参数为浮点数。 |
9916| sy | y轴方向的缩放比例因子,为负数时可看作是先关于x = py作镜像翻转后再进行缩放,该参数为浮点数。 |
9917| px | 缩放中心点的横坐标。 |
9918| py | 缩放中心点的纵坐标。 |
9919
9920
9921### OH_Drawing_MatrixPostTranslate()
9922
9923```
9924void OH_Drawing_MatrixPostTranslate (OH_Drawing_Matrix* , float dx, float dy )
9925```
9926
9927**描述**
9928
9929将矩阵设置为矩阵右乘平移一定距离后的单位矩阵后得到的矩阵。
9930
9931本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9932
9933OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9934
9935
9936**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9937
9938**起始版本:** 12
9939
9940**参数:**
9941
9942| 名称 | 描述 |
9943| -------- | -------- |
9944| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9945| dx | 表示在x轴方向上的平移距离。 |
9946| dy | 表示在y轴方向上的平移距离。 |
9947
9948
9949### OH_Drawing_MatrixPreRotate()
9950
9951```
9952void OH_Drawing_MatrixPreRotate (OH_Drawing_Matrix* , float degree, float px, float py )
9953```
9954
9955**描述**
9956
9957将矩阵设置为矩阵左乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。
9958
9959本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9960
9961OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9962
9963
9964**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9965
9966**起始版本:** 12
9967
9968**参数:**
9969
9970| 名称 | 描述 |
9971| -------- | -------- |
9972| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
9973| degree | 旋转角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 |
9974| px | 旋转中心点的横坐标。 |
9975| py | 旋转中心点的纵坐标。 |
9976
9977
9978### OH_Drawing_MatrixPreScale()
9979
9980```
9981void OH_Drawing_MatrixPreScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
9982```
9983
9984**描述**
9985
9986将矩阵设置为矩阵左乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。
9987
9988本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9989
9990OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9991
9992
9993**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9994
9995**起始版本:** 12
9996
9997**参数:**
9998
9999| 名称 | 描述 |
10000| -------- | -------- |
10001| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
10002| sx | x轴方向的缩放比例因子,为负数时可看作是先关于y = px作镜像翻转后再进行缩放,该参数为浮点数。 |
10003| sy | y轴方向的缩放比例因子,为负数时可看作是先关于x = py作镜像翻转后再进行缩放,该参数为浮点数。 |
10004| px | 缩放中心点的横坐标。 |
10005| py | 缩放中心点的纵坐标。 |
10006
10007
10008### OH_Drawing_MatrixPreTranslate()
10009
10010```
10011void OH_Drawing_MatrixPreTranslate (OH_Drawing_Matrix* , float dx, float dy )
10012```
10013
10014**描述**
10015
10016将矩阵设置为矩阵左乘平移一定距离后的单位矩阵后得到的矩阵。
10017
10018本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10019
10020OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10021
10022**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10023
10024**起始版本:** 12
10025
10026**参数:**
10027
10028| 名称 | 描述 |
10029| -------- | -------- |
10030| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
10031| dx | 表示在x轴方向上的平移距离。 |
10032| dy | 表示在y轴方向上的平移距离。 |
10033
10034
10035### OH_Drawing_MatrixReset()
10036
10037```
10038void OH_Drawing_MatrixReset (OH_Drawing_Matrix* )
10039```
10040
10041**描述**
10042
10043重置当前矩阵为单位矩阵: | 1 0 0 | | 0 1 0 | | 0 0 1 |。
10044
10045本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10046
10047OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10048
10049**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10050
10051**起始版本:** 12
10052
10053**参数:**
10054
10055| 名称 | 描述 |
10056| -------- | -------- |
10057| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
10058
10059
10060### OH_Drawing_MatrixRotate()
10061
10062```
10063void OH_Drawing_MatrixRotate (OH_Drawing_Matrix* , float degree, float px, float py )
10064```
10065
10066**描述**
10067
10068设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点进行旋转。
10069
10070本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10071
10072OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10073
10074**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10075
10076**起始版本:** 12
10077
10078**参数:**
10079
10080| 名称 | 描述 |
10081| -------- | -------- |
10082| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
10083| degree | 角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 |
10084| px | x轴上坐标点。 |
10085| py | y轴上坐标点。 |
10086
10087
10088### OH_Drawing_MatrixScale()
10089
10090```
10091void OH_Drawing_MatrixScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
10092```
10093
10094**描述**
10095
10096设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点,以sx和sy进行缩放。
10097
10098本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10099
10100OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10101
10102**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10103
10104**起始版本:** 12
10105
10106**参数:**
10107
10108| 名称 | 描述 |
10109| -------- | -------- |
10110| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
10111| sx | 水平缩放因子,为负数时可看作是先关于y = px作镜像翻转后再进行缩放,该参数为浮点数。 |
10112| sy | 垂直缩放因子,为负数时可看作是先关于x = py作镜像翻转后再进行缩放,该参数为浮点数。 |
10113| px | x轴上坐标点。 |
10114| py | y轴上坐标点。 |
10115
10116
10117### OH_Drawing_MatrixSetMatrix()
10118
10119```
10120void OH_Drawing_MatrixSetMatrix (OH_Drawing_Matrix* , float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2 )
10121```
10122
10123**描述**
10124
10125用于给矩阵对象设置参数。
10126
10127本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10128
10129OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10130
10131**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10132
10133**起始版本:** 11
10134
10135**参数:**
10136
10137| 名称 | 描述 |
10138| -------- | -------- |
10139| OH_Drawing_Matrix | 指向矩阵对象的指针。 |
10140| scaleX | 水平缩放系数。 |
10141| skewX | 水平倾斜系数。 |
10142| transX | 水平位移系数。 |
10143| skewY | 垂直倾斜系数。 |
10144| scaleY | 垂直缩放系数。 |
10145| transY | 垂直位移系数。 |
10146| persp0 | X轴透视系数。 |
10147| persp1 | Y轴透视系数。 |
10148| persp2 | 透视缩放系数。 |
10149
10150
10151### OH_Drawing_MatrixSetPolyToPoly()
10152
10153```
10154bool OH_Drawing_MatrixSetPolyToPoly (OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, const OH_Drawing_Point2D* dst, uint32_t count )
10155```
10156
10157**描述**
10158
10159通过设置源点以及目标点,生成对应的变换矩阵。 源点以及目标点的个数要大于等于0,小于等于4。
10160
10161本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10162
10163OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
10164
10165count小于0或者大于4时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
10166
10167**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10168
10169**起始版本:** 12
10170
10171**参数:**
10172
10173| 名称 | 描述 |
10174| -------- | -------- |
10175| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
10176| src | 源点数组,为NULL时count应当为0。 |
10177| dst | 目标点数组,个数要与源点相等,为NULL时count应当为0。 |
10178| count | 源点数组以及目标点数组的个数,为0时将矩阵对象设为单位矩阵。 |
10179
10180**返回:**
10181
10182函数返回是否可以生成对应矩阵以用来完成变换。true表示矩阵生成成功,false表示无法生成对应矩阵。
10183
10184
10185### OH_Drawing_MatrixSetRectToRect()
10186
10187```
10188bool OH_Drawing_MatrixSetRectToRect (OH_Drawing_Matrix* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, OH_Drawing_ScaleToFit stf )
10189```
10190
10191**描述**
10192
10193将矩阵以缩放方式适配目标矩阵。
10194
10195本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10196
10197OH_Drawing_Matrix、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10198
10199**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10200
10201**起始版本:** 12
10202
10203**参数:**
10204
10205| 名称 | 描述 |
10206| -------- | -------- |
10207| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
10208| src | 指向映射源的[OH_Drawing_Rect](#oh_drawing_rect)对象Rect的指针。 |
10209| dst | 指向要映射到的[OH_Drawing_Rect](#oh_drawing_rect)对象Rect的指针。 |
10210| stf | 缩放方式,支持方式[OH_Drawing_ScaleToFit](#oh_drawing_scaletofit)。 |
10211
10212**返回:**
10213
10214如果设置失败,则返回false;如果设置成功,则返回true;特别地,如果源矩形src的宽高任意一个小于等于0,则返回false,并将矩阵设置为单位矩阵;如果目标矩形dst的宽高任意一个小于等于0,则返回true,并将矩阵设置为除透视缩放系数为1外其余值皆为0的矩阵。
10215
10216### OH_Drawing_MatrixTranslate()
10217
10218```
10219void OH_Drawing_MatrixTranslate (OH_Drawing_Matrix* , float dx, float dy )
10220```
10221
10222**描述**
10223
10224设置矩阵为单位矩阵,并平移(dx, dy)。
10225
10226本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10227
10228OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10229
10230**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10231
10232**起始版本:** 12
10233
10234**参数:**
10235
10236| 名称 | 描述 |
10237| -------- | -------- |
10238| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
10239| dx | 水平方向平移距离,正数表示往x轴正方向平移,负数表示往x轴负方向平移,该参数为浮点数。 |
10240| dy | 垂直方向平移距离,正数表示往y轴正方向平移,负数表示往y轴负方向平移,该参数为浮点数。 |
10241
10242
10243### OH_Drawing_MemoryStreamCreate()
10244
10245```
10246OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate (const void* data, size_t length, bool copyData )
10247```
10248
10249**描述**
10250
10251创建一个内存流对象。
10252
10253本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10254
10255data为NULL或者length等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10256
10257**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10258
10259**起始版本:** 12
10260
10261**参数:**
10262
10263| 名称 | 描述 |
10264| -------- | -------- |
10265| data | 数据段。 |
10266| length | 数据段长度。 |
10267| copyData | 是否拷贝数据。true表示内存流对象会拷贝一份数据段数据, false表示内存流对象直接使用数据段数据,不拷贝。 |
10268
10269**返回:**
10270
10271函数会返回一个指针,指针指向创建的内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)。
10272
10273
10274### OH_Drawing_MemoryStreamDestroy()
10275
10276```
10277void OH_Drawing_MemoryStreamDestroy (OH_Drawing_MemoryStream* )
10278```
10279
10280**描述**
10281
10282销毁内存流对象并回收该对象占有内存。
10283
10284**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10285
10286**起始版本:** 12
10287
10288**参数:**
10289
10290| 名称 | 描述 |
10291| -------- | -------- |
10292| OH_Drawing_MemoryStream | 指向内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)的指针。 |
10293
10294
10295### OH_Drawing_PathAddArc()
10296
10297```
10298void OH_Drawing_PathAddArc (OH_Drawing_Path* , const OH_Drawing_Rect* , float startAngle, float sweepAngle )
10299```
10300
10301**描述**
10302
10303将圆弧添加到路径中,作为新轮廓的起点。从起始角度到扫掠角度添加弧, 添加的弧是椭圆边界椭圆的一部分,单位为度。正扫掠表示按顺时针方向延长弧, 负扫掠表示按逆时针方向延长弧。如果扫掠角度&lt;= -360°,或扫掠角度&gt;= 360°, 并且起始角度对90取模接近于0,则添加椭圆而不是弧。
10304
10305本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10306
10307OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10308
10309**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10310
10311**起始版本:** 12
10312
10313**参数:**
10314
10315| 名称 | 描述 |
10316| -------- | -------- |
10317| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10318| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
10319| startAngle | 弧的起始角度,单位为度。 |
10320| sweepAngle | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 |
10321
10322### OH_Drawing_PathAddOval()
10323
10324```
10325void OH_Drawing_PathAddOval (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection  )
10326```
10327
10328**描述**
10329
10330按指定方向,向路径添加椭圆。
10331
10332本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10333
10334OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
10335
10336OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
10337
10338**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10339
10340**起始版本:** 12
10341
10342**参数:**
10343
10344| 名称 | 描述 |
10345| -------- | -------- |
10346| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10347| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
10348| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
10349
10350### OH_Drawing_PathAddOvalWithInitialPoint()
10351
10352```
10353void OH_Drawing_PathAddOvalWithInitialPoint (OH_Drawing_Path* , const OH_Drawing_Rect* , uint32_t start, OH_Drawing_PathDirection  )
10354```
10355
10356**描述**
10357
10358将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。
10359
10360本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10361
10362OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
10363
10364OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
10365
10366**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10367
10368**起始版本:** 12
10369
10370**参数:**
10371
10372| 名称 | 描述 |
10373| -------- | -------- |
10374| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10375| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
10376| start | 表示椭圆初始点的索引。 |
10377| OH_Drawing_PathDirection | 表示绘制方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
10378
10379
10380### OH_Drawing_PathAddPath()
10381
10382```
10383void OH_Drawing_PathAddPath (OH_Drawing_Path* , const OH_Drawing_Path* src, const OH_Drawing_Matrix*  )
10384```
10385
10386**描述**
10387
10388将源路径矩阵变换后,添加到当前路径中。
10389
10390本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10391
10392OH_Drawing_Path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10393
10394**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10395
10396**起始版本:** 12
10397
10398**参数:**
10399
10400| 名称 | 描述 |
10401| -------- | -------- |
10402| OH_Drawing_Path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10403| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10404| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,为NULL表示单位矩阵。 |
10405
10406
10407### OH_Drawing_PathAddPathWithMatrixAndMode()
10408
10409```
10410void OH_Drawing_PathAddPathWithMatrixAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_PathAddMode  )
10411```
10412
10413**描述**
10414
10415将源路径矩阵变换后,以规定模式添加到当前路径中。
10416
10417本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10418
10419path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
10420
10421OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
10422
10423**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10424
10425**起始版本:** 12
10426
10427**参数:**
10428
10429| 名称 | 描述 |
10430| -------- | -------- |
10431| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10432| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10433| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,为NULL表示单位矩阵。 |
10434| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 |
10435
10436
10437### OH_Drawing_PathAddPathWithMode()
10438
10439```
10440void OH_Drawing_PathAddPathWithMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode  )
10441```
10442
10443**描述**
10444
10445将源路径以规定模式添加到当前路径中。
10446
10447本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10448
10449path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
10450
10451OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
10452
10453**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10454
10455**起始版本:** 12
10456
10457**参数:**
10458
10459| 名称 | 描述 |
10460| -------- | -------- |
10461| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10462| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10463| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 |
10464
10465
10466### OH_Drawing_PathAddPathWithOffsetAndMode()
10467
10468```
10469void OH_Drawing_PathAddPathWithOffsetAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy, OH_Drawing_PathAddMode  )
10470```
10471
10472**描述**
10473
10474将源路径偏移后,以规定模式添加到当前路径中。
10475
10476本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10477
10478path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10479
10480OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
10481
10482**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10483
10484**起始版本:** 12
10485
10486**参数:**
10487
10488| 名称 | 描述 |
10489| -------- | -------- |
10490| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10491| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10492| dx | 添加到目标路径横坐标的偏移量。 |
10493| dy | 添加到目标路径纵坐标的偏移量。 |
10494| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 |
10495
10496
10497### OH_Drawing_PathAddRect()
10498
10499```
10500void OH_Drawing_PathAddRect (OH_Drawing_Path* , float left, float top, float right, float bottom, OH_Drawing_PathDirection  )
10501```
10502
10503**描述**
10504
10505按指定方向,将矩形添加到路径中,添加的路径的起始点为矩形左上角。
10506
10507本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10508
10509OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
10510
10511OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
10512
10513**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10514
10515**起始版本:** 12
10516
10517**参数:**
10518
10519| 名称 | 描述 |
10520| -------- | -------- |
10521| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10522| left | 矩形左上角的x轴坐标。 |
10523| top | 矩形左上角的y轴坐标。 |
10524| right | 矩形右下角的x轴坐标。 |
10525| bottom | 矩形右下角的y轴坐标。 |
10526| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
10527
10528
10529### OH_Drawing_PathAddRectWithInitialCorner()
10530
10531```
10532void OH_Drawing_PathAddRectWithInitialCorner (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection , uint32_t start )
10533```
10534
10535**描述**
10536
10537按指定方向,向路径添加矩形轮廓。
10538
10539本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10540
10541OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
10542
10543OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
10544
10545**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10546
10547**起始版本:** 12
10548
10549**参数:**
10550
10551| 名称 | 描述 |
10552| -------- | -------- |
10553| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10554| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
10555| OH_Drawing_PathDirection | 表示绘制方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
10556| start | 起始点的位置,表示从矩形的哪个角开始绘制路径。0:左上角,1:右上角,2:右下角,3:左下角。 |
10557
10558
10559### OH_Drawing_PathAddRoundRect()
10560
10561```
10562void OH_Drawing_PathAddRoundRect (OH_Drawing_Path* , const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection  )
10563```
10564
10565**描述**
10566
10567按指定方向,向路径添加圆角矩形轮廓。路径添加方向为顺时针时,起始点位于圆角矩形左下方圆角与左边界的交点;路径添加方向为逆时针时,起始点位于圆角矩形左上方圆角与左边界的交点。
10568
10569本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10570
10571OH_Drawing_Path、roundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
10572
10573OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
10574
10575**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10576
10577**起始版本:** 12
10578
10579**参数:**
10580
10581| 名称 | 描述 |
10582| -------- | -------- |
10583| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10584| roundRect | 指向圆角矩形对象[OH_Drawing_RoundRect](#oh_drawing_roundrect)的指针。 |
10585| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
10586
10587
10588### OH_Drawing_PathArcTo()
10589
10590```
10591void OH_Drawing_PathArcTo (OH_Drawing_Path* , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg )
10592```
10593
10594**描述**
10595
10596用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。
10597
10598本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10599
10600OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10601
10602**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10603
10604**起始版本:** 8
10605
10606**参数:**
10607
10608| 名称 | 描述 |
10609| -------- | -------- |
10610| OH_Drawing_Path | 指向路径对象的指针。 |
10611| x1 | 包围椭圆的矩形左上角点位置的横坐标。 |
10612| y1 | 包围椭圆的矩形左上角点位置的纵坐标。 |
10613| x2 | 包围椭圆的矩形右下角点位置的横坐标。 |
10614| y2 | 包围椭圆的矩形右下角点位置的纵坐标。 |
10615| startDeg | 起始的角度。角度的起始方向(0°)为x轴正方向。 |
10616| sweepDeg | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 |
10617
10618
10619### OH_Drawing_PathClose()
10620
10621```
10622void OH_Drawing_PathClose (OH_Drawing_Path* )
10623```
10624
10625**描述**
10626
10627用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。
10628
10629本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10630
10631OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10632
10633**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10634
10635**起始版本:** 8
10636
10637**参数:**
10638
10639| 名称 | 描述 |
10640| -------- | -------- |
10641| OH_Drawing_Path | 指向路径对象的指针。 |
10642
10643
10644### OH_Drawing_PathConicTo()
10645
10646```
10647void OH_Drawing_PathConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight )
10648```
10649
10650**描述**
10651
10652在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线,其控制点为 (ctrlX, ctrlY),结束点为 (endX, endY)。
10653
10654本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10655
10656OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10657
10658**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10659
10660**起始版本:** 12
10661
10662**参数:**
10663
10664| 名称 | 描述 |
10665| -------- | -------- |
10666| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10667| ctrlX | 控制点位置的横坐标。 |
10668| ctrlY | 控制点位置的纵坐标。 |
10669| endX | 结束点位置的横坐标。 |
10670| endY | 结束点位置的纵坐标。 |
10671| weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。若小于等于0则等同于使用[OH_Drawing_PathLineTo](#oh_drawing_pathlineto)添加一条到结束点的线段,若为1则等同于[OH_Drawing_PathQuadTo](#oh_drawing_pathquadto)。 |
10672
10673
10674### OH_Drawing_PathContains()
10675
10676```
10677bool OH_Drawing_PathContains (OH_Drawing_Path* , float x, float y )
10678```
10679
10680**描述**
10681
10682判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1)。
10683
10684本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10685
10686OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10687
10688**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10689
10690**起始版本:** 12
10691
10692**参数:**
10693
10694| 名称 | 描述 |
10695| -------- | -------- |
10696| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10697| x | x轴上坐标点。 |
10698| y | y轴上坐标点。 |
10699
10700**返回:**
10701
10702函数返回true表示点在路径内,函数返回false表示点在路径外。
10703
10704
10705### OH_Drawing_PathCopy()
10706
10707```
10708OH_Drawing_Path* OH_Drawing_PathCopy (OH_Drawing_Path* )
10709```
10710
10711**描述**
10712
10713创建一个路径对象副本[OH_Drawing_Path](#oh_drawing_path),用于拷贝一个已有路径对象。
10714
10715本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10716
10717OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10718
10719**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10720
10721**起始版本:** 12
10722
10723**参数:**
10724
10725| 名称 | 描述 |
10726| -------- | -------- |
10727| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10728
10729**返回:**
10730
10731函数返回一个指针,指针指向创建的路径对象副本[OH_Drawing_Path](#oh_drawing_path)。
10732
10733
10734### OH_Drawing_PathCreate()
10735
10736```
10737OH_Drawing_Path* OH_Drawing_PathCreate (void )
10738```
10739
10740**描述**
10741
10742用于创建一个路径对象。
10743
10744**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10745
10746**起始版本:** 8
10747
10748**返回:**
10749
10750函数会返回一个指针,指针指向创建的路径对象。
10751
10752
10753### OH_Drawing_PathCubicTo()
10754
10755```
10756void OH_Drawing_PathCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
10757```
10758
10759**描述**
10760
10761用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。
10762
10763本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10764
10765OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10766
10767**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10768
10769**起始版本:** 8
10770
10771**参数:**
10772
10773| 名称 | 描述 |
10774| -------- | -------- |
10775| OH_Drawing_Path | 指向路径对象的指针。 |
10776| ctrlX1 | 第一个控制点位置的横坐标。 |
10777| ctrlY1 | 第一个控制点位置的纵坐标。 |
10778| ctrlX2 | 第二个控制点位置的横坐标。 |
10779| ctrlY2 | 第二个控制点位置的纵坐标。 |
10780| endX | 目标点位置的横坐标。 |
10781| endY | 目标点位置的纵坐标。 |
10782
10783
10784### OH_Drawing_PathDestroy()
10785
10786```
10787void OH_Drawing_PathDestroy (OH_Drawing_Path* )
10788```
10789
10790**描述**
10791
10792用于销毁路径对象并回收该对象占有的内存。
10793
10794**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10795
10796**起始版本:** 8
10797
10798**参数:**
10799
10800| 名称 | 描述 |
10801| -------- | -------- |
10802| OH_Drawing_Path | 指向路径对象的指针。 |
10803
10804
10805### OH_Drawing_PathEffectDestroy()
10806
10807```
10808void OH_Drawing_PathEffectDestroy (OH_Drawing_PathEffect* )
10809```
10810
10811**描述**
10812
10813销毁路径效果对象并回收该对象占有内存。
10814
10815**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10816
10817**起始版本:** 12
10818
10819**参数:**
10820
10821| 名称 | 描述 |
10822| -------- | -------- |
10823| OH_Drawing_PathEffect | 指向路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针。 |
10824
10825
10826### OH_Drawing_PathGetLength()
10827
10828```
10829float OH_Drawing_PathGetLength (OH_Drawing_Path* , bool forceClosed )
10830```
10831
10832**描述**
10833
10834获取当前路径的长度。
10835
10836本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10837
10838OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10839
10840**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10841
10842**起始版本:** 12
10843
10844**参数:**
10845
10846| 名称 | 描述 |
10847| -------- | -------- |
10848| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10849| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
10850
10851**返回:**
10852
10853函数返回当前路径的长度。
10854
10855
10856### OH_Drawing_PathLineTo()
10857
10858```
10859void OH_Drawing_PathLineTo (OH_Drawing_Path* , float x, float y )
10860```
10861
10862**描述**
10863
10864用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。
10865
10866本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10867
10868OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10869
10870**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10871
10872**起始版本:** 8
10873
10874**参数:**
10875
10876| 名称 | 描述 |
10877| -------- | -------- |
10878| OH_Drawing_Path | 指向路径对象的指针。 |
10879| x | 目标点的横坐标。 |
10880| y | 目标点的纵坐标。 |
10881
10882
10883### OH_Drawing_PathMoveTo()
10884
10885```
10886void OH_Drawing_PathMoveTo (OH_Drawing_Path* , float x, float y )
10887```
10888
10889**描述**
10890
10891用于设置自定义路径的起始点位置。
10892
10893本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
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
10922path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10923
10924**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10925
10926**起始版本:** 12
10927
10928**参数:**
10929
10930| 名称 | 描述 |
10931| -------- | -------- |
10932| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10933| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,为NULL时会将结果存储到当前路径对象中。 |
10934| dx | x轴方向的偏移量。 |
10935| dy | y轴方向的偏移量。 |
10936
10937
10938### OH_Drawing_PathQuadTo()
10939
10940```
10941void OH_Drawing_PathQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY )
10942```
10943
10944**描述**
10945
10946用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。
10947
10948本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10949
10950OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10951
10952**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10953
10954**起始版本:** 8
10955
10956**参数:**
10957
10958| 名称 | 描述 |
10959| -------- | -------- |
10960| OH_Drawing_Path | 指向路径对象的指针。 |
10961| ctrlX | 控制点位置的横坐标。 |
10962| ctrlY | 控制点位置的纵坐标。 |
10963| endX | 目标点位置的横坐标。 |
10964| endY | 目标点位置的纵坐标。 |
10965
10966
10967### OH_Drawing_PathRConicTo()
10968
10969```
10970void OH_Drawing_PathRConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight )
10971```
10972
10973**描述**
10974
10975使用相对位置在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线。
10976
10977本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10978
10979OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10980
10981**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10982
10983**起始版本:** 12
10984
10985**参数:**
10986
10987| 名称 | 描述 |
10988| -------- | -------- |
10989| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
10990| ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 |
10991| ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 |
10992| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 |
10993| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
10994| weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。若小于等于0则等同于使用[OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto)添加一条到结束点的线段,若为1则等同于[OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto)。 |
10995
10996
10997### OH_Drawing_PathRCubicTo()
10998
10999```
11000void OH_Drawing_PathRCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
11001```
11002
11003**描述**
11004
11005使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。
11006
11007本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11008
11009OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11010
11011**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11012
11013**起始版本:** 12
11014
11015**参数:**
11016
11017| 名称 | 描述 |
11018| -------- | -------- |
11019| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
11020| ctrlX1 | 相对于路径终点的x轴偏移量,用于指定第一个控制点的横坐标。 |
11021| ctrlY1 | 相对于路径终点的y轴偏移量,用于指定第一个控制点的纵坐标。 |
11022| ctrlX2 | 相对于路径终点的x轴偏移量,用于指定第二个控制点的横坐标。 |
11023| ctrlY2 | 相对于路径终点的y轴偏移量,用于指定第二个控制点的纵坐标。 |
11024| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 |
11025| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
11026
11027
11028### OH_Drawing_PathReset()
11029
11030```
11031void OH_Drawing_PathReset (OH_Drawing_Path* )
11032```
11033
11034**描述**
11035
11036用于重置自定义路径数据。
11037
11038本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11039
11040OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11041
11042**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11043
11044**起始版本:** 8
11045
11046**参数:**
11047
11048| 名称 | 描述 |
11049| -------- | -------- |
11050| OH_Drawing_Path | 指向路径对象的指针。 |
11051
11052
11053### OH_Drawing_PathRLineTo()
11054
11055```
11056void OH_Drawing_PathRLineTo (OH_Drawing_Path* , float x, float y )
11057```
11058
11059**描述**
11060
11061使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。
11062
11063本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11064
11065OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11066
11067**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11068
11069**起始版本:** 12
11070
11071**参数:**
11072
11073| 名称 | 描述 |
11074| -------- | -------- |
11075| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
11076| x | 相对于当前路径终点的x轴偏移量,用于指定目标点的横坐标。 |
11077| y | 相对于当前路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
11078
11079
11080### OH_Drawing_PathRMoveTo()
11081
11082```
11083void OH_Drawing_PathRMoveTo (OH_Drawing_Path* , float x, float y )
11084```
11085
11086**描述**
11087
11088用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。
11089
11090本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11091
11092OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11093
11094**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11095
11096**起始版本:** 12
11097
11098**参数:**
11099
11100| 名称 | 描述 |
11101| -------- | -------- |
11102| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
11103| x | 目标点相对于当前路径终点的x轴偏移量,正数往x轴正方向偏移,负数往x轴负方向偏移,该参数为浮点数。 |
11104| y | 目标点相对于当前路径终点的y轴偏移量,正数往y轴正方向偏移,负数往y轴负方向偏移,该参数为浮点数。 |
11105
11106
11107### OH_Drawing_PathRQuadTo()
11108
11109```
11110void OH_Drawing_PathRQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY )
11111```
11112
11113**描述**
11114
11115使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。
11116
11117本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11118
11119OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11120
11121**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11122
11123**起始版本:** 12
11124
11125**参数:**
11126
11127| 名称 | 描述 |
11128| -------- | -------- |
11129| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
11130| ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 |
11131| ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 |
11132| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 |
11133| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
11134
11135
11136### OH_Drawing_PathSetFillType()
11137
11138```
11139void OH_Drawing_PathSetFillType (OH_Drawing_Path* , OH_Drawing_PathFillType  )
11140```
11141
11142**描述**
11143
11144设置路径的填充类型,这个决定了路径内部区域的定义方式。例如,使用 Winding 填充类型时,路径内部区域由路径环绕的次数决定,而使用 EvenOdd 填充类型时,路径内部区域由路径环绕的次数是否为奇数决定。
11145
11146本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11147
11148OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
11149
11150OH_Drawing_PathFillType不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
11151
11152**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11153
11154**起始版本:** 12
11155
11156**参数:**
11157
11158| 名称 | 描述 |
11159| -------- | -------- |
11160| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
11161| OH_Drawing_PathFillType | 路径填充规则[OH_Drawing_PathFillType](#oh_drawing_pathfilltype)。 |
11162
11163
11164### OH_Drawing_PathTransform()
11165
11166```
11167void OH_Drawing_PathTransform (OH_Drawing_Path* , const OH_Drawing_Matrix*  )
11168```
11169
11170**描述**
11171
11172对路径进行矩阵变换。
11173
11174本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11175
11176OH_Drawing_Path、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11177
11178**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11179
11180**起始版本:** 12
11181
11182**参数:**
11183
11184| 名称 | 描述 |
11185| -------- | -------- |
11186| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
11187| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11188
11189
11190### OH_Drawing_PathTransformWithPerspectiveClip()
11191
11192```
11193void OH_Drawing_PathTransformWithPerspectiveClip (OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_Path* dst, bool applyPerspectiveClip )
11194```
11195
11196**描述**
11197
11198对路径进行矩阵变换。用转换后的路径替换目标路径,如果目标路径为空,则替换源路径。
11199
11200本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11201
11202src、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11203
11204**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11205
11206**起始版本:** 12
11207
11208**参数:**
11209
11210| 名称 | 描述 |
11211| -------- | -------- |
11212| src | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
11213| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11214| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
11215| applyPerspectiveClip | 表示变换路径是否应用透视裁剪。true表示应用透视裁剪,false表示不用透视裁剪。 |
11216
11217
11218### OH_Drawing_PenCreate()
11219
11220```
11221OH_Drawing_Pen* OH_Drawing_PenCreate (void )
11222```
11223
11224**描述**
11225
11226用于创建一个画笔对象。
11227
11228**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11229
11230**起始版本:** 8
11231
11232**返回:**
11233
11234函数会返回一个指针,指针指向创建的画笔对象。
11235
11236
11237### OH_Drawing_PenDestroy()
11238
11239```
11240void OH_Drawing_PenDestroy (OH_Drawing_Pen* )
11241```
11242
11243**描述**
11244
11245用于销毁画笔对象并回收该对象占有的内存。
11246
11247**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11248
11249**起始版本:** 8
11250
11251**参数:**
11252
11253| 名称 | 描述 |
11254| -------- | -------- |
11255| OH_Drawing_Pen | 指向画笔对象的指针。 |
11256
11257
11258### OH_Drawing_PenGetAlpha()
11259
11260```
11261uint8_t OH_Drawing_PenGetAlpha (const OH_Drawing_Pen* )
11262```
11263
11264**描述**
11265
11266获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。
11267
11268本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11269
11270OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11271
11272**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11273
11274**起始版本:** 11
11275
11276**参数:**
11277
11278| 名称 | 描述 |
11279| -------- | -------- |
11280| OH_Drawing_Pen | 表示指向画笔对象的指针。 |
11281
11282**返回:**
11283
11284返回一个8比特的值表示透明度。
11285
11286
11287### OH_Drawing_PenGetCap()
11288
11289```
11290OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen* )
11291```
11292
11293**描述**
11294
11295用于获取画笔笔帽的样式。
11296
11297本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11298
11299OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11300
11301**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11302
11303**起始版本:** 8
11304
11305**参数:**
11306
11307| 名称 | 描述 |
11308| -------- | -------- |
11309| OH_Drawing_Pen | 指向画笔对象的指针。 |
11310
11311**返回:**
11312
11313函数返回画笔笔帽样式。
11314
11315
11316### OH_Drawing_PenGetColor()
11317
11318```
11319uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen* )
11320```
11321
11322**描述**
11323
11324用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。
11325
11326本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11327
11328OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11329
11330**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11331
11332**起始版本:** 8
11333
11334**参数:**
11335
11336| 名称 | 描述 |
11337| -------- | -------- |
11338| OH_Drawing_Pen | 指向画笔对象的指针。 |
11339
11340**返回:**
11341
11342函数返回一个描述颜色的32位(ARGB)变量。
11343
11344
11345### OH_Drawing_PenGetFilter()
11346
11347```
11348void OH_Drawing_PenGetFilter (OH_Drawing_Pen* , OH_Drawing_Filter*  )
11349```
11350
11351**描述**
11352
11353从画笔获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。
11354
11355本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11356
11357OH_Drawing_Pen、OH_Drawing_Filter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11358
11359**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11360
11361**起始版本:** 12
11362
11363**参数:**
11364
11365| 名称 | 描述 |
11366| -------- | -------- |
11367| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
11368| OH_Drawing_Filter | 指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 |
11369
11370
11371### OH_Drawing_PenGetJoin()
11372
11373```
11374OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen* )
11375```
11376
11377**描述**
11378
11379用于获取画笔绘制折线转角的样式。
11380
11381本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11382
11383OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11384
11385**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11386
11387**起始版本:** 8
11388
11389**参数:**
11390
11391| 名称 | 描述 |
11392| -------- | -------- |
11393| OH_Drawing_Pen | 指向画笔对象的指针。 |
11394
11395**返回:**
11396
11397函数返回折线转角的样式。
11398
11399### OH_Drawing_PenGetMiterLimit()
11400
11401```
11402float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen* )
11403```
11404
11405**描述**
11406
11407用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。
11408
11409本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11410
11411OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11412
11413**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11414
11415**起始版本:** 8
11416
11417**参数:**
11418
11419| 名称 | 描述 |
11420| -------- | -------- |
11421| OH_Drawing_Pen | 指向画笔对象的指针。 |
11422
11423**返回:**
11424
11425函数返回尖角的限制值。
11426
11427
11428### OH_Drawing_PenGetWidth()
11429
11430```
11431float OH_Drawing_PenGetWidth (const OH_Drawing_Pen* )
11432```
11433
11434**描述**
11435
11436获取画笔的线宽,线宽描述了画笔绘制图形轮廓的宽度。
11437
11438本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11439
11440OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11441
11442**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11443
11444**起始版本:** 8
11445
11446**参数:**
11447
11448| 名称 | 描述 |
11449| -------- | -------- |
11450| OH_Drawing_Pen | 指向画笔对象的指针。 |
11451
11452**返回:**
11453
11454函数返回画笔的线宽。
11455
11456
11457### OH_Drawing_PenIsAntiAlias()
11458
11459```
11460bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen* )
11461```
11462
11463**描述**
11464
11465用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
11466
11467本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11468
11469OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11470
11471**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11472
11473**起始版本:** 8
11474
11475**参数:**
11476
11477| 名称 | 描述 |
11478| -------- | -------- |
11479| OH_Drawing_Pen | 指向画笔对象的指针。 |
11480
11481**返回:**
11482
11483函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。
11484
11485
11486### OH_Drawing_PenReset()
11487
11488```
11489void OH_Drawing_PenReset (OH_Drawing_Pen* )
11490```
11491
11492**描述**
11493
11494将画笔重置至初始值。
11495
11496本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11497
11498OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11499
11500**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11501
11502**起始版本:** 12
11503
11504**参数:**
11505
11506| 名称 | 描述 |
11507| -------- | -------- |
11508| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
11509
11510
11511### OH_Drawing_PenSetAlpha()
11512
11513```
11514void OH_Drawing_PenSetAlpha (OH_Drawing_Pen* , uint8_t alpha )
11515```
11516
11517**描述**
11518
11519为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。
11520
11521本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11522
11523OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11524
11525**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11526
11527**起始版本:** 11
11528
11529**参数:**
11530
11531| 名称 | 描述 |
11532| -------- | -------- |
11533| OH_Drawing_Pen | 表示指向画笔对象的指针。 |
11534| alpha | 表示要设置的透明度值,是一个8比特的变量。 |
11535
11536
11537### OH_Drawing_PenSetAntiAlias()
11538
11539```
11540void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen* , bool  )
11541```
11542
11543**描述**
11544
11545用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
11546
11547本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11548
11549OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11550
11551**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11552
11553**起始版本:** 8
11554
11555**参数:**
11556
11557| 名称 | 描述 |
11558| -------- | -------- |
11559| OH_Drawing_Pen | 指向画笔对象的指针。 |
11560| bool | 真为抗锯齿,假则不做抗锯齿处理。 |
11561
11562
11563### OH_Drawing_PenSetBlendMode()
11564
11565```
11566void OH_Drawing_PenSetBlendMode (OH_Drawing_Pen* , OH_Drawing_BlendMode  )
11567```
11568
11569**描述**
11570
11571为画笔设置一个混合器,该混合器实现了指定的混合模式枚举。
11572
11573本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11574
11575OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
11576
11577OH_Drawing_BlendMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
11578
11579**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11580
11581**起始版本:** 12
11582
11583**参数:**
11584
11585| 名称 | 描述 |
11586| -------- | -------- |
11587| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
11588| OH_Drawing_BlendMode | 混合模式枚举类型[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 |
11589
11590
11591### OH_Drawing_PenSetCap()
11592
11593```
11594void OH_Drawing_PenSetCap (OH_Drawing_Pen* , OH_Drawing_PenLineCapStyle  )
11595```
11596
11597**描述**
11598
11599用于设置画笔笔帽样式。
11600
11601本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11602
11603OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
11604
11605OH_Drawing_PenLineCapStyle不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
11606
11607**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11608
11609**起始版本:** 8
11610
11611**参数:**
11612
11613| 名称 | 描述 |
11614| -------- | -------- |
11615| OH_Drawing_Pen | 指向画笔对象的指针。 |
11616| OH_Drawing_PenLineCapStyle | 描述画笔笔帽样式的变量。 |
11617
11618
11619### OH_Drawing_PenSetColor()
11620
11621```
11622void OH_Drawing_PenSetColor (OH_Drawing_Pen* , uint32_t color )
11623```
11624
11625**描述**
11626
11627用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。
11628
11629本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11630
11631OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11632
11633**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11634
11635**起始版本:** 8
11636
11637**参数:**
11638
11639| 名称 | 描述 |
11640| -------- | -------- |
11641| OH_Drawing_Pen | 指向画笔对象的指针。 |
11642| color | 描述颜色的32位(ARGB)变量。 |
11643
11644
11645### OH_Drawing_PenSetFilter()
11646
11647```
11648void OH_Drawing_PenSetFilter (OH_Drawing_Pen* , OH_Drawing_Filter*  )
11649```
11650
11651**描述**
11652
11653设置画笔滤波器。
11654
11655本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11656
11657OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11658
11659**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11660
11661**起始版本:** 11
11662
11663**参数:**
11664
11665| 名称 | 描述 |
11666| -------- | -------- |
11667| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
11668| OH_Drawing_Filter | 指向滤波器[OH_Drawing_Filter](#oh_drawing_filter)的指针,为NULL表示清空画笔滤波器。 |
11669
11670
11671### OH_Drawing_PenSetJoin()
11672
11673```
11674void OH_Drawing_PenSetJoin (OH_Drawing_Pen* , OH_Drawing_PenLineJoinStyle  )
11675```
11676
11677**描述**
11678
11679用于设置画笔绘制转角的样式。
11680
11681本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11682
11683OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
11684
11685OH_Drawing_PenLineJoinStyle不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
11686
11687**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11688
11689**起始版本:** 8
11690
11691**参数:**
11692
11693| 名称 | 描述 |
11694| -------- | -------- |
11695| OH_Drawing_Pen | 指向画笔对象的指针。 |
11696| OH_Drawing_PenLineJoinStyle | 折线转角样式。 |
11697
11698
11699### OH_Drawing_PenSetMiterLimit()
11700
11701```
11702void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen* , float miter )
11703```
11704
11705**描述**
11706
11707用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。
11708
11709本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11710
11711OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11712
11713**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11714
11715**起始版本:** 8
11716
11717**参数:**
11718
11719| 名称 | 描述 |
11720| -------- | -------- |
11721| OH_Drawing_Pen | 指向画笔对象的指针。 |
11722| miter | 描述尖角限制值的变量。 |
11723
11724
11725### OH_Drawing_PenSetPathEffect()
11726
11727```
11728void OH_Drawing_PenSetPathEffect (OH_Drawing_Pen* , OH_Drawing_PathEffect*  )
11729```
11730
11731**描述**
11732
11733设置画笔路径效果。
11734
11735本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11736
11737OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11738
11739**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11740
11741**起始版本:** 12
11742
11743**参数:**
11744
11745| 名称 | 描述 |
11746| -------- | -------- |
11747| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
11748| OH_Drawing_PathEffect | 指向路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针,为NULL表示清空路径效果。 |
11749
11750
11751### OH_Drawing_PenSetShaderEffect()
11752
11753```
11754void OH_Drawing_PenSetShaderEffect (OH_Drawing_Pen* , OH_Drawing_ShaderEffect*  )
11755```
11756
11757**描述**
11758
11759设置画笔着色器效果。
11760
11761本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11762
11763OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11764
11765**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11766
11767**起始版本:** 11
11768
11769**参数:**
11770
11771| 名称 | 描述 |
11772| -------- | -------- |
11773| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
11774| OH_Drawing_ShaderEffect | 指向着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)的指针,为NULL表示清空着色器效果。 |
11775
11776
11777### OH_Drawing_PenSetWidth()
11778
11779```
11780void OH_Drawing_PenSetWidth (OH_Drawing_Pen* , float width )
11781```
11782
11783**描述**
11784
11785用于设置画笔的线宽。0线宽被视作特殊的极细线宽,在绘制时始终会被绘制为1像素,不随画布的缩放而改变;负数线宽在实际绘制时会被视作0线宽。
11786
11787本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11788
11789OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11790
11791**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11792
11793**起始版本:** 8
11794
11795**参数:**
11796
11797| 名称 | 描述 |
11798| -------- | -------- |
11799| OH_Drawing_Pen | 指向画笔对象的指针。 |
11800| width | 描述画笔线宽的变量。 |
11801
11802
11803### OH_Drawing_PointCreate()
11804
11805```
11806OH_Drawing_Point* OH_Drawing_PointCreate (float x, float y )
11807```
11808
11809**描述**
11810
11811用于创建一个坐标点对象。
11812
11813**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11814
11815**起始版本:** 11
11816
11817**参数:**
11818
11819| 名称 | 描述 |
11820| -------- | -------- |
11821| x | X轴坐标。 |
11822| y | Y轴坐标。 |
11823
11824**返回:**
11825
11826函数会返回一个指针,指针指向创建的坐标点对象。
11827
11828
11829### OH_Drawing_PointDestroy()
11830
11831```
11832void OH_Drawing_PointDestroy (OH_Drawing_Point* )
11833```
11834
11835**描述**
11836
11837用于销毁坐标点对象并回收该对象占有的内存。
11838
11839**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11840
11841**起始版本:** 11
11842
11843**参数:**
11844
11845| 名称 | 描述 |
11846| -------- | -------- |
11847| OH_Drawing_Point | 指向坐标点对象的指针。 |
11848
11849
11850### OH_Drawing_RectCopy()
11851
11852```
11853void OH_Drawing_RectCopy (OH_Drawing_Rect* sRect, OH_Drawing_Rect* dRect )
11854```
11855
11856**描述**
11857
11858用于将源矩形对象复制到目标矩形对象。
11859
11860本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11861
11862sRect、dRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11863
11864**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11865
11866**起始版本:** 12
11867
11868**参数:**
11869
11870| 名称 | 描述 |
11871| -------- | -------- |
11872| sRect | 指向源矩形对象的指针。 |
11873| dRect | 指向目标矩形对象的指针。 |
11874
11875
11876### OH_Drawing_RectCreate()
11877
11878```
11879OH_Drawing_Rect* OH_Drawing_RectCreate (float left, float top, float right, float bottom )
11880```
11881
11882**描述**
11883
11884用于创建一个矩形对象,不会对设置的坐标排序,即允许矩形设置的左上角坐标大于对应的矩形右下角坐标。
11885
11886**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11887
11888**起始版本:** 11
11889
11890**参数:**
11891
11892| 名称 | 描述 |
11893| -------- | -------- |
11894| left | 矩形左上角的横坐标。 |
11895| top | 矩形左上角的纵坐标。 |
11896| right | 矩形右下角的横坐标。 |
11897| bottom | 矩形右下角的纵坐标。 |
11898
11899**返回:**
11900
11901函数会返回一个指针,指针指向创建的矩形对象。
11902
11903
11904### OH_Drawing_RectDestroy()
11905
11906```
11907void OH_Drawing_RectDestroy (OH_Drawing_Rect* )
11908```
11909
11910**描述**
11911
11912用于销毁矩形对象并回收该对象占有的内存。
11913
11914**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11915
11916**起始版本:** 11
11917
11918**参数:**
11919
11920| 名称 | 描述 |
11921| -------- | -------- |
11922| OH_Drawing_Rect | 指向矩形对象的指针。 |
11923
11924
11925### OH_Drawing_RectGetBottom()
11926
11927```
11928float OH_Drawing_RectGetBottom (OH_Drawing_Rect* )
11929```
11930
11931**描述**
11932
11933用于获取给矩形设置的右下角的纵坐标。
11934
11935本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11936
11937OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11938
11939**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11940
11941**起始版本:** 12
11942
11943**参数:**
11944
11945| 名称 | 描述 |
11946| -------- | -------- |
11947| OH_Drawing_Rect | 指向矩形对象的指针。 |
11948
11949**返回:**
11950
11951矩形右下角的纵坐标。
11952
11953
11954### OH_Drawing_RectGetHeight()
11955
11956```
11957float OH_Drawing_RectGetHeight (OH_Drawing_Rect* )
11958```
11959
11960**描述**
11961
11962用于获取矩形对象高度,计算方式为设置的矩形的右下角纵坐标减去左上角纵坐标。
11963
11964本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11965
11966OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11967
11968**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11969
11970**起始版本:** 12
11971
11972**参数:**
11973
11974| 名称 | 描述 |
11975| -------- | -------- |
11976| OH_Drawing_Rect | 指向矩形对象的指针。 |
11977
11978**返回:**
11979
11980返回矩形对象的高度,单位为像素。
11981
11982
11983### OH_Drawing_RectGetLeft()
11984
11985```
11986float OH_Drawing_RectGetLeft (OH_Drawing_Rect* )
11987```
11988
11989**描述**
11990
11991用于获取给矩形设置的左上角的横坐标。
11992
11993本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11994
11995OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11996
11997**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11998
11999**起始版本:** 12
12000
12001**参数:**
12002
12003| 名称 | 描述 |
12004| -------- | -------- |
12005| OH_Drawing_Rect | 指向矩形对象的指针。 |
12006
12007**返回:**
12008
12009矩形左上角的横坐标。
12010
12011
12012### OH_Drawing_RectGetRight()
12013
12014```
12015float OH_Drawing_RectGetRight (OH_Drawing_Rect* )
12016```
12017
12018**描述**
12019
12020用于获取给矩形设置的右下角的横坐标。
12021
12022本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12023
12024OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12025
12026**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12027
12028**起始版本:** 12
12029
12030**参数:**
12031
12032| 名称 | 描述 |
12033| -------- | -------- |
12034| OH_Drawing_Rect | 指向矩形对象的指针。 |
12035
12036**返回:**
12037
12038矩形右下角的横坐标。
12039
12040
12041### OH_Drawing_RectGetTop()
12042
12043```
12044float OH_Drawing_RectGetTop (OH_Drawing_Rect* )
12045```
12046
12047**描述**
12048
12049用于获取给矩形设置的左上角的纵坐标。
12050
12051本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12052
12053OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12054
12055**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12056
12057**起始版本:** 12
12058
12059**参数:**
12060
12061| 名称 | 描述 |
12062| -------- | -------- |
12063| OH_Drawing_Rect | 指向矩形对象的指针。 |
12064
12065**返回:**
12066
12067矩形左上角的纵坐标。
12068
12069
12070### OH_Drawing_RectGetWidth()
12071
12072```
12073float OH_Drawing_RectGetWidth (OH_Drawing_Rect* )
12074```
12075
12076**描述**
12077
12078用于获取矩形对象的宽度,计算方式为设置的矩形的右下角横坐标减去左上角横坐标。
12079
12080本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12081
12082OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12083
12084**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12085
12086**起始版本:** 12
12087
12088**参数:**
12089
12090| 名称 | 描述 |
12091| -------- | -------- |
12092| OH_Drawing_Rect | 指向矩形对象的指针。 |
12093
12094**返回:**
12095
12096返回矩形对象的宽度,单位为像素。
12097
12098
12099### OH_Drawing_RectIntersect()
12100
12101```
12102bool OH_Drawing_RectIntersect (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other )
12103```
12104
12105**描述**
12106
12107用于判断两个矩形是否相交,若相交,将rect设置为两个矩形的交集。
12108
12109本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12110
12111rect、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12112
12113**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12114
12115**起始版本:** 12
12116
12117**参数:**
12118
12119| 名称 | 描述 |
12120| -------- | -------- |
12121| rect | 指向矩形对象的指针。 |
12122| other | 指向矩形对象的指针。 |
12123
12124**返回:**
12125
12126返回两个矩形是否相交的结果。true表示这两个矩形相交,rect被设置为两个矩形的交集;false表示不相交,rect保持不变。
12127
12128
12129### OH_Drawing_RectSetBottom()
12130
12131```
12132void OH_Drawing_RectSetBottom (OH_Drawing_Rect* rect, float bottom )
12133```
12134
12135**描述**
12136
12137用于设置矩形右下角的纵坐标。
12138
12139本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12140
12141rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12142
12143**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12144
12145**起始版本:** 12
12146
12147**参数:**
12148
12149| 名称 | 描述 |
12150| -------- | -------- |
12151| rect | 指向矩形对象的指针。 |
12152| bottom | 矩形右下角的纵坐标。 |
12153
12154
12155### OH_Drawing_RectSetLeft()
12156
12157```
12158void OH_Drawing_RectSetLeft (OH_Drawing_Rect* rect, float left )
12159```
12160
12161**描述**
12162
12163用于设置矩形左上角的横坐标。
12164
12165本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12166
12167rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12168
12169**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12170
12171**起始版本:** 12
12172
12173**参数:**
12174
12175| 名称 | 描述 |
12176| -------- | -------- |
12177| rect | 指向矩形对象的指针。 |
12178| left | 矩形左上角的横坐标。 |
12179
12180
12181### OH_Drawing_RectSetRight()
12182
12183```
12184void OH_Drawing_RectSetRight (OH_Drawing_Rect* rect, float right )
12185```
12186
12187**描述**
12188
12189用于设置矩形右下角的横坐标。
12190
12191本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12192
12193rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12194
12195**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12196
12197**起始版本:** 12
12198
12199**参数:**
12200
12201| 名称 | 描述 |
12202| -------- | -------- |
12203| rect | 指向矩形对象的指针。 |
12204| right | 矩形右下角的横坐标。 |
12205
12206
12207### OH_Drawing_RectSetTop()
12208
12209```
12210void OH_Drawing_RectSetTop (OH_Drawing_Rect* rect, float top )
12211```
12212
12213**描述**
12214
12215用于设置矩形左上角的纵坐标。
12216
12217本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12218
12219rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12220
12221**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12222
12223**起始版本:** 12
12224
12225**参数:**
12226
12227| 名称 | 描述 |
12228| -------- | -------- |
12229| rect | 指向矩形对象的指针。 |
12230| top | 矩形左上角的纵坐标。 |
12231
12232
12233### OH_Drawing_RegionCreate()
12234
12235```
12236OH_Drawing_Region* OH_Drawing_RegionCreate (void )
12237```
12238
12239**描述**
12240
12241用于创建一个区域对象,实现更精确的图形控制。
12242
12243**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12244
12245**起始版本:** 12
12246
12247**返回:**
12248
12249函数会返回一个指针,指针指向创建的区域对象。
12250
12251
12252### OH_Drawing_RegionDestroy()
12253
12254```
12255void OH_Drawing_RegionDestroy (OH_Drawing_Region* )
12256```
12257
12258**描述**
12259
12260用于销毁区域对象并回收该对象占有的内存。
12261
12262**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12263
12264**起始版本:** 12
12265
12266**参数:**
12267
12268| 名称 | 描述 |
12269| -------- | -------- |
12270| OH_Drawing_Region | 指向区域对象的指针。 |
12271
12272
12273### OH_Drawing_RegionSetRect()
12274
12275```
12276bool OH_Drawing_RegionSetRect (OH_Drawing_Region* region, const OH_Drawing_Rect* rect )
12277```
12278
12279**描述**
12280
12281用于尝试给区域对象设置矩形边界。
12282
12283本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12284
12285region、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12286
12287**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12288
12289**起始版本:** 12
12290
12291**参数:**
12292
12293| 名称 | 描述 |
12294| -------- | -------- |
12295| region | 指向区域对象的指针。 |
12296| rect | 指向矩形对象的指针。 |
12297
12298**返回:**
12299
12300返回区域对象设置矩形边界是否成功的结果。true表示设置矩形边界成功,false表示设置矩形边界失败。
12301
12302
12303### OH_Drawing_RegisterFont()
12304
12305```
12306uint32_t OH_Drawing_RegisterFont (OH_Drawing_FontCollection* , const char* fontFamily, const char* familySrc )
12307```
12308
12309**描述**
12310
12311用于在字体管理器中注册自定义字体,支持的字体文件格式包含:ttf、otf。
12312
12313**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12314
12315**起始版本:** 11
12316
12317**参数:**
12318
12319| 名称 | 描述 |
12320| -------- | -------- |
12321| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针。 |
12322| fontFamily | 指需要注册的字体的字体名称。 |
12323| familySrc | 指需要注册的字体文件的路径。 |
12324
12325**返回:**
12326
12327返回错误代码,0为成功,1为文件不存在,2为打开文件失败,3为读取文件失败,4为寻找文件失败,5为获取大小失败,9文件损坏。
12328
12329
12330### OH_Drawing_RegisterFontBuffer()
12331
12332```
12333uint32_t OH_Drawing_RegisterFontBuffer (OH_Drawing_FontCollection* , const char* fontFamily, uint8_t* fontBuffer, size_t length )
12334```
12335
12336**描述**
12337
12338用于在字体管理器中注册字体缓冲区。
12339
12340**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12341
12342**起始版本:** 11
12343
12344**参数:**
12345
12346| 名称 | 描述 |
12347| -------- | -------- |
12348| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针。 |
12349| fontFamily | 指需要注册的字体的字体名称。 |
12350| fontBuffer | 指需要注册的字体文件的缓冲区。 |
12351| length | 指需要注册的字体文件的长度。 |
12352
12353**返回:**
12354
12355返回错误代码,0为成功,6为缓冲区大小为零,7为字体集合为空,9文件损坏。
12356
12357
12358### OH_Drawing_RoundRectCreate()
12359
12360```
12361OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate (const OH_Drawing_Rect* , float xRad, float yRad )
12362```
12363
12364**描述**
12365
12366用于创建一个圆角矩形对象。
12367
12368本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12369
12370OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12371
12372**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12373
12374**起始版本:** 11
12375
12376**参数:**
12377
12378| 名称 | 描述 |
12379| -------- | -------- |
12380| OH_Drawing_Rect | 指向矩形对象的指针。 |
12381| xRad | X轴上的圆角半径,小于或等于0时无效。 |
12382| yRad | Y轴上的圆角半径,小于或等于0时无效。 |
12383
12384**返回:**
12385
12386函数会返回一个指针,指针指向创建的圆角矩形对象。
12387
12388
12389### OH_Drawing_RoundRectDestroy()
12390
12391```
12392void OH_Drawing_RoundRectDestroy (OH_Drawing_RoundRect* )
12393```
12394
12395**描述**
12396
12397用于销毁圆角矩形对象并回收该对象占有的内存。
12398
12399**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12400
12401**起始版本:** 11
12402
12403**参数:**
12404
12405| 名称 | 描述 |
12406| -------- | -------- |
12407| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
12408
12409
12410### OH_Drawing_RoundRectGetCorner()
12411
12412```
12413OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos )
12414```
12415
12416**描述**
12417
12418用于获取圆角矩形中指定圆角位置的圆角半径。
12419
12420本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12421
12422OH_Drawing_RoundRect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12423
12424**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12425
12426**起始版本:** 12
12427
12428**参数:**
12429
12430| 名称 | 描述 |
12431| -------- | -------- |
12432| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
12433| pos | 圆角位置的枚举,支持类型可见[OH_Drawing_CornerPos](#oh_drawing_cornerpos)。 |
12434
12435**返回:**
12436
12437返回指定圆角位置的圆角半径结构体[OH_Drawing_Corner_Radii](#oh_drawing_corner_radii),其中包含x轴方向和y轴方向上的半径。
12438
12439
12440### OH_Drawing_RoundRectSetCorner()
12441
12442```
12443void OH_Drawing_RoundRectSetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii  )
12444```
12445
12446**描述**
12447
12448用于设置圆角矩形中指定圆角位置的圆角半径。
12449
12450本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12451
12452OH_Drawing_RoundRect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12453
12454**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12455
12456**起始版本:** 12
12457
12458**参数:**
12459
12460| 名称 | 描述 |
12461| -------- | -------- |
12462| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
12463| pos | 圆角位置的枚举,支持类型可见[OH_Drawing_CornerPos](#oh_drawing_cornerpos)。 |
12464| OH_Drawing_Corner_Radii | 圆角半径结构体[OH_Drawing_Corner_Radii](#oh_drawing_corner_radii),其中包含x轴方向和y轴方向上的半径,半径需大于或等于0。 |
12465
12466
12467### OH_Drawing_SamplingOptionsCreate()
12468
12469```
12470OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate (OH_Drawing_FilterMode , OH_Drawing_MipmapMode  )
12471```
12472
12473**描述**
12474
12475创建一个采样选项对象。
12476
12477本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12478
12479OH_Drawing_MipmapMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12480
12481**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12482
12483**起始版本:** 12
12484
12485**参数:**
12486
12487| 名称 | 描述 |
12488| -------- | -------- |
12489| OH_Drawing_FilterMode | 过滤采样模式[OH_Drawing_FilterMode](#oh_drawing_filtermode)。 |
12490| OH_Drawing_MipmapMode | 多级渐远纹理采样模式[OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)。 |
12491
12492**返回:**
12493
12494函数会返回一个指针,指针指向创建的采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)。
12495
12496
12497### OH_Drawing_SamplingOptionsDestroy()
12498
12499```
12500void OH_Drawing_SamplingOptionsDestroy (OH_Drawing_SamplingOptions* )
12501```
12502
12503**描述**
12504
12505销毁采样选项对象并回收该对象占有内存。
12506
12507**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12508
12509**起始版本:** 12
12510
12511**参数:**
12512
12513| 名称 | 描述 |
12514| -------- | -------- |
12515| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针。 |
12516
12517
12518### OH_Drawing_SetTextStyleBackgroundBrush()
12519
12520```
12521void OH_Drawing_SetTextStyleBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
12522```
12523
12524**描述**
12525
12526设置指定文本样式中的背景色画刷。
12527
12528**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12529
12530**起始版本:** 12
12531
12532**参数:**
12533
12534| 名称 | 描述 |
12535| -------- | -------- |
12536| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12537| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 |
12538
12539
12540### OH_Drawing_SetTextStyleBackgroundPen()
12541
12542```
12543void OH_Drawing_SetTextStyleBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
12544```
12545
12546**描述**
12547
12548设置指定文本样式中的背景色画笔。
12549
12550**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12551
12552**起始版本:** 12
12553
12554**参数:**
12555
12556| 名称 | 描述 |
12557| -------- | -------- |
12558| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12559| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 |
12560
12561
12562### OH_Drawing_SetTextStyleBaseLine()
12563
12564```
12565void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle* , int  )
12566```
12567
12568**描述**
12569
12570设置字体基线位置。
12571
12572**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12573
12574**起始版本:** 8
12575
12576**参数:**
12577
12578| 名称 | 描述 |
12579| -------- | -------- |
12580| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12581| int | 设置字体基线位置,设置1基线位于底部,设置0或其它基线在中间偏下的位置,具体可见[OH_Drawing_TextBaseline](#oh_drawing_textbaseline)枚举。 |
12582
12583
12584### OH_Drawing_SetTextStyleColor()
12585
12586```
12587void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle* , uint32_t  )
12588```
12589
12590**描述**
12591
12592设置文本颜色。
12593
12594**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12595
12596**起始版本:** 8
12597
12598**参数:**
12599
12600| 名称 | 描述 |
12601| -------- | -------- |
12602| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12603| uint32_t | 颜色。 |
12604
12605
12606### OH_Drawing_SetTextStyleDecoration()
12607
12608```
12609void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle* , int  )
12610```
12611
12612**描述**
12613
12614设置指定文本样式中的装饰线类型。
12615
12616**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12617
12618**起始版本:** 8
12619
12620**参数:**
12621
12622| 名称 | 描述 |
12623| -------- | -------- |
12624| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12625| int | 设置装饰,设置1为下划线,设置2为上划线,设置3为删除线,设置0或其它为无装饰,具体可见[OH_Drawing_TextDecoration](#oh_drawing_textdecoration)枚举。 |
12626
12627
12628### OH_Drawing_SetTextStyleDecorationColor()
12629
12630```
12631void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle* , uint32_t  )
12632```
12633
12634**描述**
12635
12636设置指定文本样式中的装饰线颜色。
12637
12638**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12639
12640**起始版本:** 8
12641
12642**参数:**
12643
12644| 名称 | 描述 |
12645| -------- | -------- |
12646| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12647| uint32_t | 颜色。 |
12648
12649
12650### OH_Drawing_SetTextStyleDecorationStyle()
12651
12652```
12653void OH_Drawing_SetTextStyleDecorationStyle (OH_Drawing_TextStyle* , int  )
12654```
12655
12656**描述**
12657
12658设置指定文本样式中的装饰线样式。
12659
12660**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12661
12662**起始版本:** 11
12663
12664**参数:**
12665
12666| 名称 | 描述 |
12667| -------- | -------- |
12668| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12669| int | 设置的文本装饰样式,支持可选的装饰样式具体可见[OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)枚举。 |
12670
12671
12672### OH_Drawing_SetTextStyleDecorationThicknessScale()
12673
12674```
12675void OH_Drawing_SetTextStyleDecorationThicknessScale (OH_Drawing_TextStyle* , double  )
12676```
12677
12678**描述**
12679
12680设置文本装饰线的厚度缩放比例。
12681
12682**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12683
12684**起始版本:** 11
12685
12686**参数:**
12687
12688| 名称 | 描述 |
12689| -------- | -------- |
12690| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12691| double | 缩放比例。 |
12692
12693
12694### OH_Drawing_SetTextStyleEllipsis()
12695
12696```
12697void OH_Drawing_SetTextStyleEllipsis (OH_Drawing_TextStyle* , const char*  )
12698```
12699
12700**描述**
12701
12702设置文本的省略号内容。
12703
12704**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12705
12706**起始版本:** 11
12707
12708**参数:**
12709
12710| 名称 | 描述 |
12711| -------- | -------- |
12712| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12713| char\* | 设置省略号内容,数据类型为指向char的指针。 |
12714
12715
12716### OH_Drawing_SetTextStyleEllipsisModal()
12717
12718```
12719void OH_Drawing_SetTextStyleEllipsisModal (OH_Drawing_TextStyle* , int  )
12720```
12721
12722**描述**
12723
12724设置文本的省略号样式。
12725
12726**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12727
12728**起始版本:** 11
12729
12730**参数:**
12731
12732| 名称 | 描述 |
12733| -------- | -------- |
12734| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12735| int | 设置省略号样式,支持可选的省略号样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 |
12736
12737
12738### OH_Drawing_SetTextStyleFontFamilies()
12739
12740```
12741void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle* , int , const char* fontFamilies[] )
12742```
12743
12744**描述**
12745
12746设置字体类型。
12747
12748**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12749
12750**起始版本:** 8
12751
12752**参数:**
12753
12754| 名称 | 描述 |
12755| -------- | -------- |
12756| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12757| int | 字体名称数量。 |
12758| char | 指向字体类型的指针。 |
12759
12760
12761### OH_Drawing_SetTextStyleFontHeight()
12762
12763```
12764void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle* , double  )
12765```
12766
12767**描述**
12768
12769设置行高,按当前字体大小的倍数进行设置。
12770
12771**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12772
12773**起始版本:** 8
12774
12775**参数:**
12776
12777| 名称 | 描述 |
12778| -------- | -------- |
12779| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12780| double | 当前字体大小的倍数。 |
12781
12782
12783### OH_Drawing_SetTextStyleFontSize()
12784
12785```
12786void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle* , double  )
12787```
12788
12789**描述**
12790
12791设置字号。
12792
12793**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12794
12795**起始版本:** 8
12796
12797**参数:**
12798
12799| 名称 | 描述 |
12800| -------- | -------- |
12801| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12802| double | 字号。 |
12803
12804
12805### OH_Drawing_SetTextStyleFontStyle()
12806
12807```
12808void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle* , int  )
12809```
12810
12811**描述**
12812
12813设置字体风格。
12814
12815**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12816
12817**起始版本:** 8
12818
12819**参数:**
12820
12821| 名称 | 描述 |
12822| -------- | -------- |
12823| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12824| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 |
12825
12826
12827### OH_Drawing_SetTextStyleFontStyleStruct()
12828
12829```
12830void OH_Drawing_SetTextStyleFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle, OH_Drawing_FontStyleStruct fontStyle )
12831```
12832
12833**描述**
12834
12835设置文本样式中的字体样式,包括字体字重、字体宽度和字体斜度。
12836
12837**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12838
12839**起始版本:** 12
12840
12841**参数:**
12842
12843| 名称 | 描述 |
12844| -------- | -------- |
12845| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12846| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 |
12847
12848
12849### OH_Drawing_SetTextStyleFontWeight()
12850
12851```
12852void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle* , int  )
12853```
12854
12855**描述**
12856
12857设置字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。
12858
12859**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12860
12861**起始版本:** 8
12862
12863**参数:**
12864
12865| 名称 | 描述 |
12866| -------- | -------- |
12867| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12868| 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)枚举。 |
12869
12870
12871### OH_Drawing_SetTextStyleForegroundBrush()
12872
12873```
12874void OH_Drawing_SetTextStyleForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
12875```
12876
12877**描述**
12878
12879设置指定文本样式中的前景色画刷。
12880
12881**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12882
12883**起始版本:** 12
12884
12885**参数:**
12886
12887| 名称 | 描述 |
12888| -------- | -------- |
12889| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12890| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 |
12891
12892
12893### OH_Drawing_SetTextStyleForegroundPen()
12894
12895```
12896void OH_Drawing_SetTextStyleForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
12897```
12898
12899**描述**
12900
12901设置指定文本样式中的前景色画笔。
12902
12903**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12904
12905**起始版本:** 12
12906
12907**参数:**
12908
12909| 名称 | 描述 |
12910| -------- | -------- |
12911| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12912| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 |
12913
12914
12915### OH_Drawing_SetTextStyleHalfLeading()
12916
12917```
12918void OH_Drawing_SetTextStyleHalfLeading (OH_Drawing_TextStyle* , bool  )
12919```
12920
12921**描述**
12922
12923设置文本为一半行间距。
12924
12925**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12926
12927**起始版本:** 11
12928
12929**参数:**
12930
12931| 名称 | 描述 |
12932| -------- | -------- |
12933| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12934| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 |
12935
12936
12937### OH_Drawing_SetTextStyleLetterSpacing()
12938
12939```
12940void OH_Drawing_SetTextStyleLetterSpacing (OH_Drawing_TextStyle* , double  )
12941```
12942
12943**描述**
12944
12945设置文本的字符间距。
12946
12947**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12948
12949**起始版本:** 11
12950
12951**参数:**
12952
12953| 名称 | 描述 |
12954| -------- | -------- |
12955| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12956| double | 间距大小。 |
12957
12958
12959### OH_Drawing_SetTextStyleLocale()
12960
12961```
12962void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle* , const char*  )
12963```
12964
12965**描述**
12966
12967设置文本语言类型。
12968
12969**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12970
12971**起始版本:** 8
12972
12973**参数:**
12974
12975| 名称 | 描述 |
12976| -------- | -------- |
12977| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
12978| char | 语言类型,数据类型为指向char的指针,如'en'代表英文,'zh-Hans'代表简体中文,'zh-Hant'代表繁体中文。|
12979
12980
12981### OH_Drawing_SetTextStyleWordSpacing()
12982
12983```
12984void OH_Drawing_SetTextStyleWordSpacing (OH_Drawing_TextStyle* , double  )
12985```
12986
12987**描述**
12988
12989设置文本的单词间距。
12990
12991**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12992
12993**起始版本:** 11
12994
12995**参数:**
12996
12997| 名称 | 描述 |
12998| -------- | -------- |
12999| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
13000| double | 间距大小。 |
13001
13002
13003### OH_Drawing_SetTypographyStyleFontStyleStruct()
13004
13005```
13006void OH_Drawing_SetTypographyStyleFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle, OH_Drawing_FontStyleStruct fontStyle )
13007```
13008
13009**描述**
13010
13011设置文本字体样式,包括字体字重、字体宽度和字体斜度。
13012
13013**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13014
13015**起始版本:** 12
13016
13017**参数:**
13018
13019| 名称 | 描述 |
13020| -------- | -------- |
13021| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13022| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 |
13023
13024
13025### OH_Drawing_SetTypographyStyleTextStrutStyle()
13026
13027```
13028void OH_Drawing_SetTypographyStyleTextStrutStyle (OH_Drawing_TypographyStyle* , OH_Drawing_StrutStyle*  )
13029```
13030
13031**描述**
13032
13033设置文本支柱样式。
13034
13035**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13036
13037**起始版本:** 12
13038
13039**参数:**
13040
13041| 名称 | 描述 |
13042| -------- | -------- |
13043| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13044| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针,由[OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle)获取。 |
13045
13046
13047### OH_Drawing_SetTypographyTextAlign()
13048
13049```
13050void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle* , int  )
13051```
13052
13053**描述**
13054
13055设置文本对齐方式。
13056
13057**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13058
13059**起始版本:** 8
13060
13061**参数:**
13062
13063| 名称 | 描述 |
13064| -------- | -------- |
13065| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13066| int | 设置文本对齐方式,设置1为右对齐,设置2为居中对齐,设置3为两端对齐,设置4为与文字方向相同,设置5为文字方向相反,设置0或其它为左对齐,具体可见[OH_Drawing_TextAlign](#oh_drawing_textalign)枚举。 |
13067
13068
13069### OH_Drawing_SetTypographyTextBreakStrategy()
13070
13071```
13072void OH_Drawing_SetTypographyTextBreakStrategy (OH_Drawing_TypographyStyle* , int  )
13073```
13074
13075**描述**
13076
13077设置文本的中断策略。
13078
13079**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13080
13081**起始版本:** 11
13082
13083**参数:**
13084
13085| 名称 | 描述 |
13086| -------- | -------- |
13087| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13088| int | 设置中断策略,支持可选的中断策略具体可见[OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy)枚举。 |
13089
13090
13091### OH_Drawing_SetTypographyTextDirection()
13092
13093```
13094void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle* , int  )
13095```
13096
13097**描述**
13098
13099设置指定排版样式中的文本方向。
13100
13101**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13102
13103**起始版本:** 8
13104
13105**参数:**
13106
13107| 名称 | 描述 |
13108| -------- | -------- |
13109| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13110| int | 设置文本方向,设置0为从右到左,设置1或其他值为从左到右,具体可见[OH_Drawing_TextDirection](#oh_drawing_textdirection)枚举。 |
13111
13112
13113### OH_Drawing_SetTypographyTextEllipsis()
13114
13115```
13116void OH_Drawing_SetTypographyTextEllipsis (OH_Drawing_TypographyStyle* style, const char* ellipsis )
13117```
13118
13119**描述**
13120
13121设置省略号样式。
13122
13123**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13124
13125**起始版本:** 12
13126
13127**参数:**
13128
13129| 名称 | 描述 |
13130| -------- | -------- |
13131| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13132| char | 省略号样式。 |
13133
13134
13135### OH_Drawing_SetTypographyTextEllipsisModal()
13136
13137```
13138void OH_Drawing_SetTypographyTextEllipsisModal (OH_Drawing_TypographyStyle* , int  )
13139```
13140
13141**描述**
13142
13143设置文本的省略号样式。
13144
13145**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13146
13147**起始版本:** 11
13148
13149**参数:**
13150
13151| 名称 | 描述 |
13152| -------- | -------- |
13153| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13154| int | 设置省略号样式,支持可选的省略号样式样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 |
13155
13156
13157### OH_Drawing_SetTypographyTextFontFamily()
13158
13159```
13160void OH_Drawing_SetTypographyTextFontFamily (OH_Drawing_TypographyStyle* , const char*  )
13161```
13162
13163**描述**
13164
13165设置字体家族的名称。
13166
13167**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13168
13169**起始版本:** 12
13170
13171**参数:**
13172
13173| 名称 | 描述 |
13174| -------- | -------- |
13175| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13176| char | 字体家族的名称,数据类型为指向char的指针。 |
13177
13178
13179### OH_Drawing_SetTypographyTextFontHeight()
13180
13181```
13182void OH_Drawing_SetTypographyTextFontHeight (OH_Drawing_TypographyStyle* , double  )
13183```
13184
13185**描述**
13186
13187设置文本排版字体高度。
13188
13189**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13190
13191**起始版本:** 12
13192
13193**参数:**
13194
13195| 名称 | 描述 |
13196| -------- | -------- |
13197| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13198| double | 字体高度。 |
13199
13200
13201### OH_Drawing_SetTypographyTextFontSize()
13202
13203```
13204void OH_Drawing_SetTypographyTextFontSize (OH_Drawing_TypographyStyle* , double  )
13205```
13206
13207**描述**
13208
13209设置文本排版字号。
13210
13211**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13212
13213**起始版本:** 12
13214
13215**参数:**
13216
13217| 名称 | 描述 |
13218| -------- | -------- |
13219| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13220| double | 字号(大于0)。 |
13221
13222
13223### OH_Drawing_SetTypographyTextFontStyle()
13224
13225```
13226void OH_Drawing_SetTypographyTextFontStyle (OH_Drawing_TypographyStyle* , int  )
13227```
13228
13229**描述**
13230
13231设置字体风格。
13232
13233**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13234
13235**起始版本:** 12
13236
13237**参数:**
13238
13239| 名称 | 描述 |
13240| -------- | -------- |
13241| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13242| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 |
13243
13244
13245### OH_Drawing_SetTypographyTextFontWeight()
13246
13247```
13248void OH_Drawing_SetTypographyTextFontWeight (OH_Drawing_TypographyStyle* , int  )
13249```
13250
13251**描述**
13252
13253设置文本排版字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。
13254
13255**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13256
13257**起始版本:** 12
13258
13259**参数:**
13260
13261| 名称 | 描述 |
13262| -------- | -------- |
13263| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13264| 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)枚举。 |
13265
13266
13267### OH_Drawing_SetTypographyTextHalfLeading()
13268
13269```
13270void OH_Drawing_SetTypographyTextHalfLeading (OH_Drawing_TypographyStyle* , bool  )
13271```
13272
13273**描述**
13274
13275设置文本排版是否为一半行间距。
13276
13277**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13278
13279**起始版本:** 12
13280
13281**参数:**
13282
13283| 名称 | 描述 |
13284| -------- | -------- |
13285| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13286| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 |
13287
13288
13289### OH_Drawing_SetTypographyTextLineStyleFontFamilies()
13290
13291```
13292void OH_Drawing_SetTypographyTextLineStyleFontFamilies (OH_Drawing_TypographyStyle* , int , const char* fontFamilies[] )
13293```
13294
13295**描述**
13296
13297设置文本排版行样式字体类型。
13298
13299**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13300
13301**起始版本:** 12
13302
13303**参数:**
13304
13305| 名称 | 描述 |
13306| -------- | -------- |
13307| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13308| int | 字体名称数量。 |
13309| char | 指向字体类型的指针。 |
13310
13311
13312### OH_Drawing_SetTypographyTextLineStyleFontHeight()
13313
13314```
13315void OH_Drawing_SetTypographyTextLineStyleFontHeight (OH_Drawing_TypographyStyle* , double  )
13316```
13317
13318**描述**
13319
13320设置文本排版行样式字体高度。
13321
13322**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13323
13324**起始版本:** 12
13325
13326**参数:**
13327
13328| 名称 | 描述 |
13329| -------- | -------- |
13330| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13331| double | 字体高度。 |
13332
13333
13334### OH_Drawing_SetTypographyTextLineStyleFontSize()
13335
13336```
13337void OH_Drawing_SetTypographyTextLineStyleFontSize (OH_Drawing_TypographyStyle* , double  )
13338```
13339
13340**描述**
13341
13342设置文本排版行样式字号。
13343
13344**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13345
13346**起始版本:** 12
13347
13348**参数:**
13349
13350| 名称 | 描述 |
13351| -------- | -------- |
13352| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13353| double | 字号(大于0)。 |
13354
13355
13356### OH_Drawing_SetTypographyTextLineStyleFontStyle()
13357
13358```
13359void OH_Drawing_SetTypographyTextLineStyleFontStyle (OH_Drawing_TypographyStyle* , int  )
13360```
13361
13362**描述**
13363
13364设置文本排版行样式风格。
13365
13366**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13367
13368**起始版本:** 12
13369
13370**参数:**
13371
13372| 名称 | 描述 |
13373| -------- | -------- |
13374| OH_Drawing_TypographyStyle | 指向文本风格指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13375| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 |
13376
13377
13378### OH_Drawing_SetTypographyTextLineStyleFontWeight()
13379
13380```
13381void OH_Drawing_SetTypographyTextLineStyleFontWeight (OH_Drawing_TypographyStyle* , int  )
13382```
13383
13384**描述**
13385
13386设置文本排版行样式字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。
13387
13388**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13389
13390**起始版本:** 12
13391
13392**参数:**
13393
13394| 名称 | 描述 |
13395| -------- | -------- |
13396| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13397| 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)枚举。 |
13398
13399
13400### OH_Drawing_SetTypographyTextLineStyleHalfLeading()
13401
13402```
13403void OH_Drawing_SetTypographyTextLineStyleHalfLeading (OH_Drawing_TypographyStyle* , bool  )
13404```
13405
13406**描述**
13407
13408设置文本排版行样式是否为一半行间距。
13409
13410**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13411
13412**起始版本:** 12
13413
13414**参数:**
13415
13416| 名称 | 描述 |
13417| -------- | -------- |
13418| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13419| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 |
13420
13421
13422### OH_Drawing_SetTypographyTextLineStyleOnly()
13423
13424```
13425void OH_Drawing_SetTypographyTextLineStyleOnly (OH_Drawing_TypographyStyle* , bool  )
13426```
13427
13428**描述**
13429
13430设置文本排版是否仅启用行样式。
13431
13432**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13433
13434**起始版本:** 12
13435
13436**参数:**
13437
13438| 名称 | 描述 |
13439| -------- | -------- |
13440| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13441| bool | 设置仅启用行样式是否生效,true表示生效,false表示不生效。 |
13442
13443
13444### OH_Drawing_SetTypographyTextLineStyleSpacingScale()
13445
13446```
13447void OH_Drawing_SetTypographyTextLineStyleSpacingScale (OH_Drawing_TypographyStyle* , double  )
13448```
13449
13450**描述**
13451
13452设置文本排版行样式间距比例。
13453
13454**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13455
13456**起始版本:** 12
13457
13458**参数:**
13459
13460| 名称 | 描述 |
13461| -------- | -------- |
13462| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13463| double | 间距比例。 |
13464
13465
13466### OH_Drawing_SetTypographyTextLocale()
13467
13468```
13469void OH_Drawing_SetTypographyTextLocale (OH_Drawing_TypographyStyle* style, const char* locale )
13470```
13471
13472**描述**
13473
13474设置指定排版样式的语言环境。
13475
13476**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13477
13478**起始版本:** 12
13479
13480**参数:**
13481
13482| 名称 | 描述 |
13483| -------- | -------- |
13484| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13485| char |  语言环境,数据类型为指向char的指针,如'en'代表英文,'zh-Hans'代表简体中文,'zh-Hant'代表繁体中文。 |
13486
13487
13488### OH_Drawing_SetTypographyTextMaxLines()
13489
13490```
13491void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle* , int  )
13492```
13493
13494**描述**
13495
13496设置文本最大行数。
13497
13498**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13499
13500**起始版本:** 8
13501
13502**参数:**
13503
13504| 名称 | 描述 |
13505| -------- | -------- |
13506| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13507| int | 最大行数。 |
13508
13509### OH_Drawing_SetTypographyTextSplitRatio()
13510
13511```
13512void OH_Drawing_SetTypographyTextSplitRatio (OH_Drawing_TypographyStyle* style, float textSplitRatio )
13513```
13514
13515**描述**
13516
13517设置文本划分比率。
13518
13519**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13520
13521**起始版本:** 12
13522
13523**参数:**
13524
13525| 名称 | 描述 |
13526| -------- | -------- |
13527| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13528| float | 文本划分比率。 |
13529
13530
13531### OH_Drawing_SetTypographyTextStyle()
13532
13533```
13534void OH_Drawing_SetTypographyTextStyle (OH_Drawing_TypographyStyle* , OH_Drawing_TextStyle*  )
13535```
13536
13537**描述**
13538
13539设置段落样式。
13540
13541**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13542
13543**起始版本:** 12
13544
13545**参数:**
13546
13547| 名称 | 描述 |
13548| -------- | -------- |
13549| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13550| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
13551
13552
13553### OH_Drawing_SetTypographyTextUseLineStyle()
13554
13555```
13556void OH_Drawing_SetTypographyTextUseLineStyle (OH_Drawing_TypographyStyle* , bool  )
13557```
13558
13559**描述**
13560
13561设置文本排版是否启用行样式。
13562
13563**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13564
13565**起始版本:** 12
13566
13567**参数:**
13568
13569| 名称 | 描述 |
13570| -------- | -------- |
13571| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13572| bool | 设置行样式是否启用,true表示启用,false表示不启用。 |
13573
13574
13575### OH_Drawing_SetTypographyTextWordBreakType()
13576
13577```
13578void OH_Drawing_SetTypographyTextWordBreakType (OH_Drawing_TypographyStyle* , int  )
13579```
13580
13581**描述**
13582
13583设置单词的断词方式。
13584
13585**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13586
13587**起始版本:** 11
13588
13589**参数:**
13590
13591| 名称 | 描述 |
13592| -------- | -------- |
13593| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
13594| int | 设置断词方式,支持可选的断词方式样式具体可见[OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype)枚举。 |
13595
13596
13597### OH_Drawing_ShaderEffectCreateImageShader()
13598
13599```
13600OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader (OH_Drawing_Image* , OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions* , const OH_Drawing_Matrix*  )
13601```
13602
13603**描述**
13604
13605创建图像着色器。此接口不建议用于录制类型的画布,会影响性能。
13606
13607本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13608
13609OH_Drawing_Image、OH_Drawing_SamplingOptions任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13610
13611tileX、tileY任意一个不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
13612
13613**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13614
13615**起始版本:** 12
13616
13617**参数:**
13618
13619| 名称 | 描述 |
13620| -------- | -------- |
13621| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
13622| tileX | 水平方向着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
13623| tileY | 垂直方向着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
13624| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针。 |
13625| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。如果矩阵指针为空,默认传入单位矩阵。 |
13626
13627**返回:**
13628
13629返回创建的着色器对象的指针。
13630
13631
13632### OH_Drawing_ShaderEffectCreateLinearGradient()
13633
13634```
13635OH_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  )
13636```
13637
13638**描述**
13639
13640创建着色器,在两个指定点之间生成线性渐变。
13641
13642本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13643
13644startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13645
13646OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
13647
13648**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13649
13650**起始版本:** 11
13651
13652**参数:**
13653
13654| 名称 | 描述 |
13655| -------- | -------- |
13656| startPt | 表示渐变的起点。 |
13657| endPt | 表示渐变的终点。 |
13658| colors | 表示在两个点之间分布的颜色。 |
13659| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在起点和终点之间。 |
13660| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
13661| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
13662
13663**返回:**
13664
13665返回创建的着色器对象的指针。
13666
13667
13668### OH_Drawing_ShaderEffectCreateRadialGradient()
13669
13670```
13671OH_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  )
13672```
13673
13674**描述**
13675
13676创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。
13677
13678本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13679
13680centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13681
13682OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
13683
13684**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13685
13686**起始版本:** 11
13687
13688**参数:**
13689
13690| 名称 | 描述 |
13691| -------- | -------- |
13692| centerPt | 表示渐变的圆心。 |
13693| radius | 表示渐变的圆半径,需为非负数。 |
13694| colors | 表示在径向上分布的颜色。 |
13695| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在径向上。 |
13696| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
13697| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
13698
13699**返回:**
13700
13701返回创建的着色器对象的指针。
13702
13703
13704### OH_Drawing_ShaderEffectCreateSweepGradient()
13705
13706```
13707OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient (const OH_Drawing_Point* centerPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode  )
13708```
13709
13710**描述**
13711
13712创建着色器,在给定中心的情况下生成扇形渐变。颜色从0°到360°渐变被称为扇形渐变。
13713
13714本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13715
13716centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13717
13718OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
13719
13720**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13721
13722**起始版本:** 11
13723
13724**参数:**
13725
13726| 名称 | 描述 |
13727| -------- | -------- |
13728| centerPt | 表示渐变的圆心。 |
13729| colors | 表示在两个点之间分布的颜色。 |
13730| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在0°和360°之间。 |
13731| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
13732| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
13733
13734**返回:**
13735
13736返回创建的着色器对象的指针。
13737
13738
13739### OH_Drawing_ShaderEffectDestroy()
13740
13741```
13742void OH_Drawing_ShaderEffectDestroy (OH_Drawing_ShaderEffect* )
13743```
13744
13745**描述**
13746
13747销毁着色器对象,并收回该对象占用的内存。
13748
13749**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13750
13751**起始版本:** 11
13752
13753**参数:**
13754
13755| 名称 | 描述 |
13756| -------- | -------- |
13757| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针。 |
13758
13759
13760### OH_Drawing_SurfaceCreateFromGpuContext()
13761
13762```
13763OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext (OH_Drawing_GpuContext* , bool budgeted, OH_Drawing_Image_Info  )
13764```
13765
13766**描述**
13767
13768使用图形处理器上下文创建一个surface对象,用于管理画布绘制的内容。
13769
13770本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13771
13772OH_Drawing_GpuContext为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13773
13774**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13775
13776**起始版本:** 12
13777
13778**参数:**
13779
13780| 名称 | 描述 |
13781| -------- | -------- |
13782| OH_Drawing_GpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 |
13783| budgeted | 用于控制内存分配是否计入缓存预算,true则计入高速缓存预算,false则不计入高速缓存预算。 |
13784| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)结构体。 |
13785
13786**返回:**
13787
13788返回一个指针,指针指向创建的surface对象[OH_Drawing_Surface](#oh_drawing_surface)。
13789
13790
13791### OH_Drawing_SurfaceDestroy()
13792
13793```
13794void OH_Drawing_SurfaceDestroy (OH_Drawing_Surface* )
13795```
13796
13797**描述**
13798
13799销毁surface对象并回收该对象占用的内存。
13800
13801**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13802
13803**起始版本:** 12
13804
13805**参数:**
13806
13807| 名称 | 描述 |
13808| -------- | -------- |
13809| OH_Drawing_Surface | 指向创建的surface对象的指针。 |
13810
13811
13812### OH_Drawing_SurfaceGetCanvas()
13813
13814```
13815OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas (OH_Drawing_Surface* )
13816```
13817
13818**描述**
13819
13820通过surface对象获取画布对象。
13821
13822本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13823
13824OH_Drawing_Surface为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13825
13826**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13827
13828**起始版本:** 12
13829
13830**参数:**
13831
13832| 名称 | 描述 |
13833| -------- | -------- |
13834| OH_Drawing_Surface | 指向创建的surface对象的指针。 |
13835
13836**返回:**
13837
13838返回一个指针,指针指向创建的画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)。返回的指针不需要由调用者管理。
13839
13840
13841### OH_Drawing_TextBlobBuilderAllocRunPos()
13842
13843```
13844const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos (OH_Drawing_TextBlobBuilder* , const OH_Drawing_Font* , int32_t count, const OH_Drawing_Rect*  )
13845```
13846
13847**描述**
13848
13849申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理, 当调用[OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake)后禁止使用。
13850
13851本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13852
13853OH_Drawing_TextBlobBuilder、OH_Drawing_Font任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13854
13855**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13856
13857**起始版本:** 11
13858
13859**参数:**
13860
13861| 名称 | 描述 |
13862| -------- | -------- |
13863| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 |
13864| OH_Drawing_Font | 指向字体对象的指针。 |
13865| count | 文字的数量。 |
13866| OH_Drawing_Rect | 文本的边界框,为NULL表示不设置边界框。 |
13867
13868
13869### OH_Drawing_TextBlobBuilderCreate()
13870
13871```
13872OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate (void )
13873```
13874
13875**描述**
13876
13877用于创建一个文本构造器对象。
13878
13879**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13880
13881**起始版本:** 11
13882
13883**返回:**
13884
13885函数会返回一个指针,指针指向创建的文本构造器对象。
13886
13887
13888### OH_Drawing_TextBlobBuilderDestroy()
13889
13890```
13891void OH_Drawing_TextBlobBuilderDestroy (OH_Drawing_TextBlobBuilder* )
13892```
13893
13894**描述**
13895
13896用于销毁文本构造器对象并回收该对象占有的内存。
13897
13898**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13899
13900**起始版本:** 11
13901
13902**参数:**
13903
13904| 名称 | 描述 |
13905| -------- | -------- |
13906| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 |
13907
13908
13909### OH_Drawing_TextBlobBuilderMake()
13910
13911```
13912OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake (OH_Drawing_TextBlobBuilder* )
13913```
13914
13915**描述**
13916
13917用于从文本构造器中创建文本对象。
13918
13919本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13920
13921OH_Drawing_TextBlobBuilder为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13922
13923**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13924
13925**起始版本:** 11
13926
13927**参数:**
13928
13929| 名称 | 描述 |
13930| -------- | -------- |
13931| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 |
13932
13933**返回:**
13934
13935返回一个指针,指针指向创建的文本对象。
13936
13937
13938### OH_Drawing_TextBlobCreateFromPosText()
13939
13940```
13941OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText (const void * text, size_t byteLength, OH_Drawing_Point2D* , const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
13942```
13943
13944**描述**
13945
13946使用文本创建文本对象,文本对象中每个字符的坐标由OH_Drawing_Point2D数组中对应的坐标信息决定。
13947
13948本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13949
13950text、OH_Drawing_Point2D、OH_Drawing_Font任意一个为NULL或byteLength等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
13951
13952OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
13953
13954**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13955
13956**起始版本:** 12
13957
13958**参数:**
13959
13960| 名称 | 描述 |
13961| -------- | -------- |
13962| text | 指向文本的指针。 |
13963| byteLength | 文本的字节长度。 |
13964| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 二维点[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)数组首地址,数组个数由[OH_Drawing_FontCountText](#oh_drawing_fontcounttext)计算结果决定。 |
13965| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
13966| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 |
13967
13968**返回:**
13969
13970函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。
13971
13972
13973### OH_Drawing_TextBlobCreateFromString()
13974
13975```
13976OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString (const char* str, const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
13977```
13978
13979**描述**
13980
13981使用字符串创建文本对象。
13982
13983本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13984
13985str、OH_Drawing_Font任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
13986
13987OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
13988
13989**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13990
13991**起始版本:** 12
13992
13993**参数:**
13994
13995| 名称 | 描述 |
13996| -------- | -------- |
13997| str | 指向字符串的指针。 |
13998| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
13999| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。当前只有TEXT_ENCODING_UTF8生效,其余编码类型也会被视为TEXT_ENCODING_UTF8。 |
14000
14001**返回:**
14002
14003函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。
14004
14005
14006### OH_Drawing_TextBlobCreateFromText()
14007
14008```
14009OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText (const void * text, size_t byteLength, const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
14010```
14011
14012**描述**
14013
14014使用文本创建一个文本对象。
14015
14016本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
14017
14018text、OH_Drawing_Font任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
14019
14020OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
14021
14022**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14023
14024**起始版本:** 12
14025
14026**参数:**
14027
14028| 名称 | 描述 |
14029| -------- | -------- |
14030| text | 指向文本的指针。 |
14031| byteLength | 文本的字节长度。 |
14032| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
14033| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 |
14034
14035**返回:**
14036
14037函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。
14038
14039
14040### OH_Drawing_TextBlobDestroy()
14041
14042```
14043void OH_Drawing_TextBlobDestroy (OH_Drawing_TextBlob* )
14044```
14045
14046**描述**
14047
14048用于销毁文本对象并回收该对象占有的内存。
14049
14050**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14051
14052**起始版本:** 11
14053
14054**参数:**
14055
14056| 名称 | 描述 |
14057| -------- | -------- |
14058| OH_Drawing_TextBlob | 指向文本对象的指针。 |
14059
14060
14061### OH_Drawing_TextBlobGetBounds()
14062
14063```
14064void OH_Drawing_TextBlobGetBounds (OH_Drawing_TextBlob* , OH_Drawing_Rect*  )
14065```
14066
14067**描述**
14068
14069获取文本对象的边界范围。
14070
14071本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
14072
14073OH_Drawing_TextBlob、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
14074
14075**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14076
14077**起始版本:** 12
14078
14079**参数:**
14080
14081| 名称 | 描述 |
14082| -------- | -------- |
14083| OH_Drawing_TextBlob | 指向文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)的指针。 |
14084| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针, 开发者可调用[OH_Drawing_RectCreate](#oh_drawing_rectcreate)接口创建。 |
14085
14086
14087### OH_Drawing_TextStyleAddFontFeature()
14088
14089```
14090void OH_Drawing_TextStyleAddFontFeature (OH_Drawing_TextStyle* , const char* tag, int value )
14091```
14092
14093**描述**
14094
14095添加文本字体特征。
14096
14097**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14098
14099**起始版本:** 12
14100
14101**参数:**
14102
14103| 名称 | 描述 |
14104| -------- | -------- |
14105| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14106| char | 指向字体特征键值对中关键字所标识的字符串。 |
14107| int | 要设置的字体特征键值对的值。 |
14108
14109
14110### OH_Drawing_TextStyleAddFontVariation()
14111
14112```
14113void OH_Drawing_TextStyleAddFontVariation (OH_Drawing_TextStyle* , const char* , const float  )
14114```
14115
14116**描述**
14117
14118添加可变字体属性。对应的字体文件(.ttf文件)需要支持可变调节,此接口才能生效。当对应的字体不支持可变调节时,此接口调用不生效。
14119
14120**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14121
14122**起始版本:** 12
14123
14124**参数:**
14125
14126| 名称 | 描述 |
14127| -------- | -------- |
14128| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14129| char\* | 可变字体属性键值对中的键。目前仅支持'wght',表示字重属性。 |
14130| float | 设置的可变字体属性键值对的值。目前默认字体下字重属性支持的取值范围为[0,900]。 |
14131
14132
14133### OH_Drawing_TextStyleAddShadow()
14134
14135```
14136void OH_Drawing_TextStyleAddShadow (OH_Drawing_TextStyle* , const OH_Drawing_TextShadow*  )
14137```
14138
14139**描述**
14140
14141字体阴影容器中添加字体阴影元素。
14142
14143**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14144
14145**起始版本:** 12
14146
14147**参数:**
14148
14149| 名称 | 描述 |
14150| -------- | -------- |
14151| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14152| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 |
14153
14154
14155### OH_Drawing_TextStyleClearFontFeature()
14156
14157```
14158void OH_Drawing_TextStyleClearFontFeature (OH_Drawing_TextStyle* )
14159```
14160
14161**描述**
14162
14163清除字体特征map容器中的所有内容。
14164
14165**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14166
14167**起始版本:** 12
14168
14169**参数:**
14170
14171| 名称 | 描述 |
14172| -------- | -------- |
14173| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14174
14175
14176### OH_Drawing_TextStyleClearShadows()
14177
14178```
14179void OH_Drawing_TextStyleClearShadows (OH_Drawing_TextStyle* )
14180```
14181
14182**描述**
14183
14184清除字体阴影容器中的所有元素。
14185
14186**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14187
14188**起始版本:** 12
14189
14190**参数:**
14191
14192| 名称 | 描述 |
14193| -------- | -------- |
14194| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14195
14196
14197### OH_Drawing_TextStyleDestroyFontFamilies()
14198
14199```
14200void OH_Drawing_TextStyleDestroyFontFamilies (char** fontFamilies, size_t num )
14201```
14202
14203**描述**
14204
14205释放字体类型名称列表占用的内存。
14206
14207**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14208
14209**起始版本:** 12
14210
14211**参数:**
14212
14213| 名称 | 描述 |
14214| -------- | -------- |
14215| char\*\* | 指向字体类型名称列表的指针。 |
14216| size_t | 字体类型名称列表的数量。 |
14217
14218
14219### OH_Drawing_TextStyleDestroyFontFeatures()
14220
14221```
14222void OH_Drawing_TextStyleDestroyFontFeatures (OH_Drawing_FontFeature* , size_t fontFeatureSize )
14223```
14224
14225**描述**
14226
14227释放存放字体特征所有内容的结构体数组所占用的空间。
14228
14229**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14230
14231**起始版本:** 12
14232
14233**参数:**
14234
14235| 名称 | 描述 |
14236| -------- | -------- |
14237| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | 指向存放容器所有键值对的结构体数组指针,由[OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures)获取。 |
14238| fontFeatureSize | 存放容器所有键值对的结构体数组的大小。 |
14239
14240
14241### OH_Drawing_TextStyleGetBackgroundBrush()
14242
14243```
14244void OH_Drawing_TextStyleGetBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
14245```
14246
14247**描述**
14248
14249返回设置的背景色画刷。
14250
14251**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14252
14253**起始版本:** 12
14254
14255**参数:**
14256
14257| 名称 | 描述 |
14258| -------- | -------- |
14259| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14260| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 |
14261
14262
14263### OH_Drawing_TextStyleGetBackgroundPen()
14264
14265```
14266void OH_Drawing_TextStyleGetBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
14267```
14268
14269**描述**
14270
14271返回设置的背景色画笔。
14272
14273**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14274
14275**起始版本:** 12
14276
14277**参数:**
14278
14279| 名称 | 描述 |
14280| -------- | -------- |
14281| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14282| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 |
14283
14284
14285### OH_Drawing_TextStyleGetBaseline()
14286
14287```
14288OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline (OH_Drawing_TextStyle* )
14289```
14290
14291**描述**
14292
14293获取字体基线位置。
14294
14295**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14296
14297**起始版本:** 12
14298
14299**参数:**
14300
14301| 名称 | 描述 |
14302| -------- | -------- |
14303| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14304
14305**返回:**
14306
14307返回字体基线位置,具体可见[OH_Drawing_TextBaseline](#oh_drawing_textbaseline)枚举。
14308
14309
14310### OH_Drawing_TextStyleGetBaselineShift()
14311
14312```
14313double OH_Drawing_TextStyleGetBaselineShift (OH_Drawing_TextStyle* )
14314```
14315
14316**描述**
14317
14318获取文本的基线漂移。
14319
14320**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14321
14322**起始版本:** 12
14323
14324**参数:**
14325
14326| 名称 | 描述 |
14327| -------- | -------- |
14328| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14329
14330**返回:**
14331
14332double 基线漂移的值。
14333
14334
14335### OH_Drawing_TextStyleGetColor()
14336
14337```
14338uint32_t OH_Drawing_TextStyleGetColor (OH_Drawing_TextStyle* )
14339```
14340
14341**描述**
14342
14343获取文本颜色。
14344
14345**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14346
14347**起始版本:** 12
14348
14349**参数:**
14350
14351| 名称 | 描述 |
14352| -------- | -------- |
14353| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14354
14355**返回:**
14356
14357uint32_t 返回文本颜色。
14358
14359
14360### OH_Drawing_TextStyleGetDecorationStyle()
14361
14362```
14363OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle (OH_Drawing_TextStyle* )
14364```
14365
14366**描述**
14367
14368获取文本装饰样式。
14369
14370**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14371
14372**起始版本:** 12
14373
14374**参数:**
14375
14376| 名称 | 描述 |
14377| -------- | -------- |
14378| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14379
14380**返回:**
14381
14382返回文本装饰样式,具体可见[OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)枚举。
14383
14384
14385### OH_Drawing_TextStyleGetFontFamilies()
14386
14387```
14388char** OH_Drawing_TextStyleGetFontFamilies (OH_Drawing_TextStyle* , size_t* num )
14389```
14390
14391**描述**
14392
14393获取字体类型名称列表。
14394
14395**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14396
14397**起始版本:** 12
14398
14399**参数:**
14400
14401| 名称 | 描述 |
14402| -------- | -------- |
14403| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14404| num | 指向字体名称数量的指针。 |
14405
14406**返回:**
14407
14408返回获取到的字体类型列表。
14409
14410
14411### OH_Drawing_TextStyleGetFontFeatures()
14412
14413```
14414OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures (OH_Drawing_TextStyle* )
14415```
14416
14417**描述**
14418
14419获取字体特征map容器中的所有内容。
14420
14421**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14422
14423**起始版本:** 12
14424
14425**参数:**
14426
14427| 名称 | 描述 |
14428| -------- | -------- |
14429| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14430
14431**返回:**
14432
14433[OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) 要获取的字体特征容器的所有内容,指向存放容器所有键值对的一个结构体数组。
14434
14435
14436### OH_Drawing_TextStyleGetFontFeatureSize()
14437
14438```
14439size_t OH_Drawing_TextStyleGetFontFeatureSize (OH_Drawing_TextStyle* )
14440```
14441
14442**描述**
14443
14444获取字体特征map容器的大小。
14445
14446**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14447
14448**起始版本:** 12
14449
14450**参数:**
14451
14452| 名称 | 描述 |
14453| -------- | -------- |
14454| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14455
14456**返回:**
14457
14458size_t 字体特征map容器的大小。
14459
14460
14461### OH_Drawing_TextStyleGetFontHeight()
14462
14463```
14464double OH_Drawing_TextStyleGetFontHeight (OH_Drawing_TextStyle* )
14465```
14466
14467**描述**
14468
14469获取字体高度。
14470
14471**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14472
14473**起始版本:** 12
14474
14475**参数:**
14476
14477| 名称 | 描述 |
14478| -------- | -------- |
14479| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14480
14481**返回:**
14482
14483double 返回字体高度。
14484
14485
14486### OH_Drawing_TextStyleGetFontMetrics()
14487
14488```
14489bool OH_Drawing_TextStyleGetFontMetrics (OH_Drawing_Typography* , OH_Drawing_TextStyle* , OH_Drawing_Font_Metrics*  )
14490```
14491
14492**描述**
14493
14494获取文本字体属性。
14495
14496**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14497
14498**起始版本:** 12
14499
14500**参数:**
14501
14502| 名称 | 描述 |
14503| -------- | -------- |
14504| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
14505| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14506| OH_Drawing_Font_Metrics | 指向字体属性对象[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)的指针,由[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)获取。 |
14507
14508**返回:**
14509
14510是否获取到字体属性,true表示获取到字体属性,false表示未获取到字体属性。
14511
14512
14513### OH_Drawing_TextStyleGetFontSize()
14514
14515```
14516double OH_Drawing_TextStyleGetFontSize (OH_Drawing_TextStyle* )
14517```
14518
14519**描述**
14520
14521获取字号。
14522
14523**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14524
14525**起始版本:** 12
14526
14527**参数:**
14528
14529| 名称 | 描述 |
14530| -------- | -------- |
14531| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14532
14533**返回:**
14534
14535double 返回字号。
14536
14537
14538### OH_Drawing_TextStyleGetFontStyle()
14539
14540```
14541OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle (OH_Drawing_TextStyle* )
14542```
14543
14544**描述**
14545
14546获取字体风格。
14547
14548**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14549
14550**起始版本:** 12
14551
14552**参数:**
14553
14554| 名称 | 描述 |
14555| -------- | -------- |
14556| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14557
14558**返回:**
14559
14560返回字体风格,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。
14561
14562
14563### OH_Drawing_TextStyleGetFontStyleStruct()
14564
14565```
14566OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle)
14567```
14568
14569**描述**
14570
14571获取文本样式中的字体样式,包括字体字重、字体宽度和字体斜度。
14572
14573**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14574
14575**起始版本:** 12
14576
14577**参数:**
14578
14579| 名称 | 描述 |
14580| -------- | -------- |
14581| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14582
14583**返回:**
14584
14585返回获取到的字体样式对象,包括字体字重、字体宽度和字体斜度信息。
14586
14587
14588### OH_Drawing_TextStyleGetFontWeight()
14589
14590```
14591OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight (OH_Drawing_TextStyle* )
14592```
14593
14594**描述**
14595
14596获取字重。
14597
14598**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14599
14600**起始版本:** 12
14601
14602**参数:**
14603
14604| 名称 | 描述 |
14605| -------- | -------- |
14606| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14607
14608**返回:**
14609
14610返回字重,具体可见[OH_Drawing_FontWeight](#oh_drawing_fontweight)枚举。
14611
14612
14613### OH_Drawing_TextStyleGetForegroundBrush()
14614
14615```
14616void OH_Drawing_TextStyleGetForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
14617```
14618
14619**描述**
14620
14621返回设置的前景色画刷。
14622
14623**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14624
14625**起始版本:** 12
14626
14627**参数:**
14628
14629| 名称 | 描述 |
14630| -------- | -------- |
14631| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14632| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 |
14633
14634
14635### OH_Drawing_TextStyleGetForegroundPen()
14636
14637```
14638void OH_Drawing_TextStyleGetForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
14639```
14640
14641**描述**
14642
14643返回设置的前景色画笔。
14644
14645**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14646
14647**起始版本:** 12
14648
14649**参数:**
14650
14651| 名称 | 描述 |
14652| -------- | -------- |
14653| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14654| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 |
14655
14656
14657### OH_Drawing_TextStyleGetHalfLeading()
14658
14659```
14660bool OH_Drawing_TextStyleGetHalfLeading (OH_Drawing_TextStyle* )
14661```
14662
14663**描述**
14664
14665获取当前文档是否设置为一半行间距。
14666
14667**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14668
14669**起始版本:** 12
14670
14671**参数:**
14672
14673| 名称 | 描述 |
14674| -------- | -------- |
14675| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14676
14677**返回:**
14678
14679bool 返回当前文档设置为一半行间距的结果,true表示设置为一半行间距,false表示未设置为一半行间距。
14680
14681
14682### OH_Drawing_TextStyleGetLetterSpacing()
14683
14684```
14685double OH_Drawing_TextStyleGetLetterSpacing (OH_Drawing_TextStyle* )
14686```
14687
14688**描述**
14689
14690获取文本的字符间距。
14691
14692**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14693
14694**起始版本:** 12
14695
14696**参数:**
14697
14698| 名称 | 描述 |
14699| -------- | -------- |
14700| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14701
14702**返回:**
14703
14704double 返回字符间距大小。
14705
14706
14707### OH_Drawing_TextStyleGetLocale()
14708
14709```
14710const char* OH_Drawing_TextStyleGetLocale (OH_Drawing_TextStyle* )
14711```
14712
14713**描述**
14714
14715获取文本语言类型。
14716
14717**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14718
14719**起始版本:** 12
14720
14721**参数:**
14722
14723| 名称 | 描述 |
14724| -------- | -------- |
14725| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14726
14727**返回:**
14728
14729char 返回语言环境,数据类型为指向char的指针。语言环境格式为:语言-国家。如zh-CN表示中文(中国),en-US表示英语(美国)等。具体参考BCP 47语言标签标准。
14730
14731
14732### OH_Drawing_TextStyleGetShadowCount()
14733
14734```
14735int OH_Drawing_TextStyleGetShadowCount (OH_Drawing_TextStyle* )
14736```
14737
14738**描述**
14739
14740获取字体阴影容器的大小。
14741
14742**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14743
14744**起始版本:** 12
14745
14746**参数:**
14747
14748| 名称 | 描述 |
14749| -------- | -------- |
14750| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14751
14752**返回:**
14753
14754int 返回字体阴影容器的大小。
14755
14756
14757### OH_Drawing_TextStyleGetShadows()
14758
14759```
14760OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows (OH_Drawing_TextStyle* )
14761```
14762
14763**描述**
14764
14765获取字体阴影容器。不再需要[OH_Drawing_TextShadow](#oh_drawing_textshadow)时,请使用[OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows)接口释放该对象的指针。
14766
14767**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14768
14769**起始版本:** 12
14770
14771**参数:**
14772
14773| 名称 | 描述 |
14774| -------- | -------- |
14775| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14776
14777**返回:**
14778
14779返回指向字体阴影容器[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针。
14780
14781
14782### OH_Drawing_TextStyleGetShadowWithIndex()
14783
14784```
14785OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex (OH_Drawing_TextStyle* , int  )
14786```
14787
14788**描述**
14789
14790根据下标获取字体阴影容器中的元素。
14791
14792**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14793
14794**起始版本:** 12
14795
14796**参数:**
14797
14798| 名称 | 描述 |
14799| -------- | -------- |
14800| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14801| int | 下标索引。 |
14802
14803**返回:**
14804
14805返回指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针。
14806
14807
14808### OH_Drawing_TextStyleGetWordSpacing()
14809
14810```
14811double OH_Drawing_TextStyleGetWordSpacing (OH_Drawing_TextStyle* )
14812```
14813
14814**描述**
14815
14816获取文本的单词间距。
14817
14818**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14819
14820**起始版本:** 12
14821
14822**参数:**
14823
14824| 名称 | 描述 |
14825| -------- | -------- |
14826| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14827
14828**返回:**
14829
14830double 返回单词间距大小。
14831
14832
14833### OH_Drawing_TextStyleIsAttributeMatched()
14834
14835```
14836bool OH_Drawing_TextStyleIsAttributeMatched (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType )
14837```
14838
14839**描述**
14840
14841判断两个字体风格对象是否有一样的文本样式类型。
14842
14843**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14844
14845**起始版本:** 12
14846
14847**参数:**
14848
14849| 名称 | 描述 |
14850| -------- | -------- |
14851| style | 比较的字体风格对象。 |
14852| comparedStyle | 比较的字体风格对象。 |
14853| textStyleType | 文本样式类型枚举[OH_Drawing_TextStyleType](#oh_drawing_textstyletype)。 |
14854
14855**返回:**
14856
14857返回两个TextStyle对象是否有对应的文本样式类型一样的结果,true表示其文本样式类型一样,false表示不一样。
14858
14859
14860### OH_Drawing_TextStyleIsEqual()
14861
14862```
14863bool OH_Drawing_TextStyleIsEqual (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle )
14864```
14865
14866**描述**
14867
14868判断两个字体风格对象是否相等。
14869
14870**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14871
14872**起始版本:** 12
14873
14874**参数:**
14875
14876| 名称 | 描述 |
14877| -------- | -------- |
14878| style | 比较的字体风格对象。 |
14879| comparedStyle | 比较的字体风格对象。 |
14880
14881**返回:**
14882
14883返回两个字体风格对象是否相等的结果,true表示相等,false表示不相等。
14884
14885
14886### OH_Drawing_TextStyleIsEqualByFont()
14887
14888```
14889bool OH_Drawing_TextStyleIsEqualByFont (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle )
14890```
14891
14892**描述**
14893
14894判断两个字体风格对象的字体样式属性是否相等。
14895
14896**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14897
14898**起始版本:** 12
14899
14900**参数:**
14901
14902| 名称 | 描述 |
14903| -------- | -------- |
14904| style | 比较的字体风格对象。 |
14905| comparedStyle | 比较的字体风格对象。 |
14906
14907**返回:**
14908
14909返回两个字体风格对象的字体样式属性是否相等的结果。
14910
14911
14912### OH_Drawing_TextStyleIsPlaceholder()
14913
14914```
14915bool OH_Drawing_TextStyleIsPlaceholder (OH_Drawing_TextStyle* style)
14916```
14917
14918**描述**
14919
14920返回是否有设置文本占位符。
14921
14922**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14923
14924**起始版本:** 12
14925
14926**参数:**
14927
14928| 名称 | 描述 |
14929| -------- | -------- |
14930| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14931
14932**返回:**
14933
14934返回是否有设置文本占位符,true表示有设置文本占位符,false表示未设置文本占位符。
14935
14936
14937### OH_Drawing_TextStyleSetBackgroundRect()
14938
14939```
14940void OH_Drawing_TextStyleSetBackgroundRect (OH_Drawing_TextStyle* , const OH_Drawing_RectStyle_Info* , int styleId )
14941```
14942
14943**描述**
14944
14945设置文本背景矩形框和样式id。样式id仅当背景框为圆角矩形时有效。
14946
14947**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14948
14949**起始版本:** 12
14950
14951**参数:**
14952
14953| 名称 | 描述 |
14954| -------- | -------- |
14955| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14956| [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | 指向[OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md)对象的指针。 |
14957| int | 要设置的样式id,仅当背景框为圆角矩形时有效。文本处理时会被划分为多个分段,每个分段都有自己的TextStyle,id标识着这个分段将被绘制于第几个背景矩形框中。 若一行中每个分段的id全为0,表示所有分段绘制在同一个圆角矩形背景框中; 若一行中的id为0, 1,则id为0的分段绘制在一个圆角矩形背景框内,id为1的分段绘制在另一个圆角矩形背景框内,以此类推。 |
14958
14959
14960### OH_Drawing_TextStyleSetBaselineShift()
14961
14962```
14963void OH_Drawing_TextStyleSetBaselineShift (OH_Drawing_TextStyle* , double lineShift )
14964```
14965
14966**描述**
14967
14968设置文本的基线漂移。
14969
14970**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14971
14972**起始版本:** 12
14973
14974**参数:**
14975
14976| 名称 | 描述 |
14977| -------- | -------- |
14978| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14979| double | 文本的基线漂移。 |
14980
14981
14982### OH_Drawing_TextStyleSetPlaceholder()
14983
14984```
14985void OH_Drawing_TextStyleSetPlaceholder (OH_Drawing_TextStyle* style)
14986```
14987
14988**描述**
14989
14990设置占位符。
14991
14992**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14993
14994**起始版本:** 12
14995
14996**参数:**
14997
14998| 名称 | 描述 |
14999| -------- | -------- |
15000| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
15001
15002
15003### OH_Drawing_TypefaceCreateDefault()
15004
15005```
15006OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault (void )
15007```
15008
15009**描述**
15010
15011用于创建一个默认的字形对象。
15012
15013**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15014
15015**起始版本:** 11
15016
15017**返回:**
15018
15019返回一个指针,指针指向创建的字形对象。
15020
15021
15022### OH_Drawing_TypefaceCreateFromFile()
15023
15024```
15025OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile (const char* path, int index )
15026```
15027
15028**描述**
15029
15030通过文件创建一个字形对象。
15031
15032本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15033
15034path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15035
15036**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15037
15038**起始版本:** 12
15039
15040**参数:**
15041
15042| 名称 | 描述 |
15043| -------- | -------- |
15044| path | 指向文件路径的指针。 |
15045| index | 文件索引。 |
15046
15047**返回:**
15048
15049函数返回一个指针,指针指向创建的字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
15050
15051
15052### OH_Drawing_TypefaceCreateFromStream()
15053
15054```
15055OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream (OH_Drawing_MemoryStream* , int32_t index )
15056```
15057
15058**描述**
15059
15060通过内存流创建一个字形对象。如果内存流是无效的字体文件,返回空指针。 内存流传入后,所有权转移,开发者不能再释放它。
15061
15062本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15063
15064OH_Drawing_MemoryStream为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15065
15066**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15067
15068**起始版本:** 12
15069
15070**参数:**
15071
15072| 名称 | 描述 |
15073| -------- | -------- |
15074| OH_Drawing_MemoryStream | 指向内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)的指针。 |
15075| index | 内存流索引。 |
15076
15077**返回:**
15078
15079返回一个指针,指针指向创建的字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
15080
15081
15082### OH_Drawing_TypefaceDestroy()
15083
15084```
15085void OH_Drawing_TypefaceDestroy (OH_Drawing_Typeface* )
15086```
15087
15088**描述**
15089
15090用于销毁字形对象并回收该对象占有的内存。
15091
15092**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15093
15094**起始版本:** 11
15095
15096**参数:**
15097
15098| 名称 | 描述 |
15099| -------- | -------- |
15100| OH_Drawing_Typeface | 指向字形对象的指针。 |
15101
15102
15103### OH_Drawing_TypographyDestroyEllipsis()
15104
15105```
15106void OH_Drawing_TypographyDestroyEllipsis (char* ellipsis)
15107```
15108
15109**描述**
15110
15111释放省略号名称列表占用的内存。
15112
15113**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15114
15115**起始版本:** 12
15116
15117**参数:**
15118
15119| 名称 | 描述 |
15120| -------- | -------- |
15121| ellipsis | 表示指向省略号名称列表的指针。 |
15122
15123
15124### OH_Drawing_TypographyDestroyLineFontMetrics()
15125
15126```
15127void OH_Drawing_TypographyDestroyLineFontMetrics (OH_Drawing_Font_Metrics* )
15128```
15129
15130**描述**
15131
15132释放指定行所有字体度量结构体集合所占用的所有空间。
15133
15134**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15135
15136**起始版本:** 12
15137
15138**参数:**
15139
15140| 名称 | 描述 |
15141| -------- | -------- |
15142| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | 指示要释放空间的指定行所有字体度量结构体集合的第一个地址。 |
15143
15144
15145### OH_Drawing_TypographyDidExceedMaxLines()
15146
15147```
15148bool OH_Drawing_TypographyDidExceedMaxLines (OH_Drawing_Typography* )
15149```
15150
15151**描述**
15152
15153获取排版对象中文本是否超过最大行,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,如果没有通过[OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines)接口设置最大行,则返回false。
15154
15155**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15156
15157**起始版本:** 11
15158
15159**参数:**
15160
15161| 名称 | 描述 |
15162| -------- | -------- |
15163| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15164
15165**返回:**
15166
15167返回文本是否超过最大行,true表示超过,false表示未超过。
15168
15169
15170### OH_Drawing_TypographyGetAlphabeticBaseline()
15171
15172```
15173double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography* )
15174```
15175
15176**描述**
15177
15178获取字母文字基线。
15179
15180**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15181
15182**起始版本:** 9
15183
15184**参数:**
15185
15186| 名称 | 描述 |
15187| -------- | -------- |
15188| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15189
15190**返回:**
15191
15192返回字母文字基线。
15193
15194
15195### OH_Drawing_TypographyGetEffectiveAlignment()
15196
15197```
15198int OH_Drawing_TypographyGetEffectiveAlignment (OH_Drawing_TypographyStyle* style)
15199```
15200
15201**描述**
15202
15203获取文字对齐方式。
15204
15205**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15206
15207**起始版本:** 12
15208
15209**参数:**
15210
15211| 名称 | 描述 |
15212| -------- | -------- |
15213| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15214
15215**返回:**
15216
15217返回文字对齐方式。
15218
15219
15220### OH_Drawing_TypographyGetGlyphPositionAtCoordinate()
15221
15222```
15223OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate (OH_Drawing_Typography* , double , double  )
15224```
15225
15226**描述**
15227
15228获取坐标处文本的索引位置和亲和性。
15229
15230**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15231
15232**起始版本:** 11
15233
15234**参数:**
15235
15236| 名称 | 描述 |
15237| -------- | -------- |
15238| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15239| double | 光标的x坐标。 |
15240| double | 光标的y坐标。 |
15241
15242**返回:**
15243
15244返回坐标处字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。
15245
15246
15247### OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster()
15248
15249```
15250OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster (OH_Drawing_Typography* , double , double  )
15251```
15252
15253**描述**
15254
15255获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。
15256
15257**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15258
15259**起始版本:** 11
15260
15261**参数:**
15262
15263| 名称 | 描述 |
15264| -------- | -------- |
15265| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15266| double | 光标的x坐标。 |
15267| double | 光标的y坐标。 |
15268
15269**返回:**
15270
15271返回坐标处指定类型字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。
15272
15273
15274### OH_Drawing_TypographyGetHeight()
15275
15276```
15277double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography* )
15278```
15279
15280**描述**
15281
15282获取排版对象整体的高度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
15283
15284**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15285
15286**起始版本:** 9
15287
15288**参数:**
15289
15290| 名称 | 描述 |
15291| -------- | -------- |
15292| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15293
15294**返回:**
15295
15296返回高度。
15297
15298
15299### OH_Drawing_TypographyGetIdeographicBaseline()
15300
15301```
15302double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography* )
15303```
15304
15305**描述**
15306
15307获取表意文字基线。
15308
15309**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15310
15311**起始版本:** 9
15312
15313**参数:**
15314
15315| 名称 | 描述 |
15316| -------- | -------- |
15317| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15318
15319**返回:**
15320
15321返回表意文字基线。
15322
15323
15324### OH_Drawing_TypographyGetIndentsWithIndex()
15325
15326```
15327float OH_Drawing_TypographyGetIndentsWithIndex (OH_Drawing_Typography* , int  )
15328```
15329
15330**描述**
15331
15332根据行索引获取排版对象缩进容器中的元素,行索引从0开始。
15333
15334**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15335
15336**起始版本:** 12
15337
15338**参数:**
15339
15340| 名称 | 描述 |
15341| -------- | -------- |
15342| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15343| int | 下标索引。 |
15344
15345**返回:**
15346
15347float 返回索引对应的元素值。
15348
15349
15350### OH_Drawing_TypographyGetLineCount()
15351
15352```
15353size_t OH_Drawing_TypographyGetLineCount (OH_Drawing_Typography* )
15354```
15355
15356**描述**
15357
15358获取排版对象中文本行数,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
15359
15360**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15361
15362**起始版本:** 11
15363
15364**参数:**
15365
15366| 名称 | 描述 |
15367| -------- | -------- |
15368| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15369
15370**返回:**
15371
15372返回行数。
15373
15374
15375### OH_Drawing_TypographyGetLineFontMetrics()
15376
15377```
15378OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics (OH_Drawing_Typography* , size_t lineNumber, size_t* fontMetricsSize )
15379```
15380
15381**描述**
15382
15383从排版对象中目标行获取所有字体度量信息,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,否则会返回空指针。不再需要[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)时,请使用[OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics)接口释放该对象的指针。
15384
15385**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15386
15387**起始版本:** 12
15388
15389**参数:**
15390
15391| 名称 | 描述 |
15392| -------- | -------- |
15393| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15394| lineNumber | 指定行数,取值为整数,最小有效值为1,最大行取决于文本输入后字体引擎解析出来的行数,若输入值大于最大行会返回错误值并打印错误消息。 |
15395| fontMetricsSize | 指示从当前行返回的字体度量结构的大小。 |
15396
15397**返回:**
15398
15399返回当前行的所有字体度量信息。
15400
15401
15402### OH_Drawing_TypographyGetLineHeight()
15403
15404```
15405double OH_Drawing_TypographyGetLineHeight (OH_Drawing_Typography* , int  )
15406```
15407
15408**描述**
15409
15410获取排版对象中指定行的行高,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
15411
15412**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15413
15414**起始版本:** 11
15415
15416**参数:**
15417
15418| 名称 | 描述 |
15419| -------- | -------- |
15420| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15421| int | 要指定的行数。 |
15422
15423**返回:**
15424
15425返回指定行的行高。
15426
15427
15428### OH_Drawing_TypographyGetLineInfo()
15429
15430```
15431bool OH_Drawing_TypographyGetLineInfo (OH_Drawing_Typography* , int , bool , bool , OH_Drawing_LineMetrics*  )
15432```
15433
15434**描述**
15435
15436获取排版对象中指定行的位置信息或指定行第一个字符的位置信息,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
15437
15438**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15439
15440**起始版本:** 12
15441
15442**参数:**
15443
15444| 名称 | 描述 |
15445| -------- | -------- |
15446| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15447| int | 行号。 |
15448| bool | true为获取整行的位置信息,false为获取第一个字符的位置信息。 |
15449| bool | 文字宽度是否包含空白符,true表示不包含空白符,false表示包含空白符。 |
15450| OH_Drawing_LineMetrics | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 |
15451
15452**返回:**
15453
15454指定行的行位置信息或第一个字符的位置信息是否成功获取,true表示成功获取,false表示未成功获取。
15455
15456
15457### OH_Drawing_TypographyGetLineMetrics()
15458
15459```
15460OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics (OH_Drawing_Typography* )
15461```
15462
15463**描述**
15464
15465获取排版对象的行位置信息,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。不再需要[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)时,请使用[OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics)接口释放该对象的指针。
15466
15467**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15468
15469**起始版本:** 12
15470
15471**参数:**
15472
15473| 名称 | 描述 |
15474| -------- | -------- |
15475| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15476
15477**返回:**
15478
15479返回指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针。
15480
15481
15482### OH_Drawing_TypographyGetLineMetricsAt()
15483
15484```
15485bool OH_Drawing_TypographyGetLineMetricsAt (OH_Drawing_Typography* , int , OH_Drawing_LineMetrics*  )
15486```
15487
15488**描述**
15489
15490获取排版对象的指定行位置信息,具体参见[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)结构体,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
15491
15492**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15493
15494**起始版本:** 12
15495
15496**参数:**
15497
15498| 名称 | 描述 |
15499| -------- | -------- |
15500| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15501| int | 要获取的行数。 |
15502| [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)获取。 |
15503
15504**返回:**
15505
15506行位置信息对象是否成功获取,true表示成功获取,false表示未成功获取。
15507
15508
15509### OH_Drawing_TypographyGetLineTextRange()
15510
15511```
15512OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange (OH_Drawing_Typography* , int , bool  )
15513```
15514
15515**描述**
15516
15517获取排版对象中行的边界,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。该接口只能获取已有行的边界,即输入行索引从0开始,最大行索引为[OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) - 1。
15518
15519**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15520
15521**起始版本:** 12
15522
15523**参数:**
15524
15525| 名称 | 描述 |
15526| -------- | -------- |
15527| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15528| int | 行索引。 |
15529| bool | 设置返回的边界是否包含空格,true为包含空格,false为不包含空格。 |
15530
15531**返回:**
15532
15533返回指向行边界对象的指针[OH_Drawing_Range](#oh_drawing_range)。
15534
15535
15536### OH_Drawing_TypographyGetLineWidth()
15537
15538```
15539double OH_Drawing_TypographyGetLineWidth (OH_Drawing_Typography* , int  )
15540```
15541
15542**描述**
15543
15544获取指定行的行宽,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
15545
15546**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15547
15548**起始版本:** 11
15549
15550**参数:**
15551
15552| 名称 | 描述 |
15553| -------- | -------- |
15554| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15555| int | 要指定的行数。 |
15556
15557**返回:**
15558
15559返回指定行的行宽。
15560
15561
15562### OH_Drawing_TypographyGetLongestLine()
15563
15564```
15565double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography* )
15566```
15567
15568**描述**
15569
15570获取排版对象最长行的宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。
15571
15572**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15573
15574**起始版本:** 9
15575
15576**参数:**
15577
15578| 名称 | 描述 |
15579| -------- | -------- |
15580| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15581
15582**返回:**
15583
15584返回最长行的宽度。
15585
15586
15587### OH_Drawing_TypographyGetMaxIntrinsicWidth()
15588
15589```
15590double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography* )
15591```
15592
15593**描述**
15594
15595获取排版对象的最大固有宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
15596
15597**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15598
15599**起始版本:** 9
15600
15601**参数:**
15602
15603| 名称 | 描述 |
15604| -------- | -------- |
15605| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15606
15607**返回:**
15608
15609返回最大固有宽度。
15610
15611
15612### OH_Drawing_TypographyGetMaxWidth()
15613
15614```
15615double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography* )
15616```
15617
15618**描述**
15619
15620获取用户设置的排版宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
15621
15622**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15623
15624**起始版本:** 9
15625
15626**参数:**
15627
15628| 名称 | 描述 |
15629| -------- | -------- |
15630| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15631
15632**返回:**
15633
15634返回最大宽度。
15635
15636
15637### OH_Drawing_TypographyGetMinIntrinsicWidth()
15638
15639```
15640double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography* )
15641```
15642
15643**描述**
15644
15645获取排版对象的最小固有宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
15646
15647**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15648
15649**起始版本:** 9
15650
15651**参数:**
15652
15653| 名称 | 描述 |
15654| -------- | -------- |
15655| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15656
15657**返回:**
15658
15659返回最小固有宽度。
15660
15661
15662### OH_Drawing_TypographyGetRectsForPlaceholders()
15663
15664```
15665OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders (OH_Drawing_Typography* )
15666```
15667
15668**描述**
15669
15670获取排版对象中占位符的文本框,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。不再需要[OH_Drawing_TextBox](#oh_drawing_textbox)时,请使用[OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox)接口释放该对象的指针。
15671
15672**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15673
15674**起始版本:** 11
15675
15676**参数:**
15677
15678| 名称 | 描述 |
15679| -------- | -------- |
15680| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15681
15682**返回:**
15683
15684返回占位符的文本框,返回类型为[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。
15685
15686### OH_Drawing_TypographyGetRectsForRange()
15687
15688```
15689OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange (OH_Drawing_Typography* , size_t , size_t , OH_Drawing_RectHeightStyle , OH_Drawing_RectWidthStyle  )
15690```
15691
15692**描述**
15693
15694获取排版对象中指定范围内的文本框,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。不再需要[OH_Drawing_TextBox](#oh_drawing_textbox)时,请使用[OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox)接口释放该对象的指针。
15695
15696**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15697
15698**起始版本:** 11
15699
15700**参数:**
15701
15702| 名称 | 描述 |
15703| -------- | -------- |
15704| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15705| size_t | 设置开始位置。 |
15706| size_t | 设置结束位置。 |
15707| OH_Drawing_RectHeightStyle | 设置高度样式,支持可选的高度样式具体可见[OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle)枚举。 |
15708| OH_Drawing_RectWidthStyle | 设置宽度样式,支持可选的宽度样式具体可见[OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)枚举。 |
15709
15710**返回:**
15711
15712返回指定范围内的文本框,具体可见[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。
15713
15714
15715### OH_Drawing_TypographyGetTextAlign()
15716
15717```
15718OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign (OH_Drawing_TypographyStyle* )
15719```
15720
15721**描述**
15722
15723获取文本对齐方式。
15724
15725**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15726
15727**起始版本:** 12
15728
15729**参数:**
15730
15731| 名称 | 描述 |
15732| -------- | -------- |
15733| OH_Drawing_TypographyStyle | 表示指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15734
15735**返回:**
15736
15737返回文本对齐方式。1为右对齐,2为居中对齐,3为两端对齐,4为与文字方向相同,5为文字方向相反,0或其它为左对齐, 具体可见[OH_Drawing_TextAlign](#oh_drawing_textalign)枚举。
15738
15739
15740### OH_Drawing_TypographyGetTextDirection()
15741
15742```
15743OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection (OH_Drawing_TypographyStyle* )
15744```
15745
15746**描述**
15747
15748获取指定排版样式中的文本方向。
15749
15750**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15751
15752**起始版本:** 12
15753
15754**参数:**
15755
15756| 名称 | 描述 |
15757| -------- | -------- |
15758| OH_Drawing_TypographyStyle | 表示指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15759
15760**返回:**
15761
15762返回文本方向。0为从右到左,1为从左到右,具体可见[OH_Drawing_TextDirection](#oh_drawing_textdirection)枚举。
15763
15764
15765### OH_Drawing_TypographyGetTextEllipsis()
15766
15767```
15768char* OH_Drawing_TypographyGetTextEllipsis (OH_Drawing_TypographyStyle* )
15769```
15770
15771**描述**
15772
15773获取设置的省略号内容。
15774
15775**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15776
15777**起始版本:** 12
15778
15779**参数:**
15780
15781| 名称 | 描述 |
15782| -------- | -------- |
15783| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15784
15785**返回:**
15786
15787返回设置的省略号内容。
15788
15789
15790### OH_Drawing_TypographyGetTextMaxLines()
15791
15792```
15793size_t OH_Drawing_TypographyGetTextMaxLines (OH_Drawing_TypographyStyle* )
15794```
15795
15796**描述**
15797
15798获取文本的最大行数。
15799
15800**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15801
15802**起始版本:** 12
15803
15804**参数:**
15805
15806| 名称 | 描述 |
15807| -------- | -------- |
15808| OH_Drawing_TypographyStyle | 表示指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15809
15810**返回:**
15811
15812返回结果为文本最大行数。
15813
15814
15815### OH_Drawing_TypographyGetTextStyle()
15816
15817```
15818OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle (OH_Drawing_TypographyStyle* style)
15819```
15820
15821**描述**
15822
15823获取指定排版样式中设置的默认文本样式。
15824
15825**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15826
15827**起始版本:** 12
15828
15829**参数:**
15830
15831| 名称 | 描述 |
15832| -------- | -------- |
15833| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15834
15835**返回:**
15836
15837返回指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针。
15838
15839
15840### OH_Drawing_TypographyGetUnresolvedGlyphsCount()
15841
15842```
15843int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount (OH_Drawing_Typography* )
15844```
15845
15846**描述**
15847
15848获取文本中尚未解析的字形的数量,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用并生效之后调用。
15849
15850**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15851
15852**起始版本:** 12
15853
15854**参数:**
15855
15856| 名称 | 描述 |
15857| -------- | -------- |
15858| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15859
15860**返回:**
15861
15862返回文本中尚未解析的字形的数量。
15863
15864
15865### OH_Drawing_TypographyGetWordBoundary()
15866
15867```
15868OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary (OH_Drawing_Typography* , size_t  )
15869```
15870
15871**描述**
15872
15873获取排版对象中单词的边界。
15874
15875**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15876
15877**起始版本:** 11
15878
15879**参数:**
15880
15881| 名称 | 描述 |
15882| -------- | -------- |
15883| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
15884| size_t | 单词索引。 |
15885
15886**返回:**
15887
15888返回单词边界,返回类型为[OH_Drawing_Range](#oh_drawing_range)结构体。
15889
15890
15891### OH_Drawing_TypographyHandlerAddPlaceholder()
15892
15893```
15894void OH_Drawing_TypographyHandlerAddPlaceholder (OH_Drawing_TypographyCreate* , OH_Drawing_PlaceholderSpan*  )
15895```
15896
15897**描述**
15898
15899设置占位符。
15900
15901**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15902
15903**起始版本:** 11
15904
15905**参数:**
15906
15907| 名称 | 描述 |
15908| -------- | -------- |
15909| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
15910| OH_Drawing_PlaceholderSpan | 指向[OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md)对象的指针。 |
15911
15912
15913### OH_Drawing_TypographyHandlerAddSymbol()
15914
15915```
15916void OH_Drawing_TypographyHandlerAddSymbol (OH_Drawing_TypographyCreate* , uint32_t symbol )
15917```
15918
15919**描述**
15920
15921设置排版创建过程中的符号。
15922
15923**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15924
15925**起始版本:** 12
15926
15927**参数:**
15928
15929| 名称 | 描述 |
15930| -------- | -------- |
15931| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
15932| 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) |
15933
15934
15935### OH_Drawing_TypographyHandlerAddText()
15936
15937```
15938void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate* , const char*  )
15939```
15940
15941**描述**
15942
15943设置文本内容。
15944
15945**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15946
15947**起始版本:** 8
15948
15949**参数:**
15950
15951| 名称 | 描述 |
15952| -------- | -------- |
15953| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
15954| char | 指向文本内容的指针。 |
15955
15956
15957### OH_Drawing_TypographyHandlerPopTextStyle()
15958
15959```
15960void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate* )
15961```
15962
15963**描述**
15964
15965排版弹出。
15966
15967**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15968
15969**起始版本:** 8
15970
15971**参数:**
15972
15973| 名称 | 描述 |
15974| -------- | -------- |
15975| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
15976
15977
15978### OH_Drawing_TypographyHandlerPushTextStyle()
15979
15980```
15981void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate* , OH_Drawing_TextStyle*  )
15982```
15983
15984**描述**
15985
15986设置排版风格。
15987
15988**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15989
15990**起始版本:** 8
15991
15992**参数:**
15993
15994| 名称 | 描述 |
15995| -------- | -------- |
15996| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
15997| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
15998
15999
16000### OH_Drawing_TypographyIsEllipsized()
16001
16002```
16003bool OH_Drawing_TypographyIsEllipsized (OH_Drawing_TypographyStyle* style)
16004```
16005
16006**描述**
16007
16008获取指定排版样式是否配置省略号。
16009
16010**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16011
16012**起始版本:** 12
16013
16014**参数:**
16015
16016| 名称 | 描述 |
16017| -------- | -------- |
16018| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16019
16020**返回:**
16021
16022返回文本是否有省略号,true表示有省略号,false表示无省略号。
16023
16024
16025### OH_Drawing_TypographyIsLineUnlimited()
16026
16027```
16028bool OH_Drawing_TypographyIsLineUnlimited (OH_Drawing_TypographyStyle* style)
16029```
16030
16031**描述**
16032
16033获取文本是否有最大行数限制。
16034
16035**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16036
16037**起始版本:** 12
16038
16039**参数:**
16040
16041| 名称 | 描述 |
16042| -------- | -------- |
16043| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16044
16045**返回:**
16046
16047返回文本是否有最大行数限制,true表示有最大行数限制,false表示无最大行数限制。
16048
16049
16050### OH_Drawing_TypographyLayout()
16051
16052```
16053void OH_Drawing_TypographyLayout (OH_Drawing_Typography* , double  )
16054```
16055
16056**描述**
16057
16058排版布局。
16059
16060**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16061
16062**起始版本:** 8
16063
16064**参数:**
16065
16066| 名称 | 描述 |
16067| -------- | -------- |
16068| OH_Drawing_Typography | 指向排版对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
16069| double | 文本最大宽度。 |
16070
16071
16072### OH_Drawing_TypographyMarkDirty()
16073
16074```
16075void OH_Drawing_TypographyMarkDirty (OH_Drawing_Typography* )
16076```
16077
16078**描述**
16079
16080将排版标记为脏数据,用于初始化排版状态。
16081
16082**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16083
16084**起始版本:** 12
16085
16086**参数:**
16087
16088| 名称 | 描述 |
16089| -------- | -------- |
16090| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
16091
16092
16093### OH_Drawing_TypographyPaint()
16094
16095```
16096void OH_Drawing_TypographyPaint (OH_Drawing_Typography* , OH_Drawing_Canvas* , double , double  )
16097```
16098
16099**描述**
16100
16101在指定位置绘制文本,从左上角开始绘制,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用并生效之后调用。
16102
16103**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16104
16105**起始版本:** 8
16106
16107**参数:**
16108
16109| 名称 | 描述 |
16110| -------- | -------- |
16111| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
16112| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针,由OH_Drawing_CanvasCreate()获取。 |
16113| double | x坐标。 |
16114| double | y坐标。 |
16115
16116
16117### OH_Drawing_TypographySetIndents()
16118
16119```
16120void OH_Drawing_TypographySetIndents (OH_Drawing_Typography* , int , const float indents[] )
16121```
16122
16123**描述**
16124
16125设置文本的排版缩进,不调用此接口默认文本无缩进。
16126
16127**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16128
16129**起始版本:** 12
16130
16131**参数:**
16132
16133| 名称 | 描述 |
16134| -------- | -------- |
16135| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
16136| int | 为段落设置的缩进数量。该值应小于或等于 indents 数组的长度,以避免访问数组越界导致的显示异常。|
16137| float | 指向浮点类型数组的指针,每个数组元素表示一个缩进宽度,单位为物理像素(px)。在应用[OH_Drawing_Typography](#oh_drawing_typography)接口时,需要先声明并初始化该浮点数组。 |
16138
16139
16140### OH_Drawing_TypographyStyleDestroyStrutStyle()
16141
16142```
16143void OH_Drawing_TypographyStyleDestroyStrutStyle (OH_Drawing_StrutStyle* )
16144```
16145
16146**描述**
16147
16148释放被支柱样式对象占据的内存。
16149
16150**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16151
16152**起始版本:** 12
16153
16154**参数:**
16155
16156| 名称 | 描述 |
16157| -------- | -------- |
16158| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针,由[OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle)获取。 |
16159
16160
16161### OH_Drawing_TypographyStyleEquals()
16162
16163```
16164bool OH_Drawing_TypographyStyleEquals (OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to )
16165```
16166
16167**描述**
16168
16169判断排版样式是否相同,当前文本高度修饰符模式[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)没有被纳入比较。
16170
16171**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16172
16173**起始版本:** 12
16174
16175**参数:**
16176
16177| 名称 | 描述 |
16178| -------- | -------- |
16179| from | 被比较的排版样式。 |
16180| to | 用于比较的排版样式。 |
16181
16182**返回:**
16183
16184返回排版样式是否相同。true表示相同,false表示不相同。
16185
16186
16187### OH_Drawing_TypographyStyleGetEffectiveAlignment()
16188
16189```
16190OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment (OH_Drawing_TypographyStyle* style)
16191```
16192
16193**描述**
16194
16195获取文本对齐模式。
16196
16197**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16198
16199**起始版本:** 12
16200
16201**参数:**
16202
16203| 名称 | 描述 |
16204| -------- | -------- |
16205| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16206
16207**返回:**
16208
16209返回文本对齐模式的枚举值[OH_Drawing_TextAlign](#oh_drawing_textalign)。
16210
16211
16212### OH_Drawing_TypographyStyleGetFontStyleStruct()
16213
16214```
16215OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle)
16216```
16217
16218**描述**
16219
16220获取文本字体样式,包括字体字重、字体宽度和字体斜度。
16221
16222**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16223
16224**起始版本:** 12
16225
16226**参数:**
16227
16228| 名称 | 描述 |
16229| -------- | -------- |
16230| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16231
16232**返回:**
16233
16234返回获取到的字体样式对象,包括字体字重、字体宽度和字体斜度信息。
16235
16236
16237### OH_Drawing_TypographyStyleGetStrutStyle()
16238
16239```
16240OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle (OH_Drawing_TypographyStyle* )
16241```
16242
16243**描述**
16244
16245获取文本支柱样式。
16246
16247**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16248
16249**起始版本:** 12
16250
16251**参数:**
16252
16253| 名称 | 描述 |
16254| -------- | -------- |
16255| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16256
16257**返回:**
16258
16259返回指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针。
16260
16261
16262### OH_Drawing_TypographyStyleIsHintEnabled()
16263
16264```
16265bool OH_Drawing_TypographyStyleIsHintEnabled (OH_Drawing_TypographyStyle* style)
16266```
16267
16268**描述**
16269
16270获取文本是否启用字形轮廓自动调整,字形轮廓自动调整用于在渲染小字号文本时改善其可读性和外观。
16271
16272**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16273
16274**起始版本:** 12
16275
16276**参数:**
16277
16278| 名称 | 描述 |
16279| -------- | -------- |
16280| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16281
16282**返回:**
16283
16284返回文本是否启用字体提示,true表示启用,false表示不启用。
16285
16286
16287### OH_Drawing_TypographyStyleSetHintsEnabled()
16288
16289```
16290void OH_Drawing_TypographyStyleSetHintsEnabled (OH_Drawing_TypographyStyle* style, bool hintsEnabled )
16291```
16292
16293**描述**
16294
16295设置文本是否启用字形轮廓自动调整,字形轮廓自动调整用于在渲染小字号文本时改善其可读性和外观。
16296
16297**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16298
16299**起始版本:** 12
16300
16301**参数:**
16302
16303| 名称 | 描述 |
16304| -------- | -------- |
16305| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16306| hintsEnabled | 是否启用字体提示,true表示启用,false表示不启用。 |
16307
16308
16309### OH_Drawing_TypographyStyleStrutStyleEquals()
16310
16311```
16312bool OH_Drawing_TypographyStyleStrutStyleEquals (OH_Drawing_StrutStyle* from, OH_Drawing_StrutStyle* to )
16313```
16314
16315**描述**
16316
16317判断支柱样式结构体是否相同。
16318
16319**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16320
16321**起始版本:** 12
16322
16323**参数:**
16324
16325| 名称 | 描述 |
16326| -------- | -------- |
16327| from | 被比较的支柱样式结构体。 |
16328| to | 用于比较的支柱样式结构体。 |
16329
16330**返回:**
16331
16332返回支柱样式结构体是否相同,true表示相同,false表示不相同。
16333
16334### OH_Drawing_TypographyTextGetHeightBehavior()
16335
16336```
16337OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior (OH_Drawing_TypographyStyle* )
16338```
16339
16340**描述**
16341
16342获取文本高度修饰符模式。
16343
16344**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16345
16346**起始版本:** 12
16347
16348**参数:**
16349
16350| 名称 | 描述 |
16351| -------- | -------- |
16352| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16353
16354**返回:**
16355
16356返回文本高度修饰符模式,为[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)类型的枚举值。
16357
16358
16359### OH_Drawing_TypographyTextGetLineStyle()
16360
16361```
16362bool OH_Drawing_TypographyTextGetLineStyle (OH_Drawing_TypographyStyle* )
16363```
16364
16365**描述**
16366
16367获取文本排版是否启用行样式。
16368
16369**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16370
16371**起始版本:** 12
16372
16373**参数:**
16374
16375| 名称 | 描述 |
16376| -------- | -------- |
16377| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16378
16379**返回:**
16380
16381返回行样式是否启用的结果,true表示启用,false表示不启用。
16382
16383
16384### OH_Drawing_TypographyTextlineGetStyleOnly()
16385
16386```
16387bool OH_Drawing_TypographyTextlineGetStyleOnly (OH_Drawing_TypographyStyle* )
16388```
16389
16390**描述**
16391
16392获取文本排版是否仅启用行样式。
16393
16394**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16395
16396**起始版本:** 12
16397
16398**参数:**
16399
16400| 名称 | 描述 |
16401| -------- | -------- |
16402| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16403
16404**返回:**
16405
16406返回文本排版是否仅启用行样式,true表示启用,false表示不启用。
16407
16408
16409### OH_Drawing_TypographyTextlineStyleDestroyFontFamilies()
16410
16411```
16412void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies (char** fontFamilies, size_t fontFamiliesNum )
16413```
16414
16415**描述**
16416
16417释放字体类型占用的内存。
16418
16419**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16420
16421**起始版本:** 12
16422
16423**参数:**
16424
16425| 名称 | 描述 |
16426| -------- | -------- |
16427| fontFamilies | 表示指向字体字体类型的指针。 |
16428| fontFamiliesNum | 字体名称的数量。 |
16429
16430
16431### OH_Drawing_TypographyTextlineStyleGetFontFamilies()
16432
16433```
16434char** OH_Drawing_TypographyTextlineStyleGetFontFamilies (OH_Drawing_TypographyStyle* , size_t* num)
16435```
16436
16437**描述**
16438
16439获取文本排版行样式字体家族名。
16440
16441**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16442
16443**起始版本:** 12
16444
16445**参数:**
16446
16447| 名称 | 描述 |
16448| -------- | -------- |
16449| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16450| num | 指向字体名称数量的指针。 |
16451
16452**返回:**
16453
16454返回文本排版行样式字体家族名。
16455
16456
16457### OH_Drawing_TypographyTextlineStyleGetFontSize()
16458
16459```
16460double OH_Drawing_TypographyTextlineStyleGetFontSize (OH_Drawing_TypographyStyle* )
16461```
16462
16463**描述**
16464
16465获取文本排版行样式字号。
16466
16467**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16468
16469**起始版本:** 12
16470
16471**参数:**
16472
16473| 名称 | 描述 |
16474| -------- | -------- |
16475| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16476
16477**返回:**
16478
16479返回文本排版行样式字号。
16480
16481
16482### OH_Drawing_TypographyTextlineStyleGetFontStyle()
16483
16484```
16485OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle (OH_Drawing_TypographyStyle* )
16486```
16487
16488**描述**
16489
16490获取文本排版行样式风格。
16491
16492**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16493
16494**起始版本:** 12
16495
16496**参数:**
16497
16498| 名称 | 描述 |
16499| -------- | -------- |
16500| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16501
16502**返回:**
16503
16504返回获取文本排版行样式风格。1为斜体,0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。
16505
16506
16507### OH_Drawing_TypographyTextlineStyleGetFontWeight()
16508
16509```
16510OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight (OH_Drawing_TypographyStyle* )
16511```
16512
16513**描述**
16514
16515获取文本排版行样式字重。
16516
16517**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16518
16519**起始版本:** 12
16520
16521**参数:**
16522
16523| 名称 | 描述 |
16524| -------- | -------- |
16525| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16526
16527**返回:**
16528
16529返回文本排版行样式字重。 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)枚举。
16530
16531
16532### OH_Drawing_TypographyTextlineStyleGetHalfLeading()
16533
16534```
16535bool OH_Drawing_TypographyTextlineStyleGetHalfLeading (OH_Drawing_TypographyStyle* )
16536```
16537
16538**描述**
16539
16540获取文本排版行样式是否为一半行间距。
16541
16542**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16543
16544**起始版本:** 12
16545
16546**参数:**
16547
16548| 名称 | 描述 |
16549| -------- | -------- |
16550| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16551
16552**返回:**
16553
16554文本排版行样式是否为一半行间距,true表示是一半行间距,false表示不是。
16555
16556
16557### OH_Drawing_TypographyTextlineStyleGetHeightOnly()
16558
16559```
16560bool OH_Drawing_TypographyTextlineStyleGetHeightOnly (OH_Drawing_TypographyStyle* )
16561```
16562
16563**描述**
16564
16565获取字体渲染过程中计算字体块高度相关参数的方法。
16566
16567**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16568
16569**起始版本:** 12
16570
16571**参数:**
16572
16573| 名称 | 描述 |
16574| -------- | -------- |
16575| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16576
16577**返回:**
16578
16579返回计算字体块高度相关参数的方法,true表示以字号为准计算,false表示以行距计算。
16580
16581
16582### OH_Drawing_TypographyTextlineStyleGetHeightScale()
16583
16584```
16585double OH_Drawing_TypographyTextlineStyleGetHeightScale (OH_Drawing_TypographyStyle* )
16586```
16587
16588**描述**
16589
16590获取文本排版行样式的行高缩放系数。
16591
16592**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16593
16594**起始版本:** 12
16595
16596**参数:**
16597
16598| 名称 | 描述 |
16599| -------- | -------- |
16600| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16601
16602**返回:**
16603
16604返回文本排版行样式的行高缩放系数。
16605
16606
16607### OH_Drawing_TypographyTextlineStyleGetSpacingScale()
16608
16609```
16610double OH_Drawing_TypographyTextlineStyleGetSpacingScale (OH_Drawing_TypographyStyle* )
16611```
16612
16613**描述**
16614
16615获取文本排版行样式间距比例。
16616
16617**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16618
16619**起始版本:** 12
16620
16621**参数:**
16622
16623| 名称 | 描述 |
16624| -------- | -------- |
16625| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16626
16627**返回:**
16628
16629返回文本排版行样式间距比例。
16630
16631
16632### OH_Drawing_TypographyTextSetHeightBehavior()
16633
16634```
16635void OH_Drawing_TypographyTextSetHeightBehavior (OH_Drawing_TypographyStyle* , OH_Drawing_TextHeightBehavior heightMode )
16636```
16637
16638**描述**
16639
16640设置文本高度修饰符模式。
16641
16642**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16643
16644**起始版本:** 12
16645
16646**参数:**
16647
16648| 名称 | 描述 |
16649| -------- | -------- |
16650| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
16651| heightMode | 文本高度修饰符模式,为[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)类型的枚举值。 |
16652
16653
16654### OH_Drawing_TypographyUpdateFontSize()
16655
16656```
16657void OH_Drawing_TypographyUpdateFontSize (OH_Drawing_Typography* , size_t from, size_t to, float fontSize )
16658```
16659
16660**描述**
16661
16662更新排版对象中的字体大小。
16663
16664**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16665
16666**起始版本:** 12
16667
16668**参数:**
16669
16670| 名称 | 描述 |
16671| -------- | -------- |
16672| OH_Drawing_Typography | 表示指向排版对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
16673| from | 保留字段,暂未使用。 |
16674| to | 保留字段,暂未使用。 |
16675| fontSize | 表示更新后的字体大小。 |