• 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_line.h](drawing__text__line_8h.md) | 提供获取文本行内的字符位置、获取渲染单元信息和按行截断等功能。 |
55| [drawing_text_lineTypography.h](drawing__text__line_typography_8h.md) | 提供排版行相关的接口,比如获取指定位置处开始可以排版的字符个数等函数。 |
56| [drawing_text_run.h](drawing__text__run_8h.md) | 提供字体渲染单元的相关接口,比如绘制功能、获取排版边界功能等。  |
57| [drawing_text_typography.h](drawing__text__typography_8h.md) | 定义绘制模块中排版相关的函数。 |
58| [drawing_typeface.h](drawing__typeface_8h.md) | 文件中定义了与字形相关的功能函数。 不同的平台有自己的默认字形,也可以从ttf文件解析出三方指定字形,如宋体、黑体字形等。 |
59| [drawing_types.h](drawing__types_8h.md) | 文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径。 |
60
61
62### 结构体
63
64| 名称 | 描述 |
65| -------- | -------- |
66| struct  [OH_Drawing_String](_o_h___drawing___string.md) | 采用UTF-16编码的字符串信息结构体。 |
67| struct  [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型。 |
68| struct  [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | 定义字体度量信息的结构体。 |
69| struct  [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) | 定义有关图形处理器上下文的选项。 |
70| struct  [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) | 结构体用于描述一块内存,描述文字和位置信息。 |
71| struct  [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | 用于描述占位符跨度的结构体。 |
72| struct  [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | 描述系统字体详细信息的结构体。 |
73| struct  [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | 文字行位置信息。 |
74| struct  [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md) | 备用字体信息结构体。 |
75| struct  [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md) | 备用字体集信息结构体。 |
76| struct  [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md) | 字重映射信息结构体。 |
77| struct  [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md) | 别名字体信息结构体。 |
78| struct  [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md) | 系统所支持的通用字体集信息结构体。 |
79| struct  [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) | 系统字体配置信息结构体。 |
80| struct  [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 定义字体样式信息的结构体。 |
81| struct  [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | 描述文本字体特征结构体。 |
82| struct  [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 |
83| struct  [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 定义一个二维的坐标点。 |
84| struct  [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) | 定义一个三维的坐标点。 |
85| struct  [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 定义图片信息结构体。 |
86| struct  [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | 定义矩形框样式结构体。 |
87
88
89### 类型定义
90
91| 名称 | 描述 |
92| -------- | -------- |
93| typedef enum [OH_Drawing_PathDashStyle](#oh_drawing_pathdashstyle) [OH_Drawing_PathDashStyle](#oh_drawing_pathdashstyle) | 路径效果的绘制样式枚举。  |
94| typedef struct [OH_Drawing_String](_o_h___drawing___string.md) [OH_Drawing_String](#oh_drawing_string) | 采用UTF-16编码的字符串信息结构体。 |
95| typedef enum [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) | 字体类型的枚举。 |
96| typedef bool(\* [Drawing_CaretOffsetsCallback](#drawing_caretoffsetscallback)) (double offset, int32_t index, bool leadingEdge) | 用户自定义的回调函数。将文本行对象中每个字符的偏移量、索引值作为参数传递给用户自定义的回调函数。 |
97| typedef struct [OH_Drawing_LineTypography](#oh_drawing_linetypography) [OH_Drawing_LineTypography](#oh_drawing_linetypography) | 用于从一段文字中提取单行数据进行排版。 |
98| typedef struct [OH_Drawing_TextTab](#oh_drawing_texttab) [OH_Drawing_TextTab](#oh_drawing_texttab) | 用于管理文本制表符。 |
99| typedef struct [OH_Drawing_TextLine](#oh_drawing_textline) [OH_Drawing_TextLine](#oh_drawing_textline) | 用于管理文本行。 |
100| typedef struct [OH_Drawing_Run](#oh_drawing_run) [OH_Drawing_Run](#oh_drawing_run) | 用于管理文本渲染单元。 |
101| typedef struct [OH_Drawing_Array](#oh_drawing_array) [OH_Drawing_Array](#oh_drawing_array) | 定义数组对象, 用于存储多个同类型对象。 |
102| typedef struct [OH_Drawing_FontArguments](#oh_drawing_fontarguments) [OH_Drawing_FontArguments](#oh_drawing_fontarguments) | 用于描述字型参数。 |
103| typedef struct [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) | 定义指令录制工具,用于生成录制指令。 |
104| typedef struct [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) | 定义录制指令类, 用于存储录制指令的集合。 |
105| typedef enum [OH_Drawing_ErrorCode](#oh_drawing_errorcode)  [OH_Drawing_ErrorCode](#oh_drawing_errorcode) | 枚举本模块可能产生的错误码。 |
106| typedef enum [OH_Drawing_PathOpMode](#oh_drawing_pathopmode)  [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) | 路径操作类型枚举。 |
107| typedef enum [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags)  [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) | 路径测量获取相应矩阵信息维度枚举。 |
108| typedef enum [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode)  [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode) | 区域操作类型枚举。 |
109| typedef struct [OH_Drawing_ImageFilter](#oh_drawing_imagefilter)  [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) | 定义图像滤波器, 用于对构成图像像素的所有颜色位进行操作。 |
110| typedef struct [OH_Drawing_Filter](#oh_drawing_filter)  [OH_Drawing_Filter](#oh_drawing_filter) | 定义一个滤波器,用于存储颜色滤波器,蒙版滤波器和图像滤波器。 |
111| typedef struct [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)  [OH_Drawing_BitmapFormat](#oh_drawing_bitmapformat) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型。 |
112| typedef enum [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint)  [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint) | 源矩形区域约束类型枚举。 |
113| typedef enum [OH_Drawing_PointMode](#oh_drawing_pointmode)  [OH_Drawing_PointMode](#oh_drawing_pointmode) | 绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 |
114| typedef enum [OH_Drawing_VertexMode](#oh_drawing_vertexmode)  [OH_Drawing_VertexMode](#oh_drawing_vertexmode) | 用于指定如何解释给定顶点的几何形状的枚举类型。 |
115| typedef enum [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)  [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) | 画布裁剪方式的枚举集合。 |
116| typedef enum [OH_Drawing_FontEdging](#oh_drawing_fontedging)  [OH_Drawing_FontEdging](#oh_drawing_fontedging) | 字型边缘效果类型枚举。 |
117| typedef enum [OH_Drawing_FontHinting](#oh_drawing_fonthinting)  [OH_Drawing_FontHinting](#oh_drawing_fonthinting) | 字型轮廓效果类型枚举。 |
118| typedef struct [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)  [OH_Drawing_Font_Metrics](#oh_drawing_font_metrics) | 定义字体度量信息的结构体。 |
119| typedef struct [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)  [OH_Drawing_GpuContextOptions](#oh_drawing_gpucontextoptions) | 定义有关图形处理器上下文的选项。 |
120| typedef enum [OH_Drawing_BlurType](#oh_drawing_blurtype)  [OH_Drawing_BlurType](#oh_drawing_blurtype) | 蒙版滤波器模糊操作类型的枚举。 |
121| typedef enum [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit)  [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) | 矩阵缩放方式枚举。 |
122| typedef enum [OH_Drawing_PathDirection](#oh_drawing_pathdirection)  [OH_Drawing_PathDirection](#oh_drawing_pathdirection) | 添加闭合轮廓方向枚举。 |
123| typedef enum [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)  [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) | 定义路径的填充类型枚举。 |
124| typedef enum [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)  [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) | 用于指定路径添加模式的枚举类型。 |
125| typedef enum [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)  [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 |
126| typedef enum [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)  [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 |
127| typedef enum [OH_Drawing_CornerPos](#oh_drawing_cornerpos)  [OH_Drawing_CornerPos](#oh_drawing_cornerpos) | 用于描述圆角位置的枚举。 |
128| typedef enum [OH_Drawing_FilterMode](#oh_drawing_filtermode)  [OH_Drawing_FilterMode](#oh_drawing_filtermode) | 过滤模式枚举。 |
129| typedef enum [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)  [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) | 多级渐远纹理模式枚举。 |
130| typedef enum [OH_Drawing_TileMode](#oh_drawing_tilemode)  [OH_Drawing_TileMode](#oh_drawing_tilemode) | 着色器效果平铺模式的枚举。 |
131| typedef struct [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md)  [OH_Drawing_RunBuffer](#oh_drawing_runbuffer) | 结构体用于描述一块内存,描述文字和位置信息。 |
132| typedef struct [OH_Drawing_FontCollection](#oh_drawing_fontcollection)  [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | 用于加载字体。 |
133| typedef struct [OH_Drawing_Typography](#oh_drawing_typography)  [OH_Drawing_Typography](#oh_drawing_typography) | 用于管理排版的布局和显示等。 |
134| typedef struct [OH_Drawing_TextStyle](#oh_drawing_textstyle)  [OH_Drawing_TextStyle](#oh_drawing_textstyle) | 用于管理字体颜色、装饰等。 |
135| typedef struct [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)  [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) | 用于管理排版风格,如文字方向等。 |
136| typedef struct [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)  [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) | 用于创建[OH_Drawing_Typography](#oh_drawing_typography)。 |
137| typedef struct [OH_Drawing_TextBox](#oh_drawing_textbox)  [OH_Drawing_TextBox](#oh_drawing_textbox) | 用于接收文本框的矩形大小、方向和数量大小。 |
138| typedef struct [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)  [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) | 用于接收字体的位置和亲和性。 |
139| typedef struct [OH_Drawing_Range](#oh_drawing_range)  [OH_Drawing_Range](#oh_drawing_range) | 用于接收字体的起始位置和结束位置。 |
140| typedef struct [OH_Drawing_TextShadow](#oh_drawing_textshadow)  [OH_Drawing_TextShadow](#oh_drawing_textshadow) | 用于管理文本阴影。 |
141| typedef struct [OH_Drawing_FontParser](#oh_drawing_fontparser)  [OH_Drawing_FontParser](#oh_drawing_fontparser) | 用来解析系统字体文件。 |
142| typedef enum [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment)  [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) | 占位符垂直对齐枚举。 |
143| typedef struct [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md)  [OH_Drawing_PlaceholderSpan](#oh_drawing_placeholderspan) | 用于描述占位符跨度的结构体。 |
144| typedef enum [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)  [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) | 文本装饰样式枚举。 |
145| typedef enum [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)  [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) | 省略号样式枚举。 |
146| typedef enum [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy)  [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) | 文本的中断策略枚举。 |
147| typedef enum [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype)  [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) | 单词的断词方式枚举。 |
148| typedef enum [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle)  [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) | 矩形框高度样式枚举。 |
149| typedef enum [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)  [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) | 矩形框宽度样式枚举。 |
150| typedef struct [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)  [OH_Drawing_FontDescriptor](#oh_drawing_fontdescriptor) | 描述系统字体详细信息的结构体。 |
151| typedef struct [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)  [OH_Drawing_LineMetrics](#oh_drawing_linemetrics) | 文字行位置信息。 |
152| typedef struct [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md)  [OH_Drawing_FontFallbackInfo](#oh_drawing_fontfallbackinfo) | 备用字体信息结构体。 |
153| typedef struct [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md)  [OH_Drawing_FontFallbackGroup](#oh_drawing_fontfallbackgroup) | 备用字体集信息结构体。 |
154| typedef struct [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md)  [OH_Drawing_FontAdjustInfo](#oh_drawing_fontadjustinfo) | 字重映射信息结构体。 |
155| typedef struct [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md)  [OH_Drawing_FontAliasInfo](#oh_drawing_fontaliasinfo) | 别名字体信息结构体。 |
156| typedef struct [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md)  [OH_Drawing_FontGenericInfo](#oh_drawing_fontgenericinfo) | 系统所支持的通用字体集信息结构体。 |
157| typedef struct [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md)  [OH_Drawing_FontConfigInfo](#oh_drawing_fontconfiginfo) | 系统字体配置信息结构体。 |
158| typedef struct [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md)  [OH_Drawing_FontStyleStruct](#oh_drawing_fontstylestruct) | 定义字体样式信息的结构体。 |
159| typedef struct [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)  [OH_Drawing_StrutStyle](#oh_drawing_strutstyle) | 用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 |
160| typedef struct [OH_Drawing_Canvas](#oh_drawing_canvas)  [OH_Drawing_Canvas](#oh_drawing_canvas) | 定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 |
161| typedef struct [OH_Drawing_Pen](#oh_drawing_pen)  [OH_Drawing_Pen](#oh_drawing_pen) | 定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 |
162| typedef struct [OH_Drawing_Region](#oh_drawing_region)  [OH_Drawing_Region](#oh_drawing_region) | 定义一个区域,用于表示画布上的封闭区域,实现更精确的图形控制。 |
163| typedef struct [OH_Drawing_Brush](#oh_drawing_brush)  [OH_Drawing_Brush](#oh_drawing_brush) | 定义为画刷,画刷用于描述填充图形的样式和颜色。 |
164| typedef struct [OH_Drawing_Path](#oh_drawing_path)  [OH_Drawing_Path](#oh_drawing_path) | 定义为路径,路径用于自定义各种形状。 |
165| typedef struct [OH_Drawing_PixelMap](#oh_drawing_pixelmap)  [OH_Drawing_PixelMap](#oh_drawing_pixelmap) | 定义像素图,用于包装图像框架支持的真实像素图。 |
166| typedef struct [OH_Drawing_Bitmap](#oh_drawing_bitmap)  [OH_Drawing_Bitmap](#oh_drawing_bitmap) | 定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 |
167| typedef struct [OH_Drawing_Point](#oh_drawing_point)  [OH_Drawing_Point](#oh_drawing_point) | 定义一个点,用于描述坐标点。 |
168| typedef struct [OH_Drawing_ColorSpace](#oh_drawing_colorspace)  [OH_Drawing_ColorSpace](#oh_drawing_colorspace) | 定义色彩空间,用于解释颜色信息。 |
169| typedef struct [OH_Drawing_Point2D](_o_h___drawing___point2_d.md)  [OH_Drawing_Point2D](#oh_drawing_point2d) | 定义一个二维的坐标点。 |
170| typedef [OH_Drawing_Point2D](_o_h___drawing___point2_d.md)  [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) | 定义一个圆角半径,该圆角半径由x轴方向和y轴方向上的半径组成。 |
171| typedef struct [OH_Drawing_Point3D](_o_h___drawing___point3_d.md)  [OH_Drawing_Point3D](#oh_drawing_point3d) | 定义一个三维的坐标点。 |
172| typedef struct [OH_Drawing_PathEffect](#oh_drawing_patheffect)  [OH_Drawing_PathEffect](#oh_drawing_patheffect) | 定义一个路径效果,用于影响描边路径。 |
173| typedef struct [OH_Drawing_Rect](#oh_drawing_rect)  [OH_Drawing_Rect](#oh_drawing_rect) | 用于描述矩形。 |
174| typedef struct [OH_Drawing_RoundRect](#oh_drawing_roundrect)  [OH_Drawing_RoundRect](#oh_drawing_roundrect) | 用于描述圆角矩形。 |
175| typedef struct [OH_Drawing_Matrix](#oh_drawing_matrix)  [OH_Drawing_Matrix](#oh_drawing_matrix) | 定义一个矩阵,用于描述坐标变换。 |
176| typedef struct [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)  [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) | 定义一个着色器,用于描述绘制内容的源颜色。 |
177| typedef struct [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer)  [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) | 定义一个阴影层,用于描述绘制内容的阴影层。 |
178| typedef struct [OH_Drawing_Filter](#oh_drawing_filter)  [OH_Drawing_Filter](#oh_drawing_filter) | 定义一个滤波器,用于存储颜色滤波器和蒙版滤波器。 |
179| typedef struct [OH_Drawing_MaskFilter](#oh_drawing_maskfilter)  [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) | 定义蒙版滤波器。 |
180| typedef struct [OH_Drawing_ColorFilter](#oh_drawing_colorfilter)  [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) | 定义颜色滤波器,传入一个颜色并返回一个新的颜色。 |
181| typedef struct [OH_Drawing_Font](#oh_drawing_font)  [OH_Drawing_Font](#oh_drawing_font) | 用于描述字体。 |
182| typedef struct [OH_Drawing_MemoryStream](#oh_drawing_memorystream)  [OH_Drawing_MemoryStream](#oh_drawing_memorystream) | 用于描述内存流。 |
183| typedef struct [OH_Drawing_Typeface](#oh_drawing_typeface)  [OH_Drawing_Typeface](#oh_drawing_typeface) | 用于描述字形。 |
184| typedef struct [OH_Drawing_TextBlob](#oh_drawing_textblob)  [OH_Drawing_TextBlob](#oh_drawing_textblob) | 定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。 |
185| typedef struct [OH_Drawing_Image](#oh_drawing_image)  [OH_Drawing_Image](#oh_drawing_image) | 定义一个用于描述绘制二维像素数组的图片。 |
186| typedef struct [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)  [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) | 定义一个采样选项,用于描述图片、位图等图像的采样方法。 |
187| typedef struct [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder)  [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) | 定义文本构建器,用于构建文本。 |
188| typedef struct [OH_Drawing_GpuContext](#oh_drawing_gpucontext)  [OH_Drawing_GpuContext](#oh_drawing_gpucontext) | 定义图形处理器上下文,用于描述图形处理器后端上下文。 |
189| typedef struct [OH_Drawing_Surface](#oh_drawing_surface)  [OH_Drawing_Surface](#oh_drawing_surface) | 定义surface,用于管理画布绘制的内容。 |
190| typedef enum [OH_Drawing_ColorFormat](#oh_drawing_colorformat)  [OH_Drawing_ColorFormat](#oh_drawing_colorformat) | 用于描述位图像素的存储格式。 |
191| typedef enum [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat)  [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) | 用于描述位图像素的透明度分量。 |
192| typedef enum [OH_Drawing_BlendMode](#oh_drawing_blendmode)  [OH_Drawing_BlendMode](#oh_drawing_blendmode) | 混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在红、绿、蓝3个颜色通道上是相同的(透明度有另外的处理规则)。 |
193| typedef struct [OH_Drawing_Image_Info](_o_h___drawing___image___info.md)  [OH_Drawing_Image_Info](#oh_drawing_image_info) | 定义图片信息结构体。 |
194| typedef struct [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md)  [OH_Drawing_RectStyle_Info](#oh_drawing_rectstyle_info) | 定义矩形框样式结构体。 |
195| typedef enum [OH_Drawing_TextEncoding](#oh_drawing_textencoding)  [OH_Drawing_TextEncoding](#oh_drawing_textencoding) | 文本编码类型枚举。 |
196| typedef struct [OH_Drawing_FontMgr](#oh_drawing_fontmgr)  [OH_Drawing_FontMgr](#oh_drawing_fontmgr) | 定义字体管理类, 用于字体管理。 |
197| typedef struct [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)  [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) | 定义字体样式集, 用于字体样式族匹配。 |
198| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | 阴影标志枚举。 |
199
200### 枚举
201
202| 名称 | 描述 |
203| -------- | -------- |
204| [OH_Drawing_PathDashStyle](#oh_drawing_pathdashstyle-1) { DRAWING_PATH_DASH_STYLE_TRANSLATE, DRAWING_PATH_DASH_STYLE_ROTATE, DRAWING_PATH_DASH_STYLE_MORPH } | 路径效果的绘制样式枚举。  |
205| [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype-1) { ALL = 1 << 0, GENERIC = 1 << 1, STYLISH = 1 << 2, INSTALLED = 1 << 3, CUSTOMIZED = 1 << 4 } | 字体类型的枚举。 |
206| [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 } | 枚举本模块可能产生的错误码。 |
207| [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/>} | 路径操作类型枚举。 |
208| [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags-1) { GET_POSITION_MATRIX, GET_TANGENT_MATRIX, GET_POSITION_AND_TANGENT_MATRIX } | 路径测量获取相应矩阵信息维度枚举。 |
209| [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/>} | 区域操作类型枚举。 |
210| [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1) { STRICT_SRC_RECT_CONSTRAINT, FAST_SRC_RECT_CONSTRAINT } | 源矩形区域约束类型枚举。 |
211| [OH_Drawing_PointMode](#oh_drawing_pointmode-1) { POINT_MODE_POINTS, POINT_MODE_LINES, POINT_MODE_POLYGON } | 绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 |
212| [OH_Drawing_VertexMode](#oh_drawing_vertexmode-1) { VERTEX_MODE_TRIANGLES, VERTEX_MODE_TRIANGLESSTRIP, VERTEX_MODE_TRIANGLEFAN } | 用于指定如何解释给定顶点的几何形状的枚举类型。 |
213| [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop-1) { DIFFERENCE, INTERSECT } | 画布裁剪方式的枚举集合。 |
214| [OH_Drawing_FontEdging](#oh_drawing_fontedging-1) { FONT_EDGING_ALIAS, FONT_EDGING_ANTI_ALIAS, FONT_EDGING_SUBPIXEL_ANTI_ALIAS } | 字型边缘效果类型枚举。 |
215| [OH_Drawing_FontHinting](#oh_drawing_fonthinting-1) { FONT_HINTING_NONE, FONT_HINTING_SLIGHT, FONT_HINTING_NORMAL, FONT_HINTING_FULL } | 字型轮廓效果类型枚举。 |
216| [OH_Drawing_BlurType](#oh_drawing_blurtype-1) { NORMAL, SOLID, OUTER, INNER } | 蒙版滤波器模糊操作类型的枚举。 |
217| [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit-1) { SCALE_TO_FIT_FILL, SCALE_TO_FIT_START, SCALE_TO_FIT_CENTER, SCALE_TO_FIT_END } | 矩阵缩放方式枚举。 |
218| [OH_Drawing_PathDirection](#oh_drawing_pathdirection-1) { PATH_DIRECTION_CW, PATH_DIRECTION_CCW } | 添加闭合轮廓方向枚举。 |
219| [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 } | 定义路径的填充类型枚举。 |
220| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode-1) { PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND } | 用于指定路径添加模式的枚举类型。 |
221| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle-1) { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 |
222| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle-1) { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 |
223| [OH_Drawing_CornerPos](#oh_drawing_cornerpos-1) { CORNER_POS_TOP_LEFT, CORNER_POS_TOP_RIGHT, CORNER_POS_BOTTOM_RIGHT, CORNER_POS_BOTTOM_LEFT } | 用于描述圆角位置的枚举。 |
224| [OH_Drawing_FilterMode](#oh_drawing_filtermode-1) { FILTER_MODE_NEAREST, FILTER_MODE_LINEAR } | 过滤模式枚举。 |
225| [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode-1) { MIPMAP_MODE_NONE, MIPMAP_MODE_NEAREST, MIPMAP_MODE_LINEAR } | 多级渐远纹理模式枚举。 |
226| [OH_Drawing_TileMode](#oh_drawing_tilemode-1) { CLAMP, REPEAT, MIRROR, DECAL } | 着色器效果平铺模式的枚举。 |
227| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | 文字方向。 |
228| [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/>} | 文字对齐方式。 |
229| [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/>} | 字重。 |
230| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | 基线位置。 |
231| [OH_Drawing_TextDecoration](#oh_drawing_textdecoration) { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } | 文本装饰。 |
232| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC, FONT_STYLE_OBLIQUE } | 区分字体是否为斜体。 |
233| [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/>} | 占位符垂直对齐枚举。 |
234| [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/>} | 文本装饰样式枚举。 |
235| [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal-1) { ELLIPSIS_MODAL_HEAD = 0, ELLIPSIS_MODAL_MIDDLE = 1, ELLIPSIS_MODAL_TAIL = 2 } | 省略号样式枚举。 |
236| [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy-1) { BREAK_STRATEGY_GREEDY = 0, BREAK_STRATEGY_HIGH_QUALITY = 1, BREAK_STRATEGY_BALANCED = 2 } | 文本的中断策略枚举。 |
237| [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype-1) { WORD_BREAK_TYPE_NORMAL = 0, WORD_BREAK_TYPE_BREAK_ALL = 1, WORD_BREAK_TYPE_BREAK_WORD = 2, WORD_BREAK_TYPE_BREAK_HYPHEN = 3 } | 单词的断词方式枚举。 |
238| [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/>} | 矩形框高度样式枚举。 |
239| [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle-1) { RECT_WIDTH_STYLE_TIGHT, RECT_WIDTH_STYLE_MAX } | 矩形框宽度样式枚举。 |
240| [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/>} | 获取系统字体配置信息列表结果枚举。 |
241| [OH_Drawing_FontWidth](#oh_drawing_fontwidth) {<br/>FONT_WIDTH_ULTRA_CONDENSED = 1, FONT_WIDTH_EXTRA_CONDENSED = 2, FONT_WIDTH_CONDENSED = 3, FONT_WIDTH_SEMI_CONDENSED = 4,<br/>FONT_WIDTH_NORMAL = 5, FONT_WIDTH_SEMI_EXPANDED = 6, FONT_WIDTH_EXPANDED = 7, FONT_WIDTH_EXTRA_EXPANDED = 8,<br/>FONT_WIDTH_ULTRA_EXPANDED = 9<br/>} | 字体宽度的枚举。  |
242| [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 } | 文本高度修饰符模式枚举。 |
243| [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/>} | 文本样式类型枚举。 |
244| [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/>} | 用于描述位图像素的存储格式。 |
245| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat-1) { ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL } | 用于描述位图像素的透明度分量。 |
246| [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个颜色通道上是相同的(透明度有另外的处理规则)。 |
247| [OH_Drawing_TextEncoding](#oh_drawing_textencoding-1) { TEXT_ENCODING_UTF8, TEXT_ENCODING_UTF16, TEXT_ENCODING_UTF32, TEXT_ENCODING_GLYPH_ID } | 文本编码类型枚举。 |
248| [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags-1) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | 阴影标志枚举。 |
249
250### 函数
251
252| 名称 | 描述 |
253| -------- | -------- |
254| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PathGetSegment](#oh_drawing_pathgetsegment) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed, float start, float stop, bool startWithMoveTo, [OH_Drawing_Path](#oh_drawing_path) \*dst, bool \*result) | 截取路径的片段并追加到目标路径上。  |
255| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateSumPathEffect](#oh_drawing_createsumpatheffect) ([OH_Drawing_PathEffect](#oh_drawing_patheffect) \*firstPathEffect, [OH_Drawing_PathEffect](#oh_drawing_patheffect) \*secondPathEffect) | 创建一个使用两种路径效果分别生效后叠加的路径效果对象。  |
256| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreatePathDashEffect](#oh_drawing_createpathdasheffect) (const [OH_Drawing_Path](#oh_drawing_path) \*path, float advance, float phase, [OH_Drawing_PathDashStyle](#oh_drawing_pathdashstyle) type) | 创建一个虚线效果的路径效果对象。  |
257| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateDiscretePathEffect](#oh_drawing_creatediscretepatheffect) (float segLength, float deviation) | 创建一种将路径打散并且在路径上产生不规则分布的路径效果对象。  |
258| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateCornerPathEffect](#oh_drawing_createcornerpatheffect) (float radius) | 创建一个将路径的夹角变成指定半径的圆角的路径效果对象。  |
259| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateComposePathEffect](#oh_drawing_createcomposepatheffect) ([OH_Drawing_PathEffect](#oh_drawing_patheffect) \*outer, [OH_Drawing_PathEffect](#oh_drawing_patheffect) \*inner) | 创建路径组合的路径效果对象。首先应用内部路径效果,然后应用外部路径效果。  |
260| [OH_Drawing_GpuContext](#oh_drawing_gpucontext) \* [OH_Drawing_GpuContextCreate](#oh_drawing_gpucontextcreate) (void) | 用于创建一个图形处理器上下文对象, 使用的后端类型取决于运行设备。  |
261| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawArcWithCenter](#oh_drawing_canvasdrawarcwithcenter) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Rect](#oh_drawing_rect) \*rect, float startAngle, float sweepAngle, bool useCenter) | 绘制一段圆弧。该方法允许指定圆弧的起始角度、扫描角度以及圆弧的起点和终点是否连接圆弧的中心点。  |
262| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawNestedRoundRect](#oh_drawing_canvasdrawnestedroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*outer, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*inner) | 绘制两个嵌套的圆角矩形,外部矩形边界必须包含内部矩形边界,否则无绘制效果。|
263| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasQuickRejectPath](#oh_drawing_canvasquickrejectpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Path](#oh_drawing_path) \*path, bool \*quickReject) | 判断路径与画布区域是否不相交。画布区域包含边界。  |
264| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasQuickRejectRect](#oh_drawing_canvasquickrejectrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Rect](#oh_drawing_rect) \*rect, bool \*quickReject) | 判断矩形和画布区域是否不相交。画布区域包含边界。  |
265| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawPixelMapNine](#oh_drawing_canvasdrawpixelmapnine) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \*pixelMap, const [OH_Drawing_Rect](#oh_drawing_rect) \*center, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, [OH_Drawing_FilterMode](#oh_drawing_filtermode) mode) | 通过绘制两条水平线和两条垂直线将像素图分割成9个部分:四个边,四个角和中心。 若角落的4个区域尺寸不超过目标矩形,则会在不缩放的情况下被绘制在目标矩形,反之则会按比例缩放绘制在目标矩形。 如果还有剩余空间,剩下的5个区域会通过拉伸或压缩来绘制,以便能够完全覆盖目标矩形。  |
266| [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对象,用于管理画布绘制的内容。  |
267| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_SurfaceFlush](#oh_drawing_surfaceflush) ([OH_Drawing_Surface](#oh_drawing_surface) \*surface) | 将surface对象上的画布绘制内容提交给GPU处理,完成绘制内容上屏显示。  |
268| void [OH_Drawing_ErrorCodeReset](#oh_drawing_errorcodereset) (void) | 将本模块的错误码重置为OH_DRAWING_SUCCESS。<br/>通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)获取的本模块错误码会在不以错误码为返回值的接口执行失败时被置为对应的错误编号,但是不会在执行成功后被重置为OH_DRAWING_SUCCESS。<br/>调用本接口可将错误码重置为OH_DRAWING_SUCCESS,避免多个接口间互相干扰,方便开发者调试。 |
269| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontSetThemeFontFollowed](#oh_drawing_fontsetthemefontfollowed) ([OH_Drawing_Font](#oh_drawing_font) \*font, bool followed) | 设置字型中的字体是否跟随主题字体。设置跟随主题字体后,若系统启用主题字体并且字型未被设置字体,字型会使用该主题字体。 |
270| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontIsThemeFontFollowed](#oh_drawing_fontisthemefontfollowed) (const [OH_Drawing_Font](#oh_drawing_font) \*font, bool \*followed) | 获取字型中的字体是否跟随主题字体。默认不跟随主题字体。 |
271| OH_Drawing_FontCollection \* [OH_Drawing_GetFontCollectionGlobalInstance](#oh_drawing_getfontcollectionglobalinstance) (void) | 获取全局字体集对象OH_Drawing_FontCollection,可感知主题字信息,禁止释放该对象。  |
272| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | 用于创建一个位图对象。 |
273| void [OH_Drawing_BitmapDestroy](#oh_drawing_bitmapdestroy) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于销毁位图对象并回收该对象占有内存。 |
274| [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) | 用于创建一个位图对象,并将位图像素存储内存地址设置为开发者申请内存的地址。 |
275| 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) \*) | 用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 |
276| uint32_t [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的宽度。 |
277| uint32_t [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的高度。 |
278| [OH_Drawing_ColorFormat](#oh_drawing_colorformat) [OH_Drawing_BitmapGetColorFormat](#oh_drawing_bitmapgetcolorformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素存储格式。 |
279| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) [OH_Drawing_BitmapGetAlphaFormat](#oh_drawing_bitmapgetalphaformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素透明度分量。 |
280| void \* [OH_Drawing_BitmapGetPixels](#oh_drawing_bitmapgetpixels) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 |
281| void [OH_Drawing_BitmapGetImageInfo](#oh_drawing_bitmapgetimageinfo) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | 用于获取指定位图的信息。 |
282| 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) | 将位图中的矩形区域像素数据读取到指定的内存缓冲区中。 |
283| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | 用于创建一个画刷对象。 |
284| [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),用于拷贝一个已有画刷对象。 |
285| void [OH_Drawing_BrushDestroy](#oh_drawing_brushdestroy) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于销毁画刷对象并回收该对象占有的内存。 |
286| bool [OH_Drawing_BrushIsAntiAlias](#oh_drawing_brushisantialias) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
287| void [OH_Drawing_BrushSetAntiAlias](#oh_drawing_brushsetantialias) ([OH_Drawing_Brush](#oh_drawing_brush) \*, bool) | 用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
288| uint32_t [OH_Drawing_BrushGetColor](#oh_drawing_brushgetcolor) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 |
289| void [OH_Drawing_BrushSetColor](#oh_drawing_brushsetcolor) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint32_t color) | 用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 |
290| uint8_t [OH_Drawing_BrushGetAlpha](#oh_drawing_brushgetalpha) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。 |
291| void [OH_Drawing_BrushSetAlpha](#oh_drawing_brushsetalpha) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint8_t alpha) | 为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。 |
292| void [OH_Drawing_BrushSetShaderEffect](#oh_drawing_brushsetshadereffect) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 为画刷设置着色器效果。 |
293| void [OH_Drawing_BrushSetShadowLayer](#oh_drawing_brushsetshadowlayer) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 为画刷设置阴影层,设置的阴影层效果当前仅在绘制文字时生效。 |
294| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 |
295| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 |
296| void [OH_Drawing_BrushSetBlendMode](#oh_drawing_brushsetblendmode) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 为画刷设置一个混合器,该混合器实现了指定的混合模式枚举。 |
297| void [OH_Drawing_BrushReset](#oh_drawing_brushreset) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 将画刷重置至初始状态,清空所有已设置的属性。 |
298| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | 用于创建一个画布对象。 |
299| void [OH_Drawing_CanvasDestroy](#oh_drawing_canvasdestroy) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于销毁画布对象并回收该对象占有的内存。 |
300| void [OH_Drawing_CanvasBind](#oh_drawing_canvasbind) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 |
301| void [OH_Drawing_CanvasAttachPen](#oh_drawing_canvasattachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。执行该方法后,若画笔的效果发生改变并且开发者希望该变化生效于接下来的绘制动作,需要再次执行该方法以确保变化生效。 |
302| void [OH_Drawing_CanvasDetachPen](#oh_drawing_canvasdetachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 |
303| void [OH_Drawing_CanvasAttachBrush](#oh_drawing_canvasattachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。执行该方法后,若画刷的效果发生改变并且开发者希望该变化生效于接下来的绘制动作,需要再次执行该方法以确保变化生效。 |
304| void [OH_Drawing_CanvasDetachBrush](#oh_drawing_canvasdetachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画刷,使用后画布将不使用此前设置的画刷去填充图形形状。 |
305| void [OH_Drawing_CanvasSave](#oh_drawing_canvassave) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于保存当前画布的状态(画布矩阵)到一个栈顶。需要与恢复接口[OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)配合使用。 |
306| 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)将放弃对矩阵和剪切区域所做的更改,并绘制位图。 |
307| void [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于恢复保存在栈顶的画布状态(画布矩阵)。 |
308| uint32_t [OH_Drawing_CanvasGetSaveCount](#oh_drawing_canvasgetsavecount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于获取栈中保存的画布状态(画布矩阵)的数量。 |
309| void [OH_Drawing_CanvasRestoreToCount](#oh_drawing_canvasrestoretocount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t saveCount) | 用于恢复到指定数量的画布状态(画布矩阵)。 |
310| void [OH_Drawing_CanvasDrawLine](#oh_drawing_canvasdrawline) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float x1, float y1, float x2, float y2) | 用于画一条直线段。 |
311| void [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | 用于画一个自定义路径。 |
312| 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) \*) | 用于将像素图的指定区域绘制到画布的指定区域。 |
313| void [OH_Drawing_CanvasDrawBackground](#oh_drawing_canvasdrawbackground) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于画一个背景,此背景以画刷填充。 |
314| void [OH_Drawing_CanvasDrawRegion](#oh_drawing_canvasdrawregion) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Region](#oh_drawing_region) \*) | 用于画一块区域。 |
315| [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) | 用于画一个点。 |
316| 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) \*) | 用于画多个点,绘制方式分为绘制单独的点、绘制成线段或绘制成开放多边形。 |
317| void [OH_Drawing_CanvasDrawBitmap](#oh_drawing_canvasdrawbitmap) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, float left, float top) | 用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。 |
318| 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) \*) | 将位图的指定区域绘制到画布的指定区域。 |
319| void [OH_Drawing_CanvasSetMatrix](#oh_drawing_canvassetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 设置画布的矩阵状态。 |
320| void [OH_Drawing_CanvasResetMatrix](#oh_drawing_canvasresetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 重置当前画布的矩阵为单位矩阵。 |
321| 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)) | 将图片绘制到画布的指定区域上,源矩形选定的区域会缩放平移到目标矩形。 |
322| 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) \*) | 将图片绘制到画布的指定区域上。 |
323| 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) | 用于画顶点数组描述的三角网格。 |
324| 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) | 从画布中拷贝像素数据到指定地址。该接口不可用于录制类型画布。 |
325| 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) | 从画布拷贝像素数据到位图中。该接口不可用于录制类型画布。 |
326| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasIsClipEmpty](#oh_drawing_canvasisclipempty) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, bool \*isClipEmpty) | 用于判断裁剪后可绘制区域是否为空。 |
327| [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) | 用于获取画布的图像信息。 |
328| void [OH_Drawing_CanvasDrawRect](#oh_drawing_canvasdrawrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个矩形。 |
329| void [OH_Drawing_CanvasDrawCircle](#oh_drawing_canvasdrawcircle) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Point](#oh_drawing_point) \*, float radius) | 用于画一个圆形。 |
330| [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) | 用于使用指定的颜色及混合模式来填充整个画布。 |
331| void [OH_Drawing_CanvasDrawOval](#oh_drawing_canvasdrawoval) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个椭圆。 |
332| 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度时,本接口绘制的是一个椭圆。 |
333| void [OH_Drawing_CanvasDrawRoundRect](#oh_drawing_canvasdrawroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于画一个圆角矩形。 |
334| [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) | 用于绘制单个字符。当前字型中的字体不支持待绘制字符时,退化到使用系统字体绘制字符。 |
335| 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的字体不支持待绘制字符,则该部分字符无法绘制。 |
336| uint32_t [OH_Drawing_ColorSetArgb](#oh_drawing_colorsetargb) (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | 用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 |
337| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateBlendMode](#oh_drawing_colorfiltercreateblendmode) (uint32_t color, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 创建具有混合模式的颜色滤波器。 |
338| [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) | 将两个颜色滤波器合成一个新的颜色滤波器。 |
339| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateMatrix](#oh_drawing_colorfiltercreatematrix) (const float matrix[20]) | 创建具有5x4颜色矩阵的颜色滤波器。 |
340| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLinearToSrgbGamma](#oh_drawing_colorfiltercreatelineartosrgbgamma) (void) | 创建一个从线性颜色空间转换到SRGB颜色空间的颜色滤波器。 |
341| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateSrgbGammaToLinear](#oh_drawing_colorfiltercreatesrgbgammatolinear) (void) | 创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。 |
342| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLuma](#oh_drawing_colorfiltercreateluma) (void) | 创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。 |
343| void [OH_Drawing_ColorFilterDestroy](#oh_drawing_colorfilterdestroy) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 销毁颜色滤波器对象,并收回该对象占用的内存。 |
344| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgb](#oh_drawing_colorspacecreatesrgb) (void) | 创建一个标准颜色空间。 |
345| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgbLinear](#oh_drawing_colorspacecreatesrgblinear) (void) | 创建一个Gamma 1.0空间上的颜色空间。 |
346| void [OH_Drawing_ColorSpaceDestroy](#oh_drawing_colorspacedestroy) ([OH_Drawing_ColorSpace](#oh_drawing_colorspace) \*) | 销毁颜色空间对象,并回收该对象占有内存。 |
347| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget) () | 获取本模块的错误码。 |
348| [OH_Drawing_Filter](#oh_drawing_filter) \* [OH_Drawing_FilterCreate](#oh_drawing_filtercreate) (void) | 创建一个滤波器对象。 |
349| void [OH_Drawing_FilterSetImageFilter](#oh_drawing_filtersetimagefilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | 为滤波器对象设置图像滤波器对象。 |
350| void [OH_Drawing_FilterSetMaskFilter](#oh_drawing_filtersetmaskfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 为滤波器对象设置蒙版滤波器对象。 |
351| void [OH_Drawing_FilterSetColorFilter](#oh_drawing_filtersetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 为滤波器对象设置颜色滤波器对象。 |
352| void [OH_Drawing_FilterGetColorFilter](#oh_drawing_filtergetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 从滤波器对象获取颜色滤波器对象。 |
353| void [OH_Drawing_FilterDestroy](#oh_drawing_filterdestroy) ([OH_Drawing_Filter](#oh_drawing_filter) \*) | 销毁滤波器对象,并收回该对象占用的内存。 |
354| void [OH_Drawing_FontSetBaselineSnap](#oh_drawing_fontsetbaselinesnap) ([OH_Drawing_Font](#oh_drawing_font) \*, bool baselineSnap) | 当前画布矩阵轴对齐时,将字型基线设置为是否与像素对齐。 |
355| bool [OH_Drawing_FontIsBaselineSnap](#oh_drawing_fontisbaselinesnap) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 当前画布矩阵轴对齐时,获取字型基线是否与像素对齐。 |
356| void [OH_Drawing_FontSetEdging](#oh_drawing_fontsetedging) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontEdging](#oh_drawing_fontedging)) | 用于设置字型边缘效果。 |
357| [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontGetEdging](#oh_drawing_fontgetedging) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型边缘效果。 |
358| void [OH_Drawing_FontSetForceAutoHinting](#oh_drawing_fontsetforceautohinting) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isForceAutoHinting) | 用于设置是否自动调整字型轮廓。 |
359| bool [OH_Drawing_FontIsForceAutoHinting](#oh_drawing_fontisforceautohinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型轮廓是否自动调整。 |
360| void [OH_Drawing_FontSetSubpixel](#oh_drawing_fontsetsubpixel) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isSubpixel) | 设置字型是否使用次像素渲染。 |
361| bool [OH_Drawing_FontIsSubpixel](#oh_drawing_fontissubpixel) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型是否使用次像素渲染。 |
362| [OH_Drawing_Font](#oh_drawing_font) \* [OH_Drawing_FontCreate](#oh_drawing_fontcreate) (void) | 用于创建一个字型对象。 |
363| void [OH_Drawing_FontSetTypeface](#oh_drawing_fontsettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于给字型设置字体。 |
364| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontGetTypeface](#oh_drawing_fontgettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*) | 获取字体对象。 |
365| void [OH_Drawing_FontSetTextSize](#oh_drawing_fontsettextsize) ([OH_Drawing_Font](#oh_drawing_font) \*, float textSize) | 用于给字型设置文字大小。 |
366| float [OH_Drawing_FontGetTextSize](#oh_drawing_fontgettextsize) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型文字大小。 |
367| 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) | 获取文本所表示的字符数量。 |
368| 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) | 用于将文本转换为字形索引。 |
369| void [OH_Drawing_FontGetWidths](#oh_drawing_fontgetwidths) (const [OH_Drawing_Font](#oh_drawing_font) \*, const uint16_t \*glyphs, int count, float \*widths) | 用于获取字符串中每个字符的宽度。 |
370| [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) | 用于测量单个字符的宽度。当前字型中的字体不支持待测量字符时,退化到使用系统字体测量字符宽度。 |
371| [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) | 用于获取文本的宽度和边界框。 |
372| void [OH_Drawing_FontSetLinearText](#oh_drawing_fontsetlineartext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isLinearText) | 用于设置线性可缩放字型。 |
373| bool [OH_Drawing_FontIsLinearText](#oh_drawing_fontislineartext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型是否使用线性缩放。 |
374| void [OH_Drawing_FontSetTextSkewX](#oh_drawing_fontsettextskewx) ([OH_Drawing_Font](#oh_drawing_font) \*, float skewX) | 用于给字型设置文本倾斜。 |
375| float [OH_Drawing_FontGetTextSkewX](#oh_drawing_fontgettextskewx) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型文本在x轴上的倾斜度。 |
376| void [OH_Drawing_FontSetFakeBoldText](#oh_drawing_fontsetfakeboldtext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isFakeBoldText) | 用于设置增加描边宽度以近似粗体字体效果。 |
377| bool [OH_Drawing_FontIsFakeBoldText](#oh_drawing_fontisfakeboldtext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取是否增加笔画宽度以接近粗体字体。 |
378| void [OH_Drawing_FontSetScaleX](#oh_drawing_fontsetscalex) ([OH_Drawing_Font](#oh_drawing_font) \*, float scaleX) | 用于设置字型对象在x轴上的缩放比例。 |
379| float [OH_Drawing_FontGetScaleX](#oh_drawing_fontgetscalex) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型对象在x轴上的缩放比例。 |
380| void [OH_Drawing_FontSetHinting](#oh_drawing_fontsethinting) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontHinting](#oh_drawing_fonthinting)) | 用于设置字型轮廓效果。 |
381| [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontGetHinting](#oh_drawing_fontgethinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型轮廓效果枚举类型。 |
382| void [OH_Drawing_FontSetEmbeddedBitmaps](#oh_drawing_fontsetembeddedbitmaps) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isEmbeddedBitmaps) | 用于设置字型是否转换成位图处理。 |
383| bool [OH_Drawing_FontIsEmbeddedBitmaps](#oh_drawing_fontisembeddedbitmaps) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字型是否转换成位图处理。 |
384| void [OH_Drawing_FontDestroy](#oh_drawing_fontdestroy) ([OH_Drawing_Font](#oh_drawing_font) \*) | 用于销毁字型对象并回收该对象占有的内存。 |
385| float [OH_Drawing_FontGetMetrics](#oh_drawing_fontgetmetrics) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | 获取字体度量信息。 |
386| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontGetBounds](#oh_drawing_fontgetbounds) (const [OH_Drawing_Font](#oh_drawing_font) \*font, const uint16_t \*glyphs, uint32_t count, [OH_Drawing_Array](#oh_drawing_array) \*bounds) | 获取字体指定字形索引的矩形边界。 |
387| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontGetPathForGlyph](#oh_drawing_fontgetpathforglyph) (const [OH_Drawing_Font](#oh_drawing_font) \*font, uint16_t glyph, [OH_Drawing_Path](#oh_drawing_path) \*path) | 获取字体指定字形索引的轮廓。 |
388| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontGetTextPath](#oh_drawing_fontgettextpath) (const [OH_Drawing_Font](#oh_drawing_font) \*font, const void \*text, size_t byteLength, [OH_Drawing_TextEncoding](#oh_drawing_textencoding) encoding, float x, float y, [OH_Drawing_Path](#oh_drawing_path) \*path) | 获取文字轮廓路径。 |
389| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | 创建字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 |
390| void [OH_Drawing_DestroyFontCollection](#oh_drawing_destroyfontcollection) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 释放被字体集对象占据的内存。 |
391| void [OH_Drawing_DisableFontCollectionFallback](#oh_drawing_disablefontcollectionfallback) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | 禁用系统字体。 |
392| void [OH_Drawing_DisableFontCollectionSystemFont](#oh_drawing_disablefontcollectionsystemfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | 禁用系统字体。 |
393| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection) (void) | 创建可共享的字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 |
394| void [OH_Drawing_ClearFontCaches](#oh_drawing_clearfontcaches) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 清理字体排版缓存(字体排版缓存本身设有内存上限和清理机制,所占内存有限,如无内存要求,不建议清理)。 |
395| [OH_Drawing_FontMgr](#oh_drawing_fontmgr) \* [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate) (void) | 创建字体管理对象,只支持管理系统字体。 |
396| void [OH_Drawing_FontMgrDestroy](#oh_drawing_fontmgrdestroy) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | 释放字体管理对象占用的内存。 |
397| int [OH_Drawing_FontMgrGetFamilyCount](#oh_drawing_fontmgrgetfamilycount) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | 获取字体家族的数量。 |
398| char \* [OH_Drawing_FontMgrGetFamilyName](#oh_drawing_fontmgrgetfamilyname) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | 由索引值获取字体家族名称。 |
399| void [OH_Drawing_FontMgrDestroyFamilyName](#oh_drawing_fontmgrdestroyfamilyname) (char \*familyName) | 释放指定字体家族名称占用的内存。 |
400| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrCreateFontStyleSet](#oh_drawing_fontmgrcreatefontstyleset) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | 由字体管理对象构造字体样式集对象。 |
401| void [OH_Drawing_FontMgrDestroyFontStyleSet](#oh_drawing_fontmgrdestroyfontstyleset) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | 释放字体样式集对象占用的内存。 |
402| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrMatchFamily](#oh_drawing_fontmgrmatchfamily) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName) | 由指定的字体家族名称,获取字体样式集对象。 |
403| [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)) | 根据指定的字体样式信息和字体家族名称,获取字型对象。 |
404| [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字符值对应的字型对象时返回空指针。 |
405| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontStyleSetCreateTypeface](#oh_drawing_fontstylesetcreatetypeface) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*, int index) | 为指定索引获取字型对象。 |
406| [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) | 获取字体样式。 |
407| void [OH_Drawing_FontStyleSetFreeStyleName](#oh_drawing_fontstylesetfreestylename) (char \*\*styleName) | 释放指定字体样式的内存。 |
408| [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) | 获取最接近字体样式的字型对象。 |
409| int [OH_Drawing_FontStyleSetCount](#oh_drawing_fontstylesetcount) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | 获取字体样式集中字体的个数。 |
410| [OH_Drawing_GpuContext](#oh_drawing_gpucontext) \* [OH_Drawing_GpuContextCreateFromGL](#oh_drawing_gpucontextcreatefromgl) ([OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)) | 用于创建一个使用OpenGL作为后端接口的图形处理器上下文对象。 |
411| void [OH_Drawing_GpuContextDestroy](#oh_drawing_gpucontextdestroy) ([OH_Drawing_GpuContext](#oh_drawing_gpucontext) \*) | 用于销毁图形处理器上下文对象并回收该对象占用的内存。 |
412| [OH_Drawing_Image](#oh_drawing_image) \* [OH_Drawing_ImageCreate](#oh_drawing_imagecreate) (void) | 创建一个图片对象,描述了要绘制的二维像素数组。 |
413| void [OH_Drawing_ImageDestroy](#oh_drawing_imagedestroy) ([OH_Drawing_Image](#oh_drawing_image) \*) | 销毁图片对象并回收该对象占有内存。 |
414| bool [OH_Drawing_ImageBuildFromBitmap](#oh_drawing_imagebuildfrombitmap) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 从位图构造图片对象内容,共享或复制位图像素。如果位图被标记为不可变状态, 像素内存是共享的,不是复制。 |
415| int32_t [OH_Drawing_ImageGetWidth](#oh_drawing_imagegetwidth) ([OH_Drawing_Image](#oh_drawing_image) \*) | 获取图片宽度,即每行的像素个数。 |
416| int32_t [OH_Drawing_ImageGetHeight](#oh_drawing_imagegetheight) ([OH_Drawing_Image](#oh_drawing_image) \*) | 获取图片高度,即像素行数。 |
417| void [OH_Drawing_ImageGetImageInfo](#oh_drawing_imagegetimageinfo) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | 获取图片信息。调用该接口后,传入的图片信息对象被填充。 |
418| [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) | 创建具有模糊效果的图像滤波器。 |
419| [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) | 创建具有颜色变换效果的图像滤波器。 |
420| void [OH_Drawing_ImageFilterDestroy](#oh_drawing_imagefilterdestroy) ([OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | 销毁图像滤波器对象并回收该对象占有内存。 |
421| [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \* [OH_Drawing_MaskFilterCreateBlur](#oh_drawing_maskfiltercreateblur) ([OH_Drawing_BlurType](#oh_drawing_blurtype) blurType, float sigma, bool respectCTM) | 创建具有模糊效果的蒙版滤波器。 |
422| void [OH_Drawing_MaskFilterDestroy](#oh_drawing_maskfilterdestroy) ([OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 销毁蒙版滤波器对象,并收回该对象占用的内存。 |
423| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate) (void) | 用于创建一个矩阵对象。 |
424| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateRotation](#oh_drawing_matrixcreaterotation) (float deg, float x, float y) | 创建一个带旋转属性的矩阵对象。 该矩阵对象为:单位矩阵在(x, y)旋转点以度为单位进行旋转后得到的矩阵。 |
425| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateScale](#oh_drawing_matrixcreatescale) (float sx, float sy, float px, float py) | 创建一个带缩放属性的矩阵对象。 该矩阵对象为:单位矩阵在(px, py)旋转点以sx和sy为缩放因子进行缩放后得到的矩阵。 |
426| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateTranslation](#oh_drawing_matrixcreatetranslation) (float dx, float dy) | 创建一个带平移属性的矩阵对象。 该矩阵对象为:单位矩阵平移(dx, dy)后得到的矩阵。 |
427| 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) | 用于给矩阵对象设置参数。 |
428| 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) | 将矩阵以缩放方式适配目标矩阵。 |
429| void [OH_Drawing_MatrixPreRotate](#oh_drawing_matrixprerotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 将矩阵设置为矩阵左乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 |
430| void [OH_Drawing_MatrixPreScale](#oh_drawing_matrixprescale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | 将矩阵设置为矩阵左乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 |
431| void [OH_Drawing_MatrixPreTranslate](#oh_drawing_matrixpretranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 将矩阵设置为矩阵左乘平移一定距离后的单位矩阵后得到的矩阵。 |
432| void [OH_Drawing_MatrixPostRotate](#oh_drawing_matrixpostrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 将矩阵设置为矩阵右乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 |
433| void [OH_Drawing_MatrixPostScale](#oh_drawing_matrixpostscale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | 将矩阵设置为矩阵右乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 |
434| void [OH_Drawing_MatrixPostTranslate](#oh_drawing_matrixposttranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 将矩阵设置为矩阵右乘平移一定距离后的单位矩阵后得到的矩阵。 |
435| void [OH_Drawing_MatrixReset](#oh_drawing_matrixreset) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 重置当前矩阵为单位矩阵。 |
436| 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 \| |
437| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_MatrixGetAll](#oh_drawing_matrixgetall) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*matrix, float value[9]) | 获取矩阵所有元素值。 |
438| float [OH_Drawing_MatrixGetValue](#oh_drawing_matrixgetvalue) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, int index) | 获取矩阵给定索引位的值。索引范围0-8。 |
439| void [OH_Drawing_MatrixRotate](#oh_drawing_matrixrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点进行旋转。 |
440| void [OH_Drawing_MatrixTranslate](#oh_drawing_matrixtranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 设置矩阵为单位矩阵,并平移(dx, dy)。 |
441| 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进行缩放。 |
442| bool [OH_Drawing_MatrixInvert](#oh_drawing_matrixinvert) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*inverse) | 将矩阵inverse设置为矩阵的倒数,并返回结果。 |
443| 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。 |
444| 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) | 通过矩阵变换将源点数组映射到目标点数组。 |
445| 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) | 将目标矩形设置为一个新的矩形,该矩形是能够包围源矩形的四个顶点通过矩阵变换映射后形成的新顶点的最小矩形。 |
446| bool [OH_Drawing_MatrixIsEqual](#oh_drawing_matrixisequal) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*other) | 判断两个矩阵是否相等。 |
447| bool [OH_Drawing_MatrixIsIdentity](#oh_drawing_matrixisidentity) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 判断矩阵是否是单位矩阵。 |
448| void [OH_Drawing_MatrixDestroy](#oh_drawing_matrixdestroy) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 用于销毁矩阵对象并回收该对象占有的内存。 |
449| [OH_Drawing_MemoryStream](#oh_drawing_memorystream) \* [OH_Drawing_MemoryStreamCreate](#oh_drawing_memorystreamcreate) (const void \*data, size_t length, bool copyData) | 创建一个内存流对象。 |
450| void [OH_Drawing_MemoryStreamDestroy](#oh_drawing_memorystreamdestroy) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*) | 销毁内存流对象并回收该对象占有内存。 |
451| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | 用于创建一个路径对象。 |
452| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCopy](#oh_drawing_pathcopy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 创建一个路径对象副本[OH_Drawing_Path](#oh_drawing_path),用于拷贝一个已有路径对象。 |
453| void [OH_Drawing_PathDestroy](#oh_drawing_pathdestroy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于销毁路径对象并回收该对象占有的内存。 |
454| void [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于设置自定义路径的起始点位置。 |
455| void [OH_Drawing_PathLineTo](#oh_drawing_pathlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 |
456| 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) | 用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框, 矩形边框的内切椭圆将会被用来截取弧线,然后会指定一个起始角度和扫描度数, 从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。若路径有内容则会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 |
457| void [OH_Drawing_PathQuadTo](#oh_drawing_pathquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 |
458| 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)。 |
459| 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))到目标点位置的三阶贝塞尔圆滑曲线。 |
460| void [OH_Drawing_PathRMoveTo](#oh_drawing_pathrmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。 |
461| void [OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 |
462| void [OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 |
463| 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))到目标点位置的圆锥曲线段。 |
464| 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))到目标点位置的三阶贝塞尔圆滑曲线。 |
465| 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)) | 按指定方向,将矩形添加到路径中,添加的路径的起始点为矩形左上角。 |
466| 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) | 按指定方向,向路径添加矩形轮廓。 |
467| 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)) | 按指定方向,向路径添加圆角矩形轮廓。路径添加方向为顺时针时,起始点位于圆角矩形左下方圆角与左边界的交点;路径添加方向为逆时针时,起始点位于圆角矩形左上方圆角与左边界的交点。 |
468| 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)) | 将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。 |
469| 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,则添加椭圆而不是弧。 |
470| 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) \*) | 将源路径矩阵变换后,添加到当前路径中。 |
471| 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)) | 将源路径矩阵变换后,以规定模式添加到当前路径中。 |
472| 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)) | 将源路径以规定模式添加到当前路径中。 |
473| 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)) | 将源路径偏移后,以规定模式添加到当前路径中。 |
474| 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) | 向路径添加多边形。 |
475| 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)) | 按指定方向,向路径添加圆形。 |
476| 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)) | 按指定方向,向路径添加椭圆。 |
477| bool [OH_Drawing_PathBuildFromSvgString](#oh_drawing_pathbuildfromsvgstring) ([OH_Drawing_Path](#oh_drawing_path) \*path, const char \*str) | 解析SVG字符串表示的路径。 |
478| bool [OH_Drawing_PathContains](#oh_drawing_pathcontains) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](#oh_drawing_pathfilltype)。 |
479| void [OH_Drawing_PathTransform](#oh_drawing_pathtransform) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 对路径进行矩阵变换。 |
480| 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,则替换源路径。 |
481| void [OH_Drawing_PathSetFillType](#oh_drawing_pathsetfilltype) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)) | 设置路径的填充类型,这个决定了路径内部区域的定义方式。 |
482| float [OH_Drawing_PathGetLength](#oh_drawing_pathgetlength) ([OH_Drawing_Path](#oh_drawing_path) \*, bool forceClosed) | 获取当前路径的长度。 |
483| void [OH_Drawing_PathGetBounds](#oh_drawing_pathgetbounds) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取包含路径的最小边界框。 |
484| void [OH_Drawing_PathClose](#oh_drawing_pathclose) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 |
485| bool [OH_Drawing_PathIsClosed](#oh_drawing_pathisclosed) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed) | 获取路径是否闭合。 |
486| 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) | 获取距路径起始点指定距离的坐标点和切线值。 |
487| 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) | 将两个路径按照指定的路径操作类型合并。 |
488| 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) | 获取距路径起始点指定距离的相应变换矩阵。 |
489| 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轴方向偏移一定距离,并将结果存储到目标路径对象中。 |
490| void [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于重置自定义路径数据。 |
491| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateDashPathEffect](#oh_drawing_createdashpatheffect) (float \*intervals, int count, float phase) | 创建一个虚线效果的路径效果对象。虚线效果由一组虚线开的间隔、虚线关的间隔数据决定。 |
492| void [OH_Drawing_PathEffectDestroy](#oh_drawing_patheffectdestroy) ([OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | 销毁路径效果对象并回收该对象占有内存。 |
493| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | 用于创建一个画笔对象。 |
494| [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),用于拷贝一个已有画笔对象。 |
495| void [OH_Drawing_PenDestroy](#oh_drawing_pendestroy) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于销毁画笔对象并回收该对象占有的内存。 |
496| bool [OH_Drawing_PenIsAntiAlias](#oh_drawing_penisantialias) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
497| void [OH_Drawing_PenSetAntiAlias](#oh_drawing_pensetantialias) ([OH_Drawing_Pen](#oh_drawing_pen) \*, bool) | 用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
498| uint32_t [OH_Drawing_PenGetColor](#oh_drawing_pengetcolor) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 |
499| void [OH_Drawing_PenSetColor](#oh_drawing_pensetcolor) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint32_t color) | 用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 |
500| uint8_t [OH_Drawing_PenGetAlpha](#oh_drawing_pengetalpha) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。 |
501| void [OH_Drawing_PenSetAlpha](#oh_drawing_pensetalpha) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint8_t alpha) | 为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。 |
502| float [OH_Drawing_PenGetWidth](#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 |
503| void [OH_Drawing_PenSetWidth](#oh_drawing_pensetwidth) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float width) | 用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 |
504| float [OH_Drawing_PenGetMiterLimit](#oh_drawing_pengetmiterlimit) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 |
505| void [OH_Drawing_PenSetMiterLimit](#oh_drawing_pensetmiterlimit) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float miter) | 用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 |
506| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) [OH_Drawing_PenGetCap](#oh_drawing_pengetcap) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔笔帽的样式。 |
507| void [OH_Drawing_PenSetCap](#oh_drawing_pensetcap) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)) | 用于设置画笔笔帽样式。 |
508| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) [OH_Drawing_PenGetJoin](#oh_drawing_pengetjoin) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔绘制折线转角的样式。 |
509| void [OH_Drawing_PenSetJoin](#oh_drawing_pensetjoin) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)) | 用于设置画笔绘制转角的样式。 |
510| void [OH_Drawing_PenSetShaderEffect](#oh_drawing_pensetshadereffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 设置画笔着色器效果。 |
511| void [OH_Drawing_PenSetShadowLayer](#oh_drawing_pensetshadowlayer) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 设置画笔阴影层效果,设置的阴影层效果当前仅在绘制文字时生效。 |
512| void [OH_Drawing_PenSetPathEffect](#oh_drawing_pensetpatheffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | 设置画笔路径效果。 |
513| void [OH_Drawing_PenSetFilter](#oh_drawing_pensetfilter) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | 设置画笔滤波器。 |
514| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 |
515| void [OH_Drawing_PenSetBlendMode](#oh_drawing_pensetblendmode) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 为画笔设置一个混合器,该混合器实现了指定的混合模式枚举。 |
516| 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) \*) | 获取使用画笔绘制的源路径轮廓,并用目标路径表示。 |
517| void [OH_Drawing_PenReset](#oh_drawing_penreset) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 将画笔重置至初始值。 |
518| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap) (NativePixelMap_ \*) | 从图像框架定义的像素图对象中获取本模块定义的像素图对象。 |
519| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative) (OH_PixelmapNative \*) | 从图像框架定义的像素图对象中获取本模块定义的像素图对象。 |
520| 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)建立。 |
521| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_PointCreate](#oh_drawing_pointcreate) (float x, float y) | 用于创建一个坐标点对象。 |
522| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetX](#oh_drawing_pointgetx) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*x) | 用于获取点的x轴坐标。 |
523| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetY](#oh_drawing_pointgety) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*y) | 用于获取点的y轴坐标。 |
524| [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轴坐标。 |
525| void [OH_Drawing_PointDestroy](#oh_drawing_pointdestroy) ([OH_Drawing_Point](#oh_drawing_point) \*) | 用于销毁坐标点对象并回收该对象占有的内存。 |
526| [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \* [OH_Drawing_RecordCmdUtilsCreate](#oh_drawing_recordcmdutilscreate) (void) | 创建一个录制指令工具对象。 |
527| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdUtilsDestroy](#oh_drawing_recordcmdutilsdestroy) ([OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \*recordCmdUtils) | 销毁一个录制指令工具对象,并回收该对象占有的内存。 |
528| [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的绘制接口,记录接下来所有的绘制指令。 |
529| [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/>指令录制工具结束录制指令,将录制类型画布对象记录的绘制指令存入生成的录制指令对象。 |
530| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy) ([OH_Drawing_RecordCmd](#oh_drawing_recordcmd) \*recordCmd) | 销毁录制指令对象,并回收该对象占有的内存。 |
531| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_RectCreate](#oh_drawing_rectcreate) (float left, float top, float right, float bottom) | 用于创建一个矩形对象,不会对设置的坐标排序,即允许矩形设置的左上角坐标大于对应的矩形右下角坐标。 |
532| float [OH_Drawing_RectGetHeight](#oh_drawing_rectgetheight) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取矩形对象高度,计算方式为设置的矩形的右下角纵坐标减去左上角纵坐标。 |
533| float [OH_Drawing_RectGetWidth](#oh_drawing_rectgetwidth) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取矩形对象的宽度,计算方式为设置的矩形的右下角横坐标减去左上角横坐标。 |
534| float [OH_Drawing_RectGetLeft](#oh_drawing_rectgetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的左上角的横坐标。 |
535| float [OH_Drawing_RectGetTop](#oh_drawing_rectgettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的左上角的纵坐标。 |
536| float [OH_Drawing_RectGetRight](#oh_drawing_rectgetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的右下角的横坐标。 |
537| float [OH_Drawing_RectGetBottom](#oh_drawing_rectgetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的右下角的纵坐标。 |
538| bool [OH_Drawing_RectIntersect](#oh_drawing_rectintersect) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | 用于判断两个矩形是否相交,若相交,将rect设置为两个矩形的交集。 |
539| bool [OH_Drawing_RectJoin](#oh_drawing_rectjoin) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | 将两个矩形取并集。 |
540| void [OH_Drawing_RectSetLeft](#oh_drawing_rectsetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float left) | 用于设置矩形左上角的横坐标。 |
541| void [OH_Drawing_RectSetTop](#oh_drawing_rectsettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float top) | 用于设置矩形左上角的纵坐标。 |
542| void [OH_Drawing_RectSetRight](#oh_drawing_rectsetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float right) | 用于设置矩形右下角的横坐标。 |
543| void [OH_Drawing_RectSetBottom](#oh_drawing_rectsetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float bottom) | 用于设置矩形右下角的纵坐标。 |
544| void [OH_Drawing_RectCopy](#oh_drawing_rectcopy) ([OH_Drawing_Rect](#oh_drawing_rect) \*sRect, [OH_Drawing_Rect](#oh_drawing_rect) \*dRect) | 用于将源矩形对象复制到目标矩形对象。 |
545| void [OH_Drawing_RectDestroy](#oh_drawing_rectdestroy) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于销毁矩形对象并回收该对象占有的内存。 |
546| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_RectCreateArray](#oh_drawing_rectcreatearray) (size_t size) | 用于创建一个矩形数组对象, 用来存储多个矩形对象。不再需要[OH_Drawing_Array](#oh_drawing_array)时,请使用[OH_Drawing_RectDestroyArray](#oh_drawing_rectdestroyarray)接口释放该对象的指针。 |
547| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RectGetArraySize](#oh_drawing_rectgetarraysize) ([OH_Drawing_Array](#oh_drawing_array) \*rectArray, size_t \*pSize) | 用于获取矩形数组对象[OH_Drawing_Array](#oh_drawing_array)的大小。 |
548| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RectGetArrayElement](#oh_drawing_rectgetarrayelement) ([OH_Drawing_Array](#oh_drawing_array) \*rectArray, size_t index, [OH_Drawing_Rect](#oh_drawing_rect) \*\*rect) | 用于获取矩形数组对象中指定索引的矩形对象。 |
549| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RectDestroyArray](#oh_drawing_rectdestroyarray) ([OH_Drawing_Array](#oh_drawing_array) \*rectArray) | 用于销毁矩形数组对象并回收该对象占有的内存。 |
550| [OH_Drawing_Region](#oh_drawing_region) \* [OH_Drawing_RegionCreate](#oh_drawing_regioncreate) (void) | 用于创建一个区域对象,实现更精确的图形控制。 |
551| bool [OH_Drawing_RegionContains](#oh_drawing_regioncontains) ([OH_Drawing_Region](#oh_drawing_region) \*region, int32_t x, int32_t y) | 判断区域是否包含指定坐标点。 |
552| 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) | 将两个区域按照指定的区域操作类型合并。 |
553| bool [OH_Drawing_RegionSetRect](#oh_drawing_regionsetrect) ([OH_Drawing_Region](#oh_drawing_region) \*region, const [OH_Drawing_Rect](#oh_drawing_rect) \*rect) | 用于尝试给区域对象设置矩形边界。 |
554| 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) | 给区域对象设置为指定区域内路径表示的范围。 |
555| void [OH_Drawing_RegionDestroy](#oh_drawing_regiondestroy) ([OH_Drawing_Region](#oh_drawing_region) \*) | 用于销毁区域对象并回收该对象占有的内存。 |
556| uint32_t [OH_Drawing_RegisterFont](#oh_drawing_registerfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, const char \*familySrc) | 用于在字体管理器中注册自定义字体,支持的字体文件格式包含:ttf、otf。 |
557| uint32_t [OH_Drawing_RegisterFontBuffer](#oh_drawing_registerfontbuffer) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, uint8_t \*fontBuffer, size_t length) | 用于在字体管理器中注册字体缓冲区。 |
558| [OH_Drawing_RoundRect](#oh_drawing_roundrect) \* [OH_Drawing_RoundRectCreate](#oh_drawing_roundrectcreate) (const [OH_Drawing_Rect](#oh_drawing_rect) \*, float xRad, float yRad) | 用于创建一个圆角矩形对象。 |
559| 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)) | 用于设置圆角矩形中指定圆角位置的圆角半径。 |
560| [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) | 用于获取圆角矩形中指定圆角位置的圆角半径。 |
561| void [OH_Drawing_RoundRectDestroy](#oh_drawing_roundrectdestroy) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于销毁圆角矩形对象并回收该对象占有的内存。 |
562| [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轴方向平移指定距离。 |
563| [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \* [OH_Drawing_SamplingOptionsCreate](#oh_drawing_samplingoptionscreate) ([OH_Drawing_FilterMode](#oh_drawing_filtermode), [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)) | 创建一个采样选项对象。 |
564| void [OH_Drawing_SamplingOptionsDestroy](#oh_drawing_samplingoptionsdestroy) ([OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | 销毁采样选项对象并回收该对象占有内存。 |
565| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateColorShader](#oh_drawing_shadereffectcreatecolorshader) (const uint32_t color) | 创建具有单一颜色的着色器。 |
566| [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)) | 创建着色器,在两个指定点之间生成线性渐变。 |
567| [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) \*) | 创建着色器,在两个指定点之间生成线性渐变。 |
568| [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)) | 创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 |
569| [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) \*) | 创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 |
570| [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°渐变被称为扇形渐变。 |
571| [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) \*) | 创建图像着色器。此接口不建议用于录制类型的画布,会影响性能。 |
572| [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) \*) | 创建着色器,在给定两个圆之间生成渐变。 |
573| void [OH_Drawing_ShaderEffectDestroy](#oh_drawing_shadereffectdestroy) ([OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 销毁着色器对象,并收回该对象占用的内存。 |
574| [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \* [OH_Drawing_ShadowLayerCreate](#oh_drawing_shadowlayercreate) (float blurRadius, float x, float y, uint32_t color) | 创建一个阴影层对象。 |
575| void [OH_Drawing_ShadowLayerDestroy](#oh_drawing_shadowlayerdestroy) ([OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 销毁阴影层对象,并收回该对象占用的内存。 |
576| [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对象,用于管理画布绘制的内容。 |
577| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_SurfaceGetCanvas](#oh_drawing_surfacegetcanvas) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | 通过surface对象获取画布对象。 |
578| void [OH_Drawing_SurfaceDestroy](#oh_drawing_surfacedestroy) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | 销毁surface对象并回收该对象占用的内存。 |
579| [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \* [OH_Drawing_TextBlobBuilderCreate](#oh_drawing_textblobbuildercreate) (void) | 用于创建一个文本构造器对象。 |
580| [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)) | 使用文本创建一个文本对象。 |
581| [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数组中对应的坐标信息决定。 |
582| [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)) | 使用字符串创建文本对象。 |
583| void [OH_Drawing_TextBlobGetBounds](#oh_drawing_textblobgetbounds) ([OH_Drawing_TextBlob](#oh_drawing_textblob) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取文本对象的边界范围。 |
584| uint32_t [OH_Drawing_TextBlobUniqueID](#oh_drawing_textblobuniqueid) (const [OH_Drawing_TextBlob](#oh_drawing_textblob) \*) | 获取文本的标识符,该标识符是唯一的非零值。 |
585| 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)后禁止使用。 |
586| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | 用于从文本构造器中创建文本对象。 |
587| void [OH_Drawing_TextBlobDestroy](#oh_drawing_textblobdestroy) ([OH_Drawing_TextBlob](#oh_drawing_textblob) \*) | 用于销毁文本对象并回收该对象占有的内存。 |
588| void [OH_Drawing_TextBlobBuilderDestroy](#oh_drawing_textblobbuilderdestroy) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | 用于销毁文本构造器对象并回收该对象占有的内存。 |
589| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_MatchFontDescriptors](#oh_drawing_matchfontdescriptors) ([OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \*, size_t \*) | 获取与指定字体描述符匹配的所有系统字体描述符,其中[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的path字段不作为有效的匹配字段,其余字段不是默认值时生效,如果参数[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的所有字段都是默认值,则获取所有系统字体描述符。如果匹配失败,返回NULL。不再需要[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)时,请使用[OH_Drawing_DestroyFontDescriptors](_drawing.md#oh_drawing_destroyfontdescriptors)接口释放该对象的指针。 |
590| void [OH_Drawing_DestroyFontDescriptors](#oh_drawing_destroyfontdescriptors) ([OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \*, size_t) | 释放字体描述符[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)数组。 |
591| [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)) | 根据字体名称和字体类型获取指定的字体描述符,支持系统字体、风格字体和用户已安装字体。 字体描述符是描述字体特征的一种数据结构,它包含了定义字体外观和属性的详细信息。 |
592| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetSystemFontFullNamesByType](#oh_drawing_getsystemfontfullnamesbytype) ([OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)) | 根据字体类型获取对应字体的字体名称数组。 |
593| const [OH_Drawing_String](_o_h___drawing___string.md) \* [OH_Drawing_GetSystemFontFullNameByIndex](#oh_drawing_getsystemfontfullnamebyindex) ([OH_Drawing_Array](#oh_drawing_array) \*, size_t) | 在字体名称数组中通过索引获取对应位置的字体名称。 |
594| void [OH_Drawing_DestroySystemFontFullNames](#oh_drawing_destroysystemfontfullnames) ([OH_Drawing_Array](#oh_drawing_array) \*) | 释放通过字体类型获取的对应字体的字体名称数组占用的内存。 |
595| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_TypographyGetTextLines](#oh_drawing_typographygettextlines) ([OH_Drawing_Typography](#oh_drawing_typography) \*typography) | 获取排版对象的文本行数组。文本行数组中包含一个或多个文本行对象。不再需要[OH_Drawing_Array](#oh_drawing_array)时,请使用[OH_Drawing_DestroyTextLines](#oh_drawing_destroytextlines)接口释放该对象的指针。 |
596| void [OH_Drawing_DestroyTextLines](#oh_drawing_destroytextlines) ([OH_Drawing_Array](#oh_drawing_array) \*lines) | 释放文本行数组的内存。 |
597| void [OH_Drawing_DestroyTextLine](#oh_drawing_destroytextline) (OH_Drawing_TextLine \*line) | 释放单个文本行对象的内存。只能释放单独申请内存的文本行对象,不能释放文本行数组中的某一个文本行对象的内存。 |
598| OH_Drawing_TextLine \* [OH_Drawing_GetTextLineByIndex](#oh_drawing_gettextlinebyindex) ([OH_Drawing_Array](#oh_drawing_array) \*lines, size_t index) | 获取文本行数组指定索引处的文本行对象。 |
599| double [OH_Drawing_TextLineGetGlyphCount](#oh_drawing_textlinegetglyphcount) (OH_Drawing_TextLine \*line) | 获取文本行对象中字形的数量。 |
600| void [OH_Drawing_TextLineGetTextRange](#oh_drawing_textlinegettextrange) (OH_Drawing_TextLine \*line, size_t \*start, size_t \*end) | 获取文本行对象中的文本在整个段落文本中的索引区间。 |
601| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_TextLineGetGlyphRuns](#oh_drawing_textlinegetglyphruns) (OH_Drawing_TextLine \*line) | 获取文本行对象中的文本渲染单元数组。 |
602| void [OH_Drawing_DestroyRuns](#oh_drawing_destroyruns) ([OH_Drawing_Array](#oh_drawing_array) \*runs) | 释放文本渲染单元数组的内存。 |
603| OH_Drawing_Run \* [OH_Drawing_GetRunByIndex](#oh_drawing_getrunbyindex) ([OH_Drawing_Array](#oh_drawing_array) \*runs, size_t index) | 获取文本渲染单元数组指定索引处的文本渲染单元对象。 |
604| void [OH_Drawing_TextLinePaint](#oh_drawing_textlinepaint) (OH_Drawing_TextLine \*line, [OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, double x, double y) | 在画布上以坐标点 (x, y) 为左上角位置绘制文本行。 |
605| OH_Drawing_TextLine \* [OH_Drawing_TextLineCreateTruncatedLine](#oh_drawing_textlinecreatetruncatedline) (OH_Drawing_TextLine \*line, double width, int mode, const char \*ellipsis) | 创建一个截断的文本行对象。 |
606| double [OH_Drawing_TextLineGetTypographicBounds](#oh_drawing_textlinegettypographicbounds) (OH_Drawing_TextLine \*line, double \*ascent, double \*descent, double \*leading) | 获取文本行对象的排版边界。文本行排版边界与排版字体、排版字号有关,与字符本身无关。 例如字符串为" a b ",'a'字符前面有1个空格,'b'字符后面有1个空格,排版边界就包括行首和末尾空格的边界。例如字符串为"j"或"E",排版边界相同,即与字符本身无关。 |
607| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_TextLineGetImageBounds](#oh_drawing_textlinegetimagebounds) (OH_Drawing_TextLine \*line) | 获取文本行对象的图像边界。文本行图像边界与排版字体、排版字号、字符本身都有关,相当于视觉边界。 例如字符串为" a b ",'a'字符前面有1个空格,'b'字符后面有1个空格,用户在界面上只能看到"a b",图像边界即为不包括带行首和末尾空格的边界。 例如字符串为"j"或"E",视觉边界不同,即与字符本身有关,"j"字符串的视觉边界宽度小于"E"字符串的视觉边界宽度,"j"字符串的视觉边界高度大于"E"字符串的视觉边界高度。 |
608| double [OH_Drawing_TextLineGetTrailingSpaceWidth](#oh_drawing_textlinegettrailingspacewidth) (OH_Drawing_TextLine \*line) | 获取文本行对象尾部空白字符的宽度。 |
609| int32_t [OH_Drawing_TextLineGetStringIndexForPosition](#oh_drawing_textlinegetstringindexforposition) (OH_Drawing_TextLine \*line, [OH_Drawing_Point](#oh_drawing_point) \*point) | 获取文本行对象中指定位置处的字符索引。 |
610| double [OH_Drawing_TextLineGetOffsetForStringIndex](#oh_drawing_textlinegetoffsetforstringindex) (OH_Drawing_TextLine \*line, int32_t index) | 获取文本行对象中指定字符串索引处的偏移量。 |
611| void [OH_Drawing_TextLineEnumerateCaretOffsets](#oh_drawing_textlineenumeratecaretoffsets) (OH_Drawing_TextLine \*line, [Drawing_CaretOffsetsCallback](#drawing_caretoffsetscallback) callback) | 枚举文本行对象中每个字符的偏移量和索引值,传递给用户自定义的回调函数,用户可以使用偏移量和索引值进行其他操作。 |
612| double [OH_Drawing_TextLineGetAlignmentOffset](#oh_drawing_textlinegetalignmentoffset) (OH_Drawing_TextLine \*line, double alignmentFactor, double alignmentWidth) | 获取文本行对象根据对齐因子和对齐宽度计算对齐后所需的偏移量。 |
613| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetRunStringIndices](#oh_drawing_getrunstringindices) (OH_Drawing_Run \*run, int64_t start, int64_t length) | 获取渲染单元指定范围内字形的字符索引数组,该索引是相对于整个段落的偏移。 |
614| uint64_t [OH_Drawing_GetRunStringIndicesByIndex](#oh_drawing_getrunstringindicesbyindex) ([OH_Drawing_Array](#oh_drawing_array) \*stringIndices, size_t index) | 获取字符索引数组中指定下标的字符索引值。 |
615| void [OH_Drawing_DestroyRunStringIndices](#oh_drawing_destroyrunstringindices) ([OH_Drawing_Array](#oh_drawing_array) \*stringIndices) | 释放字形的字符索引数组对象指针。 |
616| void [OH_Drawing_GetRunStringRange](#oh_drawing_getrunstringrange) (OH_Drawing_Run \*run, uint64_t \*location, uint64_t \*length) | 获取渲染单元生成字形的字符范围。 |
617| float [OH_Drawing_GetRunTypographicBounds](#oh_drawing_getruntypographicbounds) (OH_Drawing_Run \*run, float \*ascent, float \*descent, float \*leading) | 获取渲染单元的排版边界。文本排版边界与字符本身无关,与排版字号和字体有关。 |
618| void [OH_Drawing_RunPaint](#oh_drawing_runpaint) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, OH_Drawing_Run \*run, double x, double y) | 在画布上绘制渲染单元包含的文本。 |
619| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_GetRunImageBounds](#oh_drawing_getrunimagebounds) (OH_Drawing_Run \*run) | 获取渲染单元的图像边界,文本图像边界与字符本身有关,相当于视觉边界。 |
620| void [OH_Drawing_DestroyRunImageBounds](#oh_drawing_destroyrunimagebounds) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect) | 释放渲染单元图像边界对象指针。 |
621| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetRunGlyphs](#oh_drawing_getrunglyphs) (OH_Drawing_Run \*run, int64_t start, int64_t length) | 获取渲染单元指定范围内的字形数组。 |
622| uint16_t [OH_Drawing_GetRunGlyphsByIndex](#oh_drawing_getrunglyphsbyindex) ([OH_Drawing_Array](#oh_drawing_array) \*glyphs, size_t index) | 根据索引获取渲染单元单个字形。 |
623| void [OH_Drawing_DestroyRunGlyphs](#oh_drawing_destroyrunglyphs) ([OH_Drawing_Array](#oh_drawing_array) \*glyphs) | 释放渲染单元字形数组对象指针。 |
624| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetRunPositions](#oh_drawing_getrunpositions) (OH_Drawing_Run \*run, int64_t start, int64_t length) | 获取渲染单元指定范围内字形的位置。 |
625| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_GetRunPositionsByIndex](#oh_drawing_getrunpositionsbyindex) ([OH_Drawing_Array](#oh_drawing_array) \*positions, size_t index) | 根据索引获取渲染单元中单个字形位置。 |
626| void [OH_Drawing_DestroyRunPositions](#oh_drawing_destroyrunpositions) ([OH_Drawing_Array](#oh_drawing_array) \*positions) | 释放渲染单元字形位置数组对象指针。 |
627| uint32_t [OH_Drawing_GetRunGlyphCount](#oh_drawing_getrunglyphcount) (OH_Drawing_Run \*run) | 获取渲染单元字形数量。 |
628| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \* [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | 创建指向OH_Drawing_TypographyStyle对象的指针。不再需要[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)时,请使用[OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle)接口释放该对象的指针。 |
629| void [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 释放被OH_Drawing_TypographyStyle对象占据的内存。 |
630| void [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置指定排版样式中的文本方向。 |
631| void [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本对齐方式。 |
632| int [OH_Drawing_TypographyGetEffectiveAlignment](#oh_drawing_typographygeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文字对齐方式。 |
633| void [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本最大行数。 |
634| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | 创建指向OH_Drawing_TextStyle对象的指针。 |
635| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_TypographyGetTextStyle](#oh_drawing_typographygettextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取指定排版样式中设置的默认文本样式。 |
636| void [OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 释放被OH_Drawing_TextStyle对象占据的内存。 |
637| void [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置文本颜色。 |
638| void [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置字号。 |
639| void [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 为指定文本样式设置字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 |
640| void [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置文本样式的字体基线位置。 |
641| void [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置指定文本样式中的装饰线类型,只能设置一个装饰线类型,添加多个需要使用[OH_Drawing_AddTextStyleDecoration](#oh_drawing_addtextstyledecoration)。 |
642| void [OH_Drawing_AddTextStyleDecoration](#oh_drawing_addtextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 新增指定装饰,可同时显示多种装饰线。 |
643| void [OH_Drawing_RemoveTextStyleDecoration](#oh_drawing_removetextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 删除指定装饰。 |
644| void [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置指定文本样式中的装饰线颜色。 |
645| void [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置行高,按当前字体大小的倍数进行设置。 |
646| void [OH_Drawing_SetTextStyleFontFamilies](#oh_drawing_settextstylefontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int, const char \*fontFamilies[]) | 设置指定文本样式的字体家族类型。 |
647| void [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 为指定文本样式设置字体样式。 |
648| void [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置文本语言环境。 |
649| void [OH_Drawing_SetTextStyleForegroundBrush](#oh_drawing_settextstyleforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 设置指定文本样式中的前景色画刷。 |
650| void [OH_Drawing_TextStyleGetForegroundBrush](#oh_drawing_textstylegetforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 返回设置的前景色画刷。 |
651| void [OH_Drawing_SetTextStyleForegroundPen](#oh_drawing_settextstyleforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 设置指定文本样式中的前景色画笔。 |
652| void [OH_Drawing_TextStyleGetForegroundPen](#oh_drawing_textstylegetforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 返回设置的前景色画笔。 |
653| void [OH_Drawing_SetTextStyleBackgroundBrush](#oh_drawing_settextstylebackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 设置指定文本样式中的背景色画刷。 |
654| void [OH_Drawing_TextStyleGetBackgroundBrush](#oh_drawing_textstylegetbackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 返回设置的背景色画刷。 |
655| void [OH_Drawing_SetTextStyleBackgroundPen](#oh_drawing_settextstylebackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 设置指定文本样式中的背景色画笔。 |
656| void [OH_Drawing_TextStyleGetBackgroundPen](#oh_drawing_textstylegetbackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 返回设置的背景色画笔。 |
657| [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对象的指针。不再需要[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)时,请使用[OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler)接口释放该对象的指针。 |
658| void [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 释放被OH_Drawing_TypographyCreate对象占据的内存。 |
659| void [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 将指定文本样式压入文本样式栈,后续添加的文本总是会使用栈顶的文本样式。 |
660| void [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | 设置文本内容。 |
661| void [OH_Drawing_TypographyHandlerPopTextStyle](#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 从文本样式栈中弹出栈顶文本样式。 |
662| [OH_Drawing_Typography](#oh_drawing_typography) \* [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 创建指向OH_Drawing_Typography对象的指针。不再需要[OH_Drawing_Typography](#oh_drawing_typography)时,请使用[OH_Drawing_DestroyTypography](#oh_drawing_destroytypography)接口释放该对象的指针。 |
663| void [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 释放OH_Drawing_Typography对象占据的内存。 |
664| void [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | 排版布局。 |
665| 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)接口调用并生效之后调用。 |
666| void [OH_Drawing_TypographyPaintOnPath](#oh_drawing_typographypaintonpath) ([OH_Drawing_Typography](#oh_drawing_typography) \* typography, [OH_Drawing_Canvas](#oh_drawing_canvas) \* canvas, [OH_Drawing_Path](#oh_drawing_path) \* path, double hOffset, double vOffset) | 沿指定路径绘制文本。建议搭配[OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines)接口设置最大行为1行,避免因文本宽度超过排版宽度出现跨行重叠问题。  |
667| double [OH_Drawing_TypographyGetMaxWidth](#oh_drawing_typographygetmaxwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取用户设置的排版宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
668| double [OH_Drawing_TypographyGetHeight](#oh_drawing_typographygetheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象整体的高度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
669| double [OH_Drawing_TypographyGetLongestLine](#oh_drawing_typographygetlongestline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象最长行的宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。 |
670| double [OH_Drawing_TypographyGetLongestLineWithIndent](#oh_drawing_typographygetlongestlinewithindent) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象最长行的宽度(该宽度包含当前行缩进的宽度),该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。 |
671| double [OH_Drawing_TypographyGetMinIntrinsicWidth](#oh_drawing_typographygetminintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象的最小固有宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
672| double [OH_Drawing_TypographyGetMaxIntrinsicWidth](#oh_drawing_typographygetmaxintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象的最大固有宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
673| double [OH_Drawing_TypographyGetAlphabeticBaseline](#oh_drawing_typographygetalphabeticbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版样式字母文字基线。 |
674| double [OH_Drawing_TypographyGetIdeographicBaseline](#oh_drawing_typographygetideographicbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版样式表意文字基线。 |
675| void [OH_Drawing_TypographyHandlerAddPlaceholder](#oh_drawing_typographyhandleraddplaceholder) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) \*) | 设置占位符。 |
676| 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。 |
677| [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)接口释放该对象的指针。 |
678| [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)接口释放该对象的指针。 |
679| float [OH_Drawing_GetLeftFromTextBox](#oh_drawing_getleftfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框左侧位置。 |
680| float [OH_Drawing_GetRightFromTextBox](#oh_drawing_getrightfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框右侧位置。 |
681| float [OH_Drawing_GetTopFromTextBox](#oh_drawing_gettopfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框顶部位置。 |
682| float [OH_Drawing_GetBottomFromTextBox](#oh_drawing_getbottomfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框底部位置。 |
683| int [OH_Drawing_GetTextDirectionFromTextBox](#oh_drawing_gettextdirectionfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框方向。 |
684| size_t [OH_Drawing_GetSizeOfTextBox](#oh_drawing_getsizeoftextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | 获取文本框数量大小。 |
685| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本的索引位置和亲和性。 |
686| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。 |
687| size_t [OH_Drawing_GetPositionFromPositionAndAffinity](#oh_drawing_getpositionfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的位置属性。 |
688| int [OH_Drawing_GetAffinityFromPositionAndAffinity](#oh_drawing_getaffinityfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本。 |
689| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t) | 获取排版对象中单词的边界。 |
690| size_t [OH_Drawing_GetStartFromRange](#oh_drawing_getstartfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象开始位置。 |
691| size_t [OH_Drawing_GetEndFromRange](#oh_drawing_getendfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象结束位置。 |
692| size_t [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取排版对象中文本行数,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
693| void [OH_Drawing_SetTextStyleDecorationStyle](#oh_drawing_settextstyledecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置指定文本样式中的装饰线样式。 |
694| void [OH_Drawing_SetTextStyleDecorationThicknessScale](#oh_drawing_settextstyledecorationthicknessscale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本装饰线的厚度缩放比例。 |
695| void [OH_Drawing_SetTextStyleLetterSpacing](#oh_drawing_settextstyleletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的字符间距。 |
696| void [OH_Drawing_SetTextStyleWordSpacing](#oh_drawing_settextstylewordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的单词间距。 |
697| void [OH_Drawing_SetTextStyleHalfLeading](#oh_drawing_settextstylehalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, bool) | 设置文本为一半行间距。 |
698| void [OH_Drawing_SetTextStyleEllipsis](#oh_drawing_settextstyleellipsis) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置文本的省略号内容。 |
699| void [OH_Drawing_SetTextStyleEllipsisModal](#oh_drawing_settextstyleellipsismodal) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置文本的省略号样式。 |
700| void [OH_Drawing_SetTypographyTextBreakStrategy](#oh_drawing_settypographytextbreakstrategy) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本的中断策略。 |
701| void [OH_Drawing_SetTypographyTextWordBreakType](#oh_drawing_settypographytextwordbreaktype) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置单词的断词方式。 |
702| void [OH_Drawing_SetTypographyTextEllipsisModal](#oh_drawing_settypographytextellipsismodal) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置排版样式省略模式。 |
703| void [OH_Drawing_SetTypographyTextEllipsis](#oh_drawing_settypographytextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*ellipsis) | 设置排版样式省略号文本。 |
704| double [OH_Drawing_TypographyGetLineHeight](#oh_drawing_typographygetlineheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取排版对象中指定行的行高,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
705| double [OH_Drawing_TypographyGetLineWidth](#oh_drawing_typographygetlinewidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取指定行的行宽,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。 |
706| void [OH_Drawing_SetTypographyTextSplitRatio](#oh_drawing_settypographytextsplitratio) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, float textSplitRatio) | 设置文本划分比率。 |
707| bool [OH_Drawing_TypographyIsLineUnlimited](#oh_drawing_typographyislineunlimited) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否有最大行数限制。 |
708| bool [OH_Drawing_TypographyIsEllipsized](#oh_drawing_typographyisellipsized) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取指定排版样式是否配置省略号。 |
709| void [OH_Drawing_SetTypographyTextLocale](#oh_drawing_settypographytextlocale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*locale) | 设置指定排版样式的语言环境。 |
710| 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) \*) | 获取文本字体属性。 |
711| void [OH_Drawing_SetTypographyTextStyle](#oh_drawing_settypographytextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 设置排版样式。 |
712| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor) (void) | 构造字体描述对象,用于描述系统字体详细信息。 |
713| void [OH_Drawing_DestroyFontDescriptor](#oh_drawing_destroyfontdescriptor) ([OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \*) | 释放字体描述对象占用的内存。 |
714| [OH_Drawing_FontParser](#oh_drawing_fontparser) \* [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser) (void) | 构造字体解析对象,用于解析系统字体。 |
715| void [OH_Drawing_DestroyFontParser](#oh_drawing_destroyfontparser) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*) | 释放字体解析对象占用的内存。 |
716| char \*\* [OH_Drawing_FontParserGetSystemFontList](#oh_drawing_fontparsergetsystemfontlist) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, size_t \*) | 获取系统字体名称列表,此接口仅在2in1、phone设备上可用。 |
717| void [OH_Drawing_DestroySystemFontList](#oh_drawing_destroysystemfontlist) (char \*\*, size_t) | 释放系统字体名称列表占用的内存。 |
718| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_FontParserGetFontByName](#oh_drawing_fontparsergetfontbyname) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, const char \*) | 根据传入的系统字体名称获取系统字体的相关信息。 |
719| [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)接口释放该对象的指针。 |
720| size_t [OH_Drawing_LineMetricsGetSize](#oh_drawing_linemetricsgetsize) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 获取行数量。 |
721| void [OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 释放行位置信息对象占用的内存。 |
722| 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)接口调用之后调用。 |
723| 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)接口调用之后调用。 |
724| void [OH_Drawing_SetTypographyTextFontWeight](#oh_drawing_settypographytextfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置排版样式默认字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 |
725| void [OH_Drawing_SetTypographyTextFontStyle](#oh_drawing_settypographytextfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置排版样式默认的字体样式。 |
726| void [OH_Drawing_SetTypographyTextFontFamily](#oh_drawing_settypographytextfontfamily) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, const char \*) | 设置字体家族的名称。 |
727| void [OH_Drawing_SetTypographyTextFontSize](#oh_drawing_settypographytextfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版字号。 |
728| void [OH_Drawing_SetTypographyTextFontHeight](#oh_drawing_settypographytextfontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版字体高度。 |
729| void [OH_Drawing_SetTypographyTextHalfLeading](#oh_drawing_settypographytexthalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否为一半行间距。 |
730| void [OH_Drawing_SetTypographyTextUseLineStyle](#oh_drawing_settypographytextuselinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否启用行样式。 |
731| void [OH_Drawing_SetTypographyTextLineStyleFontWeight](#oh_drawing_settypographytextlinestylefontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置排版样式中支柱样式的文本样式字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 |
732| void [OH_Drawing_SetTypographyTextLineStyleFontStyle](#oh_drawing_settypographytextlinestylefontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版样式中支柱样式的字体样式。 |
733| void [OH_Drawing_SetTypographyTextLineStyleFontFamilies](#oh_drawing_settypographytextlinestylefontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int, const char \*fontFamilies[]) | 设置文本排版行样式字体类型。 |
734| void [OH_Drawing_SetTypographyTextLineStyleFontSize](#oh_drawing_settypographytextlinestylefontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式字号。 |
735| void [OH_Drawing_SetTypographyTextLineStyleFontHeight](#oh_drawing_settypographytextlinestylefontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式字体高度。 |
736| void [OH_Drawing_SetTypographyTextLineStyleHalfLeading](#oh_drawing_settypographytextlinestylehalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版行样式中支柱样式是否开启一半行间距。 |
737| void [OH_Drawing_SetTypographyTextLineStyleSpacingScale](#oh_drawing_settypographytextlinestylespacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式间距比例。 |
738| void [OH_Drawing_SetTypographyTextLineStyleOnly](#oh_drawing_settypographytextlinestyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否仅启用行样式。 |
739| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow) (void) | 创建指向字体阴影对象的指针。不再需要[OH_Drawing_TextShadow](#oh_drawing_textshadow)时,请使用[OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow)接口释放该对象的指针。 |
740| void [OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 释放被字体阴影对象占据的内存。 |
741| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadows](#oh_drawing_textstylegetshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体阴影容器。不再需要[OH_Drawing_TextShadow](#oh_drawing_textshadow)时,请使用[OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows)接口释放该对象的指针。 |
742| int [OH_Drawing_TextStyleGetShadowCount](#oh_drawing_textstylegetshadowcount) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体阴影容器的大小。 |
743| void [OH_Drawing_TextStyleAddShadow](#oh_drawing_textstyleaddshadow) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const [OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 字体阴影容器中添加字体阴影元素。 |
744| void [OH_Drawing_TextStyleClearShadows](#oh_drawing_textstyleclearshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 清除字体阴影容器中的所有元素。 |
745| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadowWithIndex](#oh_drawing_textstylegetshadowwithindex) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 根据下标获取字体阴影容器中的元素。 |
746| void [OH_Drawing_TypographySetIndents](#oh_drawing_typographysetindents) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, const float indents[]) | 设置文本的排版缩进,不调用此接口默认文本无缩进。 |
747| float [OH_Drawing_TypographyGetIndentsWithIndex](#oh_drawing_typographygetindentswithindex) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 根据行索引获取排版对象缩进容器中的元素,行索引从0开始。 |
748| [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。如果输入的行索引是非法的行索引,则返回的边界范围的start和end都为0。|
749| void [OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。 |
750| [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \* [OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo) ([OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode) \*) | 获取系统字体配置信息。 |
751| void [OH_Drawing_DestroySystemFontConfigInfo](#oh_drawing_destroysystemfontconfiginfo) ([OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \*) | 释放系统字体配置信息占用的的内存。 |
752| 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) | 设置文本样式中的字体样式,包括字体字重、字体宽度和字体斜度。 |
753| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TextStyleGetFontStyleStruct](#oh_drawing_textstylegetfontstylestruct) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*drawingTextStyle) | 获取文本样式中的字体样式,包括字体字重、字体宽度和字体斜度。 |
754| 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) | 设置排版样式中默认文本样式的字体样式,包括字体字重、字体宽度和字体斜度。 |
755| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TypographyStyleGetFontStyleStruct](#oh_drawing_typographystylegetfontstylestruct) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*drawingStyle) | 获取排版样式中默认文本样式的字体样式,包括字体字重、字体宽度和字体斜度。 |
756| 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仅当背景框为圆角矩形时有效。 |
757| void [OH_Drawing_TypographyHandlerAddSymbol](#oh_drawing_typographyhandleraddsymbol) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, uint32_t symbol) | 设置排版创建过程中的符号。 |
758| void [OH_Drawing_TextStyleAddFontFeature](#oh_drawing_textstyleaddfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*tag, int value) | 设置文本样式中指定字体特征是否启用。 |
759| void [OH_Drawing_TextStyleAddFontVariation](#oh_drawing_textstyleaddfontvariation) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*, const float) | 添加可变字体属性。对应的字体文件(.ttf文件)需要支持可变调节,此接口才能生效。当对应的字体不支持可变调节时,此接口调用不生效。 |
760| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \* [OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式的字体特征map容器中所有内容。 |
761| void [OH_Drawing_TextStyleDestroyFontFeatures](#oh_drawing_textstyledestroyfontfeatures) ([OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \*, size_t fontFeatureSize) | 释放存放字体特征所有内容的结构体数组所占用的空间。 |
762| size_t [OH_Drawing_TextStyleGetFontFeatureSize](#oh_drawing_textstylegetfontfeaturesize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式中字体特征map容器的大小。 |
763| void [OH_Drawing_TextStyleClearFontFeature](#oh_drawing_textstyleclearfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 清除指定文本样式的字体特征map容器中所有内容。 |
764| double [OH_Drawing_TextStyleGetBaselineShift](#oh_drawing_textstylegetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的基线偏移。 |
765| void [OH_Drawing_TextStyleSetBaselineShift](#oh_drawing_textstylesetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double lineShift) | 设置文本样式基线偏移。 |
766| void [OH_Drawing_TypographyTextSetHeightBehavior](#oh_drawing_typographytextsetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) heightMode) | 设置文本高度修饰符模式。 |
767| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) [OH_Drawing_TypographyTextGetHeightBehavior](#oh_drawing_typographytextgetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本高度修饰符模式。 |
768| [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)接口释放该对象的指针。 |
769| void [OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics) ([OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | 释放指定行所有字体度量结构体集合所占用的所有空间。 |
770| bool [OH_Drawing_TextStyleIsEqual](#oh_drawing_textstyleisequal) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | 判断两个文本样式对象是否相等,字宽属性不参与对比。 |
771| bool [OH_Drawing_TextStyleIsEqualByFont](#oh_drawing_textstyleisequalbyfont) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | 判断两个文本样式对象的字体样式属性是否相等。 |
772| 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) | 判断两个文本样式对象是否有一样的文本样式类型。 |
773| void [OH_Drawing_TextStyleSetPlaceholder](#oh_drawing_textstylesetplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | 设置占位符。 |
774| bool [OH_Drawing_TextStyleIsPlaceholder](#oh_drawing_textstyleisplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | 返回是否有设置文本占位符。 |
775| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyStyleGetEffectiveAlignment](#oh_drawing_typographystylegeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本对齐模式。 |
776| bool [OH_Drawing_TypographyStyleIsHintEnabled](#oh_drawing_typographystyleishintenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否启用字形轮廓自动调整,字形轮廓自动调整用于在渲染小字号文本时改善其可读性和外观。 |
777| void [OH_Drawing_SetTypographyStyleTextStrutStyle](#oh_drawing_settypographystyletextstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | 设置文本支柱样式。 |
778| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \* [OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本支柱样式。 |
779| void [OH_Drawing_TypographyStyleDestroyStrutStyle](#oh_drawing_typographystyledestroystrutstyle) ([OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | 释放被支柱样式对象占据的内存。 |
780| 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) | 判断支柱样式结构体是否相同。 |
781| void [OH_Drawing_TypographyStyleSetHintsEnabled](#oh_drawing_typographystylesethintsenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, bool hintsEnabled) | 设置文本是否启用字形轮廓自动调整,字形轮廓自动调整用于在渲染小字号文本时改善其可读性和外观。 |
782| void [OH_Drawing_TypographyMarkDirty](#oh_drawing_typographymarkdirty) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 将排版标记为脏数据,用于初始化排版状态。 |
783| int32_t [OH_Drawing_TypographyGetUnresolvedGlyphsCount](#oh_drawing_typographygetunresolvedglyphscount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本中尚未解析的字形的数量,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用并生效之后调用。 |
784| void [OH_Drawing_TypographyUpdateFontSize](#oh_drawing_typographyupdatefontsize) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t from, size_t to, float fontSize) | 更新排版对象中的字体大小。 |
785| bool [OH_Drawing_TypographyTextGetLineStyle](#oh_drawing_typographytextgetlinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版是否启用行样式。 |
786| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TypographyTextlineStyleGetFontWeight](#oh_drawing_typographytextlinestylegetfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取排版样式中支柱样式字重。 |
787| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TypographyTextlineStyleGetFontStyle](#oh_drawing_typographytextlinestylegetfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版样式中支柱样式的字体样式。 |
788| char \*\* [OH_Drawing_TypographyTextlineStyleGetFontFamilies](#oh_drawing_typographytextlinestylegetfontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, size_t \*num) | 获取文本排版样式中支柱样式的字体家族名。 |
789| void [OH_Drawing_TypographyTextlineStyleDestroyFontFamilies](#oh_drawing_typographytextlinestyledestroyfontfamilies) (char \*\*fontFamilies, size_t fontFamiliesNum) | 释放字体类型占用的内存。 |
790| double [OH_Drawing_TypographyTextlineStyleGetFontSize](#oh_drawing_typographytextlinestylegetfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式字号。 |
791| double [OH_Drawing_TypographyTextlineStyleGetHeightScale](#oh_drawing_typographytextlinestylegetheightscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式的行高缩放系数。 |
792| bool [OH_Drawing_TypographyTextlineStyleGetHeightOnly](#oh_drawing_typographytextlinestylegetheightonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取字体渲染过程中计算字体块高度相关参数的方法。 |
793| bool [OH_Drawing_TypographyTextlineStyleGetHalfLeading](#oh_drawing_typographytextlinestylegethalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式是否为一半行间距。 |
794| double [OH_Drawing_TypographyTextlineStyleGetSpacingScale](#oh_drawing_typographytextlinestylegetspacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式间距比例。 |
795| bool [OH_Drawing_TypographyTextlineGetStyleOnly](#oh_drawing_typographytextlinegetstyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版是否仅启用行样式。 |
796| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyGetTextAlign](#oh_drawing_typographygettextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本对齐方式。 |
797| [OH_Drawing_TextDirection](#oh_drawing_textdirection) [OH_Drawing_TypographyGetTextDirection](#oh_drawing_typographygettextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取指定排版样式中的文本方向。 |
798| size_t [OH_Drawing_TypographyGetTextMaxLines](#oh_drawing_typographygettextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本的最大行数。 |
799| char \* [OH_Drawing_TypographyGetTextEllipsis](#oh_drawing_typographygettextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取指定排版样式设置的省略号文本。 |
800| void [OH_Drawing_TypographyDestroyEllipsis](#oh_drawing_typographydestroyellipsis) (char \*ellipsis) | 释放省略号名称列表占用的内存。 |
801| 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)没有被纳入比较。 |
802| uint32_t [OH_Drawing_TextStyleGetColor](#oh_drawing_textstylegetcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本颜色。 |
803| [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) [OH_Drawing_TextStyleGetDecorationStyle](#oh_drawing_textstylegetdecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本装饰样式。 |
804| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TextStyleGetFontWeight](#oh_drawing_textstylegetfontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式字重。 |
805| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TextStyleGetFontStyle](#oh_drawing_textstylegetfontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式的字体样式。 |
806| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) [OH_Drawing_TextStyleGetBaseline](#oh_drawing_textstylegetbaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式的字体基线位置。 |
807| char \*\* [OH_Drawing_TextStyleGetFontFamilies](#oh_drawing_textstylegetfontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, size_t \*num) | 获取字体类型名称列表。 |
808| void [OH_Drawing_TextStyleDestroyFontFamilies](#oh_drawing_textstyledestroyfontfamilies) (char \*\*fontFamilies, size_t num) | 释放长度为num的字体家族名称列表占用的内存。|
809| double [OH_Drawing_TextStyleGetFontSize](#oh_drawing_textstylegetfontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式字号。 |
810| double [OH_Drawing_TextStyleGetLetterSpacing](#oh_drawing_textstylegetletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式的字符间距。 |
811| double [OH_Drawing_TextStyleGetWordSpacing](#oh_drawing_textstylegetwordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式的单词间距。 |
812| double [OH_Drawing_TextStyleGetFontHeight](#oh_drawing_textstylegetfontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式行高缩放系数。 |
813| bool [OH_Drawing_TextStyleGetHalfLeading](#oh_drawing_textstylegethalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取指定文本样式一半行间距设置开启状态。 |
814| const char \* [OH_Drawing_TextStyleGetLocale](#oh_drawing_textstylegetlocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取语言环境。 |
815| void [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | 释放文本框占用的内存。 |
816| 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) | 设置字体阴影对象的参数。 |
817| [OH_Drawing_LineTypography](#oh_drawing_linetypography) \* [OH_Drawing_CreateLineTypography](#oh_drawing_createlinetypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*handler) | 创建一个排版行对象[OH_Drawing_LineTypography](#oh_drawing_linetypography)的指针,排版行对象保存着文本内容以及样式的载体, 可以用于计算单行排版信息。 |
818| void [OH_Drawing_DestroyLineTypography](#oh_drawing_destroylinetypography) ([OH_Drawing_LineTypography](#oh_drawing_linetypography) \*lineTypography) | 释放排版行对象[OH_Drawing_LineTypography](#oh_drawing_linetypography)占用的内存。 |
819| size_t [OH_Drawing_LineTypographyGetLineBreak](#oh_drawing_linetypographygetlinebreak) ([OH_Drawing_LineTypography](#oh_drawing_linetypography) \*lineTypography, size_t startIndex, double width) | 计算在限定排版宽度的情况下,从指定位置处开始可以排版的字符个数。 |
820| OH_Drawing_TextLine \* [OH_Drawing_LineTypographyCreateLine](#oh_drawing_linetypographycreateline) ([OH_Drawing_LineTypography](#oh_drawing_linetypography) \*lineTypography, size_t startIndex, size_t count) | 根据指定区间文本内容创建一个指向文本行对象**OH_Drawing_TextLine**的指针。 |
821| [OH_Drawing_TextTab](#oh_drawing_texttab) \* [OH_Drawing_CreateTextTab](#oh_drawing_createtexttab) ([OH_Drawing_TextAlign](#oh_drawing_textalign) alignment, float location) | 创建文本制表符对象。 |
822| void [OH_Drawing_DestroyTextTab](#oh_drawing_destroytexttab) ([OH_Drawing_TextTab](#oh_drawing_texttab) \*) | 释放文本制表符对象占据的内存。 |
823| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_GetTextTabAlignment](#oh_drawing_gettexttabalignment) ([OH_Drawing_TextTab](#oh_drawing_texttab) \*) | 获取文本制表符对象的对齐方式。 |
824| float [OH_Drawing_GetTextTabLocation](#oh_drawing_gettexttablocation) ([OH_Drawing_TextTab](#oh_drawing_texttab) \*) | 获取文本制表符的位置。 |
825| void [OH_Drawing_SetTypographyTextTab](#oh_drawing_settypographytexttab) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextTab](#oh_drawing_texttab) \*TextTab) | 设置文本制表符对齐方式及位置。当设置了文本对齐方式或者省略号风格时制表符不生效,当制表符位置小于1.0时为替换成空格的效果。 |
826| size_t [OH_Drawing_GetDrawingArraySize](#oh_drawing_getdrawingarraysize) ([OH_Drawing_Array](#oh_drawing_array) \*drawingArray) | 获取传入类型为对象数组[OH_Drawing_Array](#oh_drawing_array)中的对象个数。 |
827| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateDefault](#oh_drawing_typefacecreatedefault) (void) | 用于创建一个默认的字形对象。 |
828| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile) (const char \*path, int index) | 通过文件创建一个字形对象。 |
829| [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)相同的功能。 |
830| [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) | 通过已存在的字体对象创建带有字型参数的字体对象。 |
831| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromStream](#oh_drawing_typefacecreatefromstream) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*, int32_t index) | 通过内存流创建一个字形对象。如果内存流是无效的字体文件,返回空指针。 内存流传入后,所有权转移,开发者不能再释放它。 |
832| void [OH_Drawing_TypefaceDestroy](#oh_drawing_typefacedestroy) ([OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于销毁字形对象并回收该对象占有的内存。 |
833| [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \* [OH_Drawing_FontArgumentsCreate](#oh_drawing_fontargumentscreate) (void) | 用于创建一个字型参数对象。字型参数用于创建带有自定义属性的字体对象。 |
834| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsAddVariation](#oh_drawing_fontargumentsaddvariation) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments, const char \*axis, float value) | 给字型参数对象添加可变维度。 |
835| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsDestroy](#oh_drawing_fontargumentsdestroy) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | 用于销毁一个字型参数对象。 |
836| enum&nbsp;&nbsp;[OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | 阴影标志枚举。 |
837| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | 阴影标志枚举。 |
838| 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) | 用于裁剪一个矩形。 |
839| 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) | 用于裁剪一个圆角矩形。 |
840| 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) | 用于裁剪一个自定义路径。 |
841| [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) | 用于裁剪一个区域。 |
842| void [OH_Drawing_CanvasRotate](#oh_drawing_canvasrotate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float degrees, float px, float py) | 用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。 |
843| void [OH_Drawing_CanvasTranslate](#oh_drawing_canvastranslate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float dx, float dy) | 用于平移画布一段距离。 |
844| void [OH_Drawing_CanvasScale](#oh_drawing_canvasscale) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | 用于画布缩放。 |
845| 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\|。 |
846| void [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | 用于使用指定颜色去清空画布。 |
847| int32_t [OH_Drawing_CanvasGetWidth](#oh_drawing_canvasgetwidth) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 获取画布宽度。 |
848| int32_t [OH_Drawing_CanvasGetHeight](#oh_drawing_canvasgetheight) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 获取画布高度。 |
849| void [OH_Drawing_CanvasGetLocalClipBounds](#oh_drawing_canvasgetlocalclipbounds) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取画布裁剪区域的边界。该接口不可用于录制类型画布。 |
850| void [OH_Drawing_CanvasGetTotalMatrix](#oh_drawing_canvasgettotalmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 获取画布3x3矩阵。 |
851| void [OH_Drawing_CanvasConcatMatrix](#oh_drawing_canvasconcatmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 画布现有矩阵左乘以传入矩阵,不影响该接口之前的绘制操作。 |
852| 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) | 绘制射灯类型阴影,使用路径描述环境光阴影的轮廓。 |
853| [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) | 用于绘制录制指令对象。 |
854
855## 类型定义说明
856
857### OH_Drawing_PathDashStyle
858
859```
860typedef enum OH_Drawing_PathDashStyle OH_Drawing_PathDashStyle
861```
862
863**描述**
864
865路径效果的绘制样式枚举。
866
867**起始版本:** 18
868
869### OH_Drawing_Array
870
871```
872typedef struct OH_Drawing_Array OH_Drawing_Array
873```
874
875**描述**
876
877定义数组对象, 用于存储多个同类型对象。
878
879**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
880
881**起始版本:** 14
882
883### OH_Drawing_LineTypography
884
885```
886typedef struct OH_Drawing_LineTypography OH_Drawing_LineTypography
887```
888
889**描述**
890
891用于从一段文字中提取单行数据进行排版。
892
893**起始版本:** 18
894
895### OH_Drawing_TextTab
896
897```
898typedef struct OH_Drawing_TextTab OH_Drawing_TextTab
899```
900
901**描述**
902
903用于管理文本制表符。
904
905**起始版本:** 18
906
907### OH_Drawing_TextLine
908
909```
910typedef struct OH_Drawing_TextLine OH_Drawing_TextLine
911```
912
913**描述**
914
915用于管理文本行。
916
917**起始版本:** 18
918
919### OH_Drawing_Run
920
921```
922typedef struct OH_Drawing_RunOH_Drawing_Run
923```
924
925**描述**
926
927用于管理文本渲染单元。
928
929**起始版本:** 18
930
931### Drawing_CaretOffsetsCallback
932
933```
934typedef bool(* Drawing_CaretOffsetsCallback) (double offset, int32_t index, bool leadingEdge)
935```
936
937**描述**
938
939用户自定义的回调函数。将文本行对象中每个字符的偏移量、索引值作为参数传递给用户自定义的回调函数。
940
941**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
942
943**起始版本:** 18
944
945**参数:**
946
947| 名称 | 描述 |
948| -------- | -------- |
949| offset | 文本行对象中每个字符的偏移量。 |
950| index | 文本行对象中每个字符的索引值。 |
951| leadingEdge | 光标是否位于字符的前缘,true表示位于字符前缘,即偏移量不包含该字符宽度,false表示位于字符后缘,即偏移量包含该字符宽度。 |
952
953**返回:**
954
955表示是否停止调用该回调函数,true表示停止调用该回调函数,false表示继续调用该回调函数。
956
957### OH_Drawing_String
958
959```
960typedef struct OH_Drawing_String OH_Drawing_String
961```
962
963**描述**
964
965采用UTF-16编码的字符串信息结构体。
966
967**起始版本:** 14
968
969
970### OH_Drawing_SystemFontType
971
972```
973typedef enum OH_Drawing_SystemFontType OH_Drawing_SystemFontType
974```
975
976**描述**
977
978字体类型的枚举。
979
980**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
981
982**起始版本:** 14
983
984
985### OH_Drawing_FontArguments
986
987```
988typedef struct OH_Drawing_FontArguments OH_Drawing_FontArguments
989```
990
991**描述**
992
993用于描述字型参数。
994
995**起始版本:** 13
996
997### OH_Drawing_RecordCmd
998
999```
1000typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd
1001```
1002
1003**描述**
1004
1005定义录制指令类, 用于存储录制指令的集合。
1006
1007**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1008
1009**起始版本:** 13
1010
1011
1012### OH_Drawing_RecordCmdUtils
1013
1014```
1015typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils
1016```
1017
1018**描述**
1019
1020定义指令录制工具,用于生成录制指令。
1021
1022**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1023
1024**起始版本:** 13
1025
1026
1027### OH_Drawing_ErrorCode
1028
1029```
1030typedef enum OH_Drawing_ErrorCode OH_Drawing_ErrorCode
1031```
1032
1033
1034**描述**
1035
1036枚举本模块可能产生的错误码。
1037
1038**起始版本:** 12
1039
1040
1041### OH_Drawing_PathOpMode
1042
1043```
1044typedef enum OH_Drawing_PathOpMode OH_Drawing_PathOpMode
1045```
1046
1047**描述**
1048
1049路径操作类型枚举。
1050
1051**起始版本:** 12
1052
1053
1054### OH_Drawing_PathMeasureMatrixFlags
1055
1056```
1057typedef enum OH_Drawing_PathMeasureMatrixFlags OH_Drawing_PathMeasureMatrixFlags
1058```
1059
1060**描述**
1061
1062路径测量获取相应矩阵信息维度枚举。
1063
1064**起始版本:** 12
1065
1066
1067### OH_Drawing_RegionOpMode
1068
1069```
1070typedef enum OH_Drawing_RegionOpMode OH_Drawing_RegionOpMode
1071```
1072
1073**描述**
1074
1075区域操作类型枚举。
1076
1077**起始版本:** 12
1078
1079
1080### OH_Drawing_ImageFilter
1081
1082```
1083typedef struct OH_Drawing_ImageFilter OH_Drawing_ImageFilter
1084```
1085
1086**描述**
1087
1088定义图像滤波器, 用于对构成图像像素的所有颜色位进行操作。
1089
1090**起始版本:** 12
1091
1092
1093### OH_Drawing_Filter
1094
1095```
1096typedef struct OH_Drawing_Filter OH_Drawing_Filter
1097```
1098
1099**描述**
1100
1101定义一个滤波器,用于存储颜色滤波器,蒙版滤波器和图像滤波器。
1102
1103**起始版本:** 11
1104
1105### OH_Drawing_AlphaFormat
1106
1107```
1108typedef enum OH_Drawing_AlphaFormat OH_Drawing_AlphaFormat
1109```
1110
1111**描述**
1112
1113用于描述位图像素的透明度分量。
1114
1115**起始版本:** 8
1116
1117
1118### OH_Drawing_Bitmap
1119
1120```
1121typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap
1122```
1123
1124**描述**
1125
1126定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。
1127
1128**起始版本:** 8
1129
1130
1131### OH_Drawing_BitmapFormat
1132
1133```
1134typedef struct OH_Drawing_BitmapFormat OH_Drawing_BitmapFormat
1135```
1136
1137**描述**
1138
1139结构体用于描述位图像素的格式,包括颜色类型和透明度类型。
1140
1141**起始版本:** 8
1142
1143
1144### OH_Drawing_BlendMode
1145
1146```
1147typedef enum OH_Drawing_BlendMode OH_Drawing_BlendMode
1148```
1149
1150**描述**
1151
1152混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在红、绿、蓝3个颜色通道上是相同的(透明度有另外的处理规则)。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。
1153
1154为简洁起见,我们使用以下缩写:
1155
1156s : source,源的缩写。
1157
1158d : destination,目标的缩写。
1159
1160sa : source alpha,源透明度的缩写。
1161
1162da : destination alpha,目标透明度的缩写。
1163
1164计算结果用如下缩写表示:
1165
1166r : 如果4个通道的计算方式相同,用r表示。
1167
1168ra : 如果只操作透明度通道,用ra表示。
1169
1170rc : 如果操作3个颜色通道,用rc表示。
1171
1172**起始版本:** 11
1173
1174
1175### OH_Drawing_BlurType
1176
1177```
1178typedef enum OH_Drawing_BlurType OH_Drawing_BlurType
1179```
1180
1181**描述**
1182
1183蒙版滤波器模糊操作类型的枚举。
1184
1185**起始版本:** 11
1186
1187
1188### OH_Drawing_BreakStrategy
1189
1190```
1191typedef enum OH_Drawing_BreakStrategy OH_Drawing_BreakStrategy
1192```
1193
1194**描述**
1195
1196文本的中断策略枚举。
1197
1198**起始版本:** 11
1199
1200
1201### OH_Drawing_Brush
1202
1203```
1204typedef struct OH_Drawing_Brush OH_Drawing_Brush
1205```
1206
1207**描述**
1208
1209定义为画刷,画刷用于描述填充图形的样式和颜色。
1210
1211**起始版本:** 8
1212
1213
1214### OH_Drawing_Canvas
1215
1216```
1217typedef struct OH_Drawing_Canvas OH_Drawing_Canvas
1218```
1219
1220**描述**
1221
1222定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。
1223
1224**起始版本:** 8
1225
1226
1227### OH_Drawing_CanvasClipOp
1228
1229```
1230typedef enum OH_Drawing_CanvasClipOp OH_Drawing_CanvasClipOp
1231```
1232
1233**描述**
1234
1235画布裁剪方式的枚举集合。
1236
1237**起始版本:** 11
1238
1239
1240### OH_Drawing_CanvasShadowFlags
1241
1242```
1243typedef enum OH_Drawing_CanvasShadowFlags OH_Drawing_CanvasShadowFlags
1244```
1245
1246**描述**
1247
1248阴影标志枚举。
1249
1250**起始版本:** 12
1251
1252
1253### OH_Drawing_ColorFilter
1254
1255```
1256typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter
1257```
1258
1259**描述**
1260
1261定义颜色滤波器,传入一个颜色并返回一个新的颜色。
1262
1263**起始版本:** 11
1264
1265
1266### OH_Drawing_ColorFormat
1267
1268```
1269typedef enum OH_Drawing_ColorFormat OH_Drawing_ColorFormat
1270```
1271
1272**描述**
1273
1274用于描述位图像素的存储格式。
1275
1276**起始版本:** 8
1277
1278
1279### OH_Drawing_ColorSpace
1280
1281```
1282typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace
1283```
1284
1285**描述**
1286
1287定义色彩空间,用于解释颜色信息。
1288
1289**起始版本:** 12
1290
1291
1292### OH_Drawing_Corner_Radii
1293
1294```
1295typedef OH_Drawing_Point2D OH_Drawing_Corner_Radii
1296```
1297
1298**描述**
1299
1300定义一个圆角半径,该圆角半径由x轴方向和y轴方向上的半径组成。
1301
1302**起始版本:** 12
1303
1304
1305### OH_Drawing_CornerPos
1306
1307```
1308typedef enum OH_Drawing_CornerPos OH_Drawing_CornerPos
1309```
1310
1311**描述**
1312
1313用于描述圆角位置的枚举。
1314
1315**起始版本:** 12
1316
1317
1318### OH_Drawing_EllipsisModal
1319
1320```
1321typedef enum OH_Drawing_EllipsisModal OH_Drawing_EllipsisModal
1322```
1323
1324**描述**
1325
1326省略号样式枚举。
1327
1328**起始版本:** 11
1329
1330
1331### OH_Drawing_FilterMode
1332
1333```
1334typedef enum OH_Drawing_FilterMode OH_Drawing_FilterMode
1335```
1336
1337**描述**
1338
1339过滤模式枚举。
1340
1341**起始版本:** 12
1342
1343
1344### OH_Drawing_Font
1345
1346```
1347typedef struct OH_Drawing_Font OH_Drawing_Font
1348```
1349
1350**描述**
1351
1352用于描述字体。
1353
1354**起始版本:** 11
1355
1356
1357### OH_Drawing_Font_Metrics
1358
1359```
1360typedef struct OH_Drawing_Font_Metrics OH_Drawing_Font_Metrics
1361```
1362
1363**描述**
1364
1365定义字体度量信息的结构体。
1366
1367**起始版本:** 12
1368
1369
1370### OH_Drawing_FontAdjustInfo
1371
1372```
1373typedef struct OH_Drawing_FontAdjustInfo OH_Drawing_FontAdjustInfo
1374```
1375
1376**描述**
1377
1378字重映射信息结构体。
1379
1380**起始版本:** 12
1381
1382
1383### OH_Drawing_FontAliasInfo
1384
1385```
1386typedef struct OH_Drawing_FontAliasInfo OH_Drawing_FontAliasInfo
1387```
1388
1389**描述**
1390
1391别名字体信息结构体。
1392
1393**起始版本:** 12
1394
1395
1396### OH_Drawing_FontCollection
1397
1398```
1399typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection
1400```
1401
1402**描述**
1403
1404用于加载字体。
1405
1406**起始版本:** 8
1407
1408
1409### OH_Drawing_FontConfigInfo
1410
1411```
1412typedef struct OH_Drawing_FontConfigInfo OH_Drawing_FontConfigInfo
1413```
1414
1415**描述**
1416
1417系统字体配置信息结构体。
1418
1419**起始版本:** 12
1420
1421
1422### OH_Drawing_FontDescriptor
1423
1424```
1425typedef struct OH_Drawing_FontDescriptor OH_Drawing_FontDescriptor
1426```
1427
1428**描述**
1429
1430描述系统字体详细信息的结构体。
1431
1432**起始版本:** 12
1433
1434
1435### OH_Drawing_FontEdging
1436
1437```
1438typedef enum OH_Drawing_FontEdging OH_Drawing_FontEdging
1439```
1440
1441**描述**
1442
1443字型边缘效果类型枚举。
1444
1445**起始版本:** 12
1446
1447
1448### OH_Drawing_FontFallbackGroup
1449
1450```
1451typedef struct OH_Drawing_FontFallbackGroup OH_Drawing_FontFallbackGroup
1452```
1453
1454**描述**
1455
1456备用字体集信息结构体。
1457
1458**起始版本:** 12
1459
1460
1461### OH_Drawing_FontFallbackInfo
1462
1463```
1464typedef struct OH_Drawing_FontFallbackInfo OH_Drawing_FontFallbackInfo
1465```
1466
1467**描述**
1468
1469备用字体信息结构体。
1470
1471**起始版本:** 12
1472
1473
1474### OH_Drawing_FontGenericInfo
1475
1476```
1477typedef struct OH_Drawing_FontGenericInfo OH_Drawing_FontGenericInfo
1478```
1479
1480**描述**
1481
1482系统所支持的通用字体集信息结构体。
1483
1484**起始版本:** 12
1485
1486
1487### OH_Drawing_FontHinting
1488
1489```
1490typedef enum OH_Drawing_FontHinting OH_Drawing_FontHinting
1491```
1492
1493**描述**
1494
1495字型轮廓效果类型枚举。
1496
1497**起始版本:** 12
1498
1499
1500### OH_Drawing_FontMgr
1501
1502```
1503typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr
1504```
1505
1506**描述**
1507
1508定义字体管理类, 用于字体管理。
1509
1510**起始版本:** 12
1511
1512
1513### OH_Drawing_FontParser
1514
1515```
1516typedef struct OH_Drawing_FontParser OH_Drawing_FontParser
1517```
1518
1519**描述**
1520
1521用来解析系统字体文件。
1522
1523**起始版本:** 12
1524
1525
1526### OH_Drawing_FontStyleSet
1527
1528```
1529typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet
1530```
1531
1532**描述**
1533
1534定义字体样式集, 用于字体样式族匹配。
1535
1536**起始版本:** 12
1537
1538
1539### OH_Drawing_FontStyleStruct
1540
1541```
1542typedef struct OH_Drawing_FontStyleStruct OH_Drawing_FontStyleStruct
1543```
1544
1545**描述**
1546
1547定义字体样式信息的结构体。
1548
1549**起始版本:** 12
1550
1551
1552### OH_Drawing_GpuContext
1553
1554```
1555typedef struct OH_Drawing_GpuContext OH_Drawing_GpuContext
1556```
1557
1558**描述**
1559
1560定义图形处理器上下文,用于描述图形处理器后端上下文。
1561
1562**起始版本:** 12
1563
1564
1565### OH_Drawing_GpuContextOptions
1566
1567```
1568typedef struct OH_Drawing_GpuContextOptions OH_Drawing_GpuContextOptions
1569```
1570
1571**描述**
1572
1573定义有关图形处理器上下文的选项。
1574
1575**起始版本:** 12
1576
1577**废弃:** 从API version 18开始废弃。
1578
1579### OH_Drawing_Image
1580
1581```
1582typedef struct OH_Drawing_Image OH_Drawing_Image
1583```
1584
1585**描述**
1586
1587定义一个用于描述绘制二维像素数组的图片。
1588
1589**起始版本:** 12
1590
1591
1592### OH_Drawing_Image_Info
1593
1594```
1595typedef struct OH_Drawing_Image_Info OH_Drawing_Image_Info
1596```
1597
1598**描述**
1599
1600定义图片信息结构体。
1601
1602**起始版本:** 12
1603
1604
1605### OH_Drawing_LineMetrics
1606
1607```
1608typedef struct OH_Drawing_LineMetrics OH_Drawing_LineMetrics
1609```
1610
1611**描述**
1612
1613文字行位置信息。
1614
1615**起始版本:** 12
1616
1617
1618### OH_Drawing_MaskFilter
1619
1620```
1621typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter
1622```
1623
1624**描述**
1625
1626定义蒙版滤波器。
1627
1628**起始版本:** 11
1629
1630
1631### OH_Drawing_Matrix
1632
1633```
1634typedef struct OH_Drawing_Matrix OH_Drawing_Matrix
1635```
1636
1637**描述**
1638
1639定义一个矩阵,用于描述坐标变换。
1640
1641**起始版本:** 11
1642
1643
1644### OH_Drawing_MemoryStream
1645
1646```
1647typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream
1648```
1649
1650**描述**
1651
1652用于描述内存流。
1653
1654**起始版本:** 12
1655
1656
1657### OH_Drawing_MipmapMode
1658
1659```
1660typedef enum OH_Drawing_MipmapMode OH_Drawing_MipmapMode
1661```
1662
1663**描述**
1664
1665多级渐远纹理模式枚举。
1666
1667**起始版本:** 12
1668
1669
1670### OH_Drawing_Path
1671
1672```
1673typedef struct OH_Drawing_Path OH_Drawing_Path
1674```
1675
1676**描述**
1677
1678定义为路径,路径用于自定义各种形状。
1679
1680**起始版本:** 8
1681
1682
1683### OH_Drawing_PathAddMode
1684
1685```
1686typedef enum OH_Drawing_PathAddMode OH_Drawing_PathAddMode
1687```
1688
1689**描述**
1690
1691用于指定路径添加模式的枚举类型。
1692
1693**起始版本:** 12
1694
1695
1696### OH_Drawing_PathDirection
1697
1698```
1699typedef enum OH_Drawing_PathDirection OH_Drawing_PathDirection
1700```
1701
1702**描述**
1703
1704添加闭合轮廓方向枚举。
1705
1706**起始版本:** 12
1707
1708
1709### OH_Drawing_PathEffect
1710
1711```
1712typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect
1713```
1714
1715**描述**
1716
1717定义一个路径效果,用于影响描边路径。
1718
1719**起始版本:** 12
1720
1721
1722### OH_Drawing_PathFillType
1723
1724```
1725typedef enum OH_Drawing_PathFillType OH_Drawing_PathFillType
1726```
1727
1728**描述**
1729
1730定义路径的填充类型枚举。
1731
1732**起始版本:** 12
1733
1734
1735### OH_Drawing_Pen
1736
1737```
1738typedef struct OH_Drawing_Pen OH_Drawing_Pen
1739```
1740
1741**描述**
1742
1743定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。
1744
1745**起始版本:** 8
1746
1747
1748### OH_Drawing_PenLineCapStyle
1749
1750```
1751typedef enum OH_Drawing_PenLineCapStyle OH_Drawing_PenLineCapStyle
1752```
1753
1754**描述**
1755
1756枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。
1757
1758**起始版本:** 8
1759
1760
1761### OH_Drawing_PenLineJoinStyle
1762
1763```
1764typedef enum OH_Drawing_PenLineJoinStyle OH_Drawing_PenLineJoinStyle
1765```
1766
1767**描述**
1768
1769枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。
1770
1771**起始版本:** 8
1772
1773
1774### OH_Drawing_PixelMap
1775
1776```
1777typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap
1778```
1779
1780**描述**
1781
1782定义像素图,用于包装图像框架支持的真实像素图。
1783
1784**起始版本:** 12
1785
1786
1787### OH_Drawing_PlaceholderSpan
1788
1789```
1790typedef struct OH_Drawing_PlaceholderSpan OH_Drawing_PlaceholderSpan
1791```
1792
1793**描述**
1794
1795用于描述占位符跨度的结构体。
1796
1797**起始版本:** 11
1798
1799
1800### OH_Drawing_PlaceholderVerticalAlignment
1801
1802```
1803typedef enum OH_Drawing_PlaceholderVerticalAlignment OH_Drawing_PlaceholderVerticalAlignment
1804```
1805
1806**描述**
1807
1808占位符垂直对齐枚举。
1809
1810**起始版本:** 11
1811
1812
1813### OH_Drawing_Point
1814
1815```
1816typedef struct OH_Drawing_Point OH_Drawing_Point
1817```
1818
1819**描述**
1820
1821定义一个点,用于描述坐标点。
1822
1823**起始版本:** 11
1824
1825
1826### OH_Drawing_Point2D
1827
1828```
1829typedef struct OH_Drawing_Point2D OH_Drawing_Point2D
1830```
1831
1832**描述**
1833
1834定义一个二维的坐标点。
1835
1836**起始版本:** 12
1837
1838
1839### OH_Drawing_Point3D
1840
1841```
1842typedef struct OH_Drawing_Point3D OH_Drawing_Point3D
1843```
1844
1845**描述**
1846
1847定义一个三维的坐标点。
1848
1849**起始版本:** 12
1850
1851
1852### OH_Drawing_PointMode
1853
1854```
1855typedef enum OH_Drawing_PointMode OH_Drawing_PointMode
1856```
1857
1858**描述**
1859
1860绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。
1861
1862**起始版本:** 12
1863
1864
1865### OH_Drawing_PositionAndAffinity
1866
1867```
1868typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity
1869```
1870
1871**描述**
1872
1873用于接收字体的位置和亲和性。
1874
1875**起始版本:** 11
1876
1877
1878### OH_Drawing_Range
1879
1880```
1881typedef struct OH_Drawing_Range OH_Drawing_Range
1882```
1883
1884**描述**
1885
1886用于接收字体的起始位置和结束位置。
1887
1888**起始版本:** 11
1889
1890
1891### OH_Drawing_Rect
1892
1893```
1894typedef struct OH_Drawing_Rect OH_Drawing_Rect
1895```
1896
1897**描述**
1898
1899用于描述矩形。
1900
1901**起始版本:** 11
1902
1903
1904### OH_Drawing_RectHeightStyle
1905
1906```
1907typedef enum OH_Drawing_RectHeightStyle OH_Drawing_RectHeightStyle
1908```
1909
1910**描述**
1911
1912矩形框高度样式枚举。
1913
1914**起始版本:** 11
1915
1916
1917### OH_Drawing_RectStyle_Info
1918
1919```
1920typedef struct OH_Drawing_RectStyle_Info OH_Drawing_RectStyle_Info
1921```
1922
1923**描述**
1924
1925定义矩形框样式结构体。
1926
1927**起始版本:** 12
1928
1929
1930### OH_Drawing_RectWidthStyle
1931
1932```
1933typedef enum OH_Drawing_RectWidthStyle OH_Drawing_RectWidthStyle
1934```
1935
1936**描述**
1937
1938矩形框宽度样式枚举。
1939
1940**起始版本:** 11
1941
1942
1943### OH_Drawing_Region
1944
1945```
1946typedef struct OH_Drawing_Region OH_Drawing_Region
1947```
1948
1949**描述**
1950
1951定义一个区域,用于表示画布上的封闭区域,实现更精确的图形控制。
1952
1953**起始版本:** 12
1954
1955
1956### OH_Drawing_RoundRect
1957
1958```
1959typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect
1960```
1961
1962**描述**
1963
1964用于描述圆角矩形。
1965
1966**起始版本:** 11
1967
1968
1969### OH_Drawing_RunBuffer
1970
1971```
1972typedef struct OH_Drawing_RunBuffer OH_Drawing_RunBuffer
1973```
1974
1975**描述**
1976
1977结构体用于描述一块内存,描述文字和位置信息。
1978
1979**起始版本:** 11
1980
1981
1982### OH_Drawing_SamplingOptions
1983
1984```
1985typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions
1986```
1987
1988**描述**
1989
1990定义一个采样选项,用于描述图片、位图等图像的采样方法。
1991
1992**起始版本:** 12
1993
1994
1995### OH_Drawing_ScaleToFit
1996
1997```
1998typedef enum OH_Drawing_ScaleToFit OH_Drawing_ScaleToFit
1999```
2000
2001**描述**
2002
2003矩阵缩放方式枚举。
2004
2005**起始版本:** 12
2006
2007
2008### OH_Drawing_ShaderEffect
2009
2010```
2011typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect
2012```
2013
2014**描述**
2015
2016定义一个着色器,用于描述绘制内容的源颜色。
2017
2018**起始版本:** 11
2019
2020
2021### OH_Drawing_ShadowLayer
2022
2023```
2024typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer
2025```
2026
2027**描述**
2028
2029定义一个阴影层,用于描述绘制内容的阴影层。
2030
2031**起始版本:** 12
2032
2033
2034### OH_Drawing_SrcRectConstraint
2035
2036```
2037typedef enum OH_Drawing_SrcRectConstraint OH_Drawing_SrcRectConstraint
2038```
2039
2040**描述**
2041
2042源矩形区域约束类型枚举。
2043
2044**起始版本:** 12
2045
2046
2047### OH_Drawing_StrutStyle
2048
2049```
2050typedef struct OH_Drawing_StrutStyle OH_Drawing_StrutStyle
2051```
2052
2053**描述**
2054
2055用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。
2056
2057**起始版本:** 12
2058
2059
2060### OH_Drawing_Surface
2061
2062```
2063typedef struct OH_Drawing_Surface OH_Drawing_Surface
2064```
2065
2066**描述**
2067
2068定义surface,用于管理画布绘制的内容。
2069
2070**起始版本:** 12
2071
2072
2073### OH_Drawing_TextBlob
2074
2075```
2076typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob
2077```
2078
2079**描述**
2080
2081定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。
2082
2083**起始版本:** 11
2084
2085
2086### OH_Drawing_TextBlobBuilder
2087
2088```
2089typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder
2090```
2091
2092**描述**
2093
2094定义文本构建器,用于构建文本。
2095
2096**起始版本:** 11
2097
2098
2099### OH_Drawing_TextBox
2100
2101```
2102typedef struct OH_Drawing_TextBox OH_Drawing_TextBox
2103```
2104
2105**描述**
2106
2107用于接收文本框的矩形大小、方向和数量大小。
2108
2109**起始版本:** 11
2110
2111
2112### OH_Drawing_TextDecorationStyle
2113
2114```
2115typedef enum OH_Drawing_TextDecorationStyle OH_Drawing_TextDecorationStyle
2116```
2117
2118**描述**
2119
2120文本装饰样式枚举。
2121
2122**起始版本:** 11
2123
2124
2125### OH_Drawing_TextEncoding
2126
2127```
2128typedef enum OH_Drawing_TextEncoding OH_Drawing_TextEncoding
2129```
2130
2131**描述**
2132
2133文本编码类型枚举。
2134
2135**起始版本:** 12
2136
2137
2138### OH_Drawing_TextShadow
2139
2140```
2141typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow
2142```
2143
2144**描述**
2145
2146用于管理文本阴影。
2147
2148**起始版本:** 12
2149
2150
2151### OH_Drawing_TextStyle
2152
2153```
2154typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle
2155```
2156
2157**描述**
2158
2159用于管理字体颜色、装饰等。
2160
2161**起始版本:** 8
2162
2163
2164### OH_Drawing_TileMode
2165
2166```
2167typedef enum OH_Drawing_TileMode OH_Drawing_TileMode
2168```
2169
2170**描述**
2171
2172着色器效果平铺模式的枚举。
2173
2174**起始版本:** 11
2175
2176
2177### OH_Drawing_Typeface
2178
2179```
2180typedef struct OH_Drawing_Typeface OH_Drawing_Typeface
2181```
2182
2183**描述**
2184
2185用于描述字形。
2186
2187**起始版本:** 11
2188
2189
2190### OH_Drawing_Typography
2191
2192```
2193typedef struct OH_Drawing_Typography OH_Drawing_Typography
2194```
2195
2196**描述**
2197
2198用于管理排版的布局和显示等。
2199
2200**起始版本:** 8
2201
2202
2203### OH_Drawing_TypographyCreate
2204
2205```
2206typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate
2207```
2208
2209**描述**
2210
2211用于创建[OH_Drawing_Typography](#oh_drawing_typography)。
2212
2213**起始版本:** 8
2214
2215
2216### OH_Drawing_TypographyStyle
2217
2218```
2219typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle
2220```
2221
2222**描述**
2223
2224用于管理排版风格,如文字方向等。
2225
2226**起始版本:** 8
2227
2228
2229### OH_Drawing_VertexMode
2230
2231```
2232typedef enum OH_Drawing_VertexMode OH_Drawing_VertexMode
2233```
2234
2235**描述**
2236
2237用于指定如何解释给定顶点的几何形状的枚举类型。
2238
2239**起始版本:** 12
2240
2241
2242### OH_Drawing_WordBreakType
2243
2244```
2245typedef enum OH_Drawing_WordBreakType OH_Drawing_WordBreakType
2246```
2247
2248**描述**
2249
2250单词的断词方式枚举。
2251
2252**起始版本:** 11
2253
2254
2255## 枚举类型说明
2256
2257### OH_Drawing_PathDashStyle
2258
2259```
2260enum OH_Drawing_PathDashStyle
2261```
2262
2263**描述**
2264
2265路径效果的绘制样式枚举。
2266
2267**起始版本:** 18
2268
2269| 枚举值 | 描述 |
2270| -------- | -------- |
2271| DRAWING_PATH_DASH_STYLE_TRANSLATE  | 表示路径效果是平移效果。|
2272| DRAWING_PATH_DASH_STYLE_ROTATE  | 表示路径效果是旋转效果。|
2273| DRAWING_PATH_DASH_STYLE_MORPH  | 表示路径效果是变形效果。|
2274
2275### OH_Drawing_SystemFontType
2276
2277```
2278enum OH_Drawing_SystemFontType
2279```
2280
2281**描述**
2282
2283字体类型的枚举。
2284
2285**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2286
2287**起始版本:** 14
2288
2289| 枚举值 | 描述 |
2290| -------- | -------- |
2291| ALL | 所有字体类型。 |
2292| GENERIC | 系统字体类型。 |
2293| STYLISH | 风格字体类型。 |
2294| INSTALLED | 用户已安装字体类型。 |
2295| CUSTOMIZED<sup>18+</sup> | 自定义字体类型。 |
2296
2297### OH_Drawing_ErrorCode
2298
2299```
2300enum OH_Drawing_ErrorCode
2301```
2302
2303**描述**
2304
2305枚举本模块可能产生的错误码。
2306
2307**起始版本:** 12
2308
2309| 枚举值 | 描述 |
2310| -------- | -------- |
2311| OH_DRAWING_SUCCESS | 操作成功完成。 |
2312| OH_DRAWING_ERROR_NO_PERMISSION | 权限校验失败。 |
2313| OH_DRAWING_ERROR_INVALID_PARAMETER | 无效的输入参数,如参数中传入了NULL。 |
2314| OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE | 输入参数不在有效的范围内。 |
2315| OH_DRAWING_ERROR_ALLOCATION_FAILED<sup>13+</sup> | 内存分配失败。 |
2316
2317### OH_Drawing_PathMeasureMatrixFlags
2318
2319```
2320enum OH_Drawing_PathMeasureMatrixFlags
2321```
2322
2323**描述**
2324
2325路径测量获取相应矩阵信息维度枚举。
2326
2327**起始版本:** 12
2328
2329| 枚举值 | 描述 |
2330| -------- | -------- |
2331| GET_POSITION_MATRIX | 获取位置信息对应的矩阵。 |
2332| GET_TANGENT_MATRIX | 获取切线信息对应的矩阵。 |
2333| GET_POSITION_AND_TANGENT_MATRIX | 获取位置和切线信息对应的矩阵。 |
2334
2335
2336### OH_Drawing_PathOpMode
2337
2338```
2339enum OH_Drawing_PathOpMode
2340```
2341
2342**描述**
2343
2344路径操作类型枚举。
2345
2346**起始版本:** 12
2347
2348| 枚举值 | 描述 |
2349| -------- | -------- |
2350| PATH_OP_MODE_DIFFERENCE | 差集操作。 |
2351| PATH_OP_MODE_INTERSECT | 交集操作。 |
2352| PATH_OP_MODE_UNION | 并集操作。 |
2353| PATH_OP_MODE_XOR | 异或操作。 |
2354| PATH_OP_MODE_REVERSE_DIFFERENCE | 反向差集操作。 |
2355
2356
2357### OH_Drawing_RegionOpMode
2358
2359```
2360enum OH_Drawing_RegionOpMode
2361```
2362
2363**描述**
2364
2365区域操作类型枚举。
2366
2367**起始版本:** 12
2368
2369| 枚举值 | 描述 |
2370| -------- | -------- |
2371| REGION_OP_MODE_DIFFERENCE | 差集操作。 |
2372| REGION_OP_MODE_INTERSECT | 交集操作。 |
2373| REGION_OP_MODE_UNION | 并集操作。 |
2374| REGION_OP_MODE_XOR | 异或操作。 |
2375| REGION_OP_MODE_REVERSE_DIFFERENCE | 反向差集操作。 |
2376| REGION_OP_MODE_REPLACE | 替换操作。 |
2377
2378
2379### OH_Drawing_AlphaFormat
2380
2381```
2382enum OH_Drawing_AlphaFormat
2383```
2384
2385**描述**
2386
2387用于描述位图像素的透明度分量。
2388
2389**起始版本:** 8
2390
2391| 枚举值 | 描述 |
2392| -------- | -------- |
2393| ALPHA_FORMAT_UNKNOWN | 未知格式。 |
2394| ALPHA_FORMAT_OPAQUE | 位图无透明度。 |
2395| ALPHA_FORMAT_PREMUL | 每个像素的颜色组件由透明度分量预先乘以。 |
2396| ALPHA_FORMAT_UNPREMUL | 每个像素的颜色组件未由透明度分量预先乘以。 |
2397
2398
2399### OH_Drawing_BlendMode
2400
2401```
2402enum OH_Drawing_BlendMode
2403```
2404
2405**描述**
2406
2407混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在红、绿、蓝3个颜色通道上是相同的(透明度有另外的处理规则)。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。
2408
2409为简洁起见,我们使用以下缩写:
2410
2411s : source,源的缩写。
2412
2413d : destination,目标的缩写。
2414
2415sa : source alpha,源透明度的缩写。
2416
2417da : destination alpha,目标透明度的缩写。
2418
2419计算结果用如下缩写表示:
2420
2421r : 如果4个通道的计算方式相同,用r表示。
2422
2423ra : 如果只操作透明度通道,用ra表示。
2424
2425rc : 如果操作3个颜色通道,用rc表示。
2426
2427**起始版本:** 11
2428
2429| 枚举值 | 描述 |
2430| -------- | -------- |
2431| BLEND_MODE_CLEAR | 清除模式,r = 0. |
2432| BLEND_MODE_SRC | r = s(result的4个通道,都等于source的4个通道,即结果等于源。) |
2433| BLEND_MODE_DST | r = d(result的4个通道,都等于destination的4个通道,即结果等于目标。) |
2434| BLEND_MODE_SRC_OVER | r = s + (1 - sa) \* d. |
2435| BLEND_MODE_DST_OVER | r = d + (1 - da) \* s. |
2436| BLEND_MODE_SRC_IN | r = s \* da. |
2437| BLEND_MODE_DST_IN | r = d \* sa. |
2438| BLEND_MODE_SRC_OUT | r = s \* (1 - da). |
2439| BLEND_MODE_DST_OUT | r = d \* (1 - sa). |
2440| BLEND_MODE_SRC_ATOP | r = s \* da + d \* (1 - sa). |
2441| BLEND_MODE_DST_ATOP | r = d \* sa + s \* (1 - da). |
2442| BLEND_MODE_XOR | r = s \* (1 - da) + d \* (1 - sa). |
2443| BLEND_MODE_PLUS | r = min(s + d, 1). |
2444| BLEND_MODE_MODULATE | r = s \* d. |
2445| BLEND_MODE_SCREEN | 滤色模式,r = s + d - s \* d. |
2446| BLEND_MODE_OVERLAY | 叠加模式。 |
2447| BLEND_MODE_DARKEN | 变暗模式,rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d. |
2448| BLEND_MODE_LIGHTEN | 变亮模式,rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d. |
2449| BLEND_MODE_COLOR_DODGE | 颜色减淡模式。 |
2450| BLEND_MODE_COLOR_BURN | 颜色加深模式。 |
2451| BLEND_MODE_HARD_LIGHT | 强光模式。 |
2452| BLEND_MODE_SOFT_LIGHT | 柔光模式。 |
2453| BLEND_MODE_DIFFERENCE | 差值模式,rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d. |
2454| BLEND_MODE_EXCLUSION | 排除模式,rc = s + d - two(s \* d), ra = s + (1 - sa) \* d. |
2455| BLEND_MODE_MULTIPLY | 正片叠底,r = s \* (1 - da) + d \* (1 - sa) + s \* d. |
2456| BLEND_MODE_HUE | 色相模式。 |
2457| BLEND_MODE_SATURATION | 饱和度模式。 |
2458| BLEND_MODE_COLOR | 颜色模式。 |
2459| BLEND_MODE_LUMINOSITY | 亮度模式。 |
2460
2461
2462### OH_Drawing_BlurType
2463
2464```
2465enum OH_Drawing_BlurType
2466```
2467
2468**描述**
2469
2470蒙版滤波器模糊操作类型的枚举。
2471
2472**起始版本:** 11
2473
2474| 枚举值 | 描述 |
2475| -------- | -------- |
2476| NORMAL | 内外模糊。 |
2477| SOLID | 内部实体,外部模糊。 |
2478| OUTER | 内部空白,外部模糊。 |
2479| INNER | 内部模糊,外部空白。 |
2480
2481
2482### OH_Drawing_BreakStrategy
2483
2484```
2485enum OH_Drawing_BreakStrategy
2486```
2487
2488**描述**
2489
2490文本的中断策略枚举。
2491
2492**起始版本:** 11
2493
2494| 枚举值 | 描述 |
2495| -------- | -------- |
2496| BREAK_STRATEGY_GREEDY | 贪心策略,换行时尽可能填满每一行。 |
2497| BREAK_STRATEGY_HIGH_QUALITY | 高质量策略,换行时优先考虑文本的连续性。 |
2498| BREAK_STRATEGY_BALANCED | 平衡策略,换行时在单词边界换行。 |
2499
2500
2501### OH_Drawing_CanvasClipOp
2502
2503```
2504enum OH_Drawing_CanvasClipOp
2505```
2506
2507**描述**
2508
2509画布裁剪方式的枚举集合。
2510
2511**起始版本:** 11
2512
2513| 枚举值 | 描述 |
2514| -------- | -------- |
2515| DIFFERENCE | 将指定区域裁剪(取差集)。 |
2516| INTERSECT | 将指定区域保留(取交集)。 |
2517
2518
2519### OH_Drawing_CanvasShadowFlags
2520
2521```
2522enum OH_Drawing_CanvasShadowFlags
2523```
2524
2525**描述**
2526
2527阴影标志枚举。
2528
2529**起始版本:** 12
2530
2531| 枚举值 | 描述 |
2532| -------- | -------- |
2533| SHADOW_FLAGS_NONE | 无阴影标志。 |
2534| SHADOW_FLAGS_TRANSPARENT_OCCLUDER | 遮挡物对象不透明标志。 |
2535| SHADOW_FLAGS_GEOMETRIC_ONLY | 不分析阴影标志。 |
2536| SHADOW_FLAGS_ALL | 使能以上所有阴影标志。 |
2537
2538
2539### OH_Drawing_ColorFormat
2540
2541```
2542enum OH_Drawing_ColorFormat
2543```
2544
2545**描述**
2546
2547用于描述位图像素的存储格式。
2548
2549**起始版本:** 8
2550
2551| 枚举值 | 描述 |
2552| -------- | -------- |
2553| COLOR_FORMAT_UNKNOWN | 未知格式。 |
2554| COLOR_FORMAT_ALPHA_8 | 每个像素用一个8位的量表示,8个位比特位表示透明度。 |
2555| COLOR_FORMAT_RGB_565 | 每个像素用一个16位的量表示,高位到低位依次是5个比特位表示红,6个比特位表示绿,5个比特位表示蓝。 |
2556| COLOR_FORMAT_ARGB_4444 | 每个像素用一个16位的量表示,高位到低位依次是4个比特位表示透明度,4个比特位表示红,4个比特位表示绿,4个比特位表示蓝。 |
2557| COLOR_FORMAT_RGBA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示透明度,8个比特位表示红,8个比特位表示绿,8个比特位表示蓝。 |
2558| COLOR_FORMAT_BGRA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示蓝,8个比特位表示绿,8个比特位表示红,8个比特位表示透明度。 |
2559
2560
2561### OH_Drawing_CornerPos
2562
2563```
2564enum OH_Drawing_CornerPos
2565```
2566
2567**描述**
2568
2569用于描述圆角位置的枚举。
2570
2571**起始版本:** 12
2572
2573| 枚举值 | 描述 |
2574| -------- | -------- |
2575| CORNER_POS_TOP_LEFT | 左上角圆角位置。 |
2576| CORNER_POS_TOP_RIGHT | 右上角圆角位置。 |
2577| CORNER_POS_BOTTOM_RIGHT | 右下角圆角位置。 |
2578| CORNER_POS_BOTTOM_LEFT | 左下角圆角位置。 |
2579
2580
2581### OH_Drawing_EllipsisModal
2582
2583```
2584enum OH_Drawing_EllipsisModal
2585```
2586
2587**描述**
2588
2589省略号样式枚举。
2590
2591**起始版本:** 11
2592
2593| 枚举值 | 描述 |
2594| -------- | -------- |
2595| ELLIPSIS_MODAL_HEAD | 头部模式,即省略号放在文本头部。 |
2596| ELLIPSIS_MODAL_MIDDLE | 中部模式,即省略号放在文本中部。 |
2597| ELLIPSIS_MODAL_TAIL | 尾部模式,即省略号放在文本尾部。 |
2598
2599
2600### OH_Drawing_FilterMode
2601
2602```
2603enum OH_Drawing_FilterMode
2604```
2605
2606**描述**
2607
2608过滤模式枚举。
2609
2610**起始版本:** 12
2611
2612| 枚举值 | 描述 |
2613| -------- | -------- |
2614| FILTER_MODE_NEAREST | 邻近过滤模式。 |
2615| FILTER_MODE_LINEAR | 线性过滤模式。 |
2616
2617
2618### OH_Drawing_FontConfigInfoErrorCode
2619
2620```
2621enum OH_Drawing_FontConfigInfoErrorCode
2622```
2623
2624**描述**
2625
2626获取系统字体配置信息列表结果枚举。
2627
2628**起始版本:** 12
2629
2630| 枚举值 | 描述 |
2631| -------- | -------- |
2632| SUCCESS_FONT_CONFIG_INFO | 获取系统字体配置信息列表成功。 |
2633| ERROR_FONT_CONFIG_INFO_UNKNOWN | 未知错误。 |
2634| ERROR_FONT_CONFIG_INFO_PARSE_FILE | 解析系统配置文件失败。 |
2635| ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY | 申请内存失败。 |
2636| ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA | 拷贝字符串数据失败。 |
2637
2638
2639### OH_Drawing_FontEdging
2640
2641```
2642enum OH_Drawing_FontEdging
2643```
2644
2645**描述**
2646
2647字型边缘效果类型枚举。
2648
2649**起始版本:** 12
2650
2651| 枚举值 | 描述 |
2652| -------- | -------- |
2653| FONT_EDGING_ALIAS | 无抗锯齿处理。 |
2654| FONT_EDGING_ANTI_ALIAS | 使用抗锯齿来平滑字型边缘。 |
2655| FONT_EDGING_SUBPIXEL_ANTI_ALIAS | 使用次像素级别的抗锯齿来平滑字型边缘,可以获得更加平滑的字形渲染效果。 |
2656
2657
2658### OH_Drawing_FontHinting
2659
2660```
2661enum OH_Drawing_FontHinting
2662```
2663
2664**描述**
2665
2666字型轮廓效果类型枚举。
2667
2668**起始版本:** 12
2669
2670| 枚举值 | 描述 |
2671| -------- | -------- |
2672| FONT_HINTING_NONE | 不修改字型轮廓。 |
2673| FONT_HINTING_SLIGHT | 最小限度修改字型轮廓以改善对比度。 |
2674| FONT_HINTING_NORMAL | 修改字型轮廓以提高对比度。 |
2675| FONT_HINTING_FULL | 修改字型轮廓以获得最大对比度。 |
2676
2677
2678### OH_Drawing_FontStyle
2679
2680```
2681enum OH_Drawing_FontStyle
2682```
2683
2684**描述**
2685
2686区分字体是否为斜体。
2687
2688| 枚举值 | 描述 |
2689| -------- | -------- |
2690| FONT_STYLE_NORMAL | 非斜体。 |
2691| FONT_STYLE_ITALIC | 斜体。 |
2692| FONT_STYLE_OBLIQUE<sup>12+</sup> | 倾斜字体。 |
2693
2694
2695### OH_Drawing_FontWeight
2696
2697```
2698enum OH_Drawing_FontWeight
2699```
2700
2701**描述**
2702
2703字重。
2704
2705| 枚举值 | 描述 |
2706| -------- | -------- |
2707| FONT_WEIGHT_100 | 字重为thin |
2708| FONT_WEIGHT_200 | 字重为extra-light |
2709| FONT_WEIGHT_300 | 字重为light |
2710| FONT_WEIGHT_400 | 字重为normal/regular |
2711| FONT_WEIGHT_500 | 字重为medium |
2712| FONT_WEIGHT_600 | 字重为semi-bold |
2713| FONT_WEIGHT_700 | 字重为bold |
2714| FONT_WEIGHT_800 | 字重为extra-bold |
2715| FONT_WEIGHT_900 | 字重为black |
2716
2717
2718### OH_Drawing_FontWidth
2719
2720```
2721enum OH_Drawing_FontWidth
2722```
2723
2724**描述**
2725
2726字体宽度的枚举。
2727
2728**起始版本:** 12
2729
2730| 枚举值 | 描述 |
2731| -------- | -------- |
2732| 1 | 表示超窄的字宽。 |
2733| 2 | 表示特窄的字宽。 |
2734| 3 | 表示窄的字宽。 |
2735| 4 | 表示半窄的字宽。 |
2736| 5 | 表示常规的字宽。 |
2737| 6 | 表示半宽的字宽。 |
2738| 7 | 表示宽的字宽。 |
2739| 8 | 表示特宽的字宽。 |
2740| 9 | 表示超宽的字宽。 |
2741
2742### OH_Drawing_MipmapMode
2743
2744```
2745enum OH_Drawing_MipmapMode
2746```
2747
2748**描述**
2749
2750多级渐远纹理模式枚举。
2751
2752**起始版本:** 12
2753
2754| 枚举值 | 描述 |
2755| -------- | -------- |
2756| MIPMAP_MODE_NONE | 忽略多级渐远纹理级别。 |
2757| MIPMAP_MODE_NEAREST | 邻近多级渐远级别采样。 |
2758| MIPMAP_MODE_LINEAR | 两个邻近多级渐远纹理之间,线性插值采样。 |
2759
2760
2761### OH_Drawing_PathAddMode
2762
2763```
2764enum OH_Drawing_PathAddMode
2765```
2766
2767**描述**
2768
2769用于指定路径添加模式的枚举类型。
2770
2771**起始版本:** 12
2772
2773| 枚举值 | 描述 |
2774| -------- | -------- |
2775| PATH_ADD_MODE_APPEND | 以追加的方式添加路径。 |
2776| PATH_ADD_MODE_EXTEND | 如果之前的路径未闭合,则添加直线闭合路径。 |
2777
2778
2779### OH_Drawing_PathDirection
2780
2781```
2782enum OH_Drawing_PathDirection
2783```
2784
2785**描述**
2786
2787添加闭合轮廓方向枚举。
2788
2789**起始版本:** 12
2790
2791| 枚举值 | 描述 |
2792| -------- | -------- |
2793| PATH_DIRECTION_CW | 顺时针方向添加闭合轮廓。 |
2794| PATH_DIRECTION_CCW | 逆时针方向添加闭合轮廓。 |
2795
2796
2797### OH_Drawing_PathFillType
2798
2799```
2800enum OH_Drawing_PathFillType
2801```
2802
2803**描述**
2804
2805定义路径的填充类型枚举。
2806
2807**起始版本:** 12
2808
2809| 枚举值 | 描述 |
2810| -------- | -------- |
2811| PATH_FILL_TYPE_WINDING | 绘制区域中的任意一点,向任意方向射出一条射线,对于射线和路径的所有交点,初始计数为0,遇到每个顺时针的交点(路径从射线的左边向右穿过),计数加1,遇到每个逆时针的交点(路径从射线的右边向左穿过),计数减1,若最终的计数结果为0,则认为这个点在路径内部,需要被涂色;若计数为0则不被涂色。 |
2812| PATH_FILL_TYPE_EVEN_ODD | 绘制区域中的任意一点,向任意方向射出一条射线,若这条射线和路径相交的次数是奇数,则这个点被认为在路径内部,需要被涂色;若是偶数则不被涂色。 |
2813| PATH_FILL_TYPE_INVERSE_WINDING | PATH_FILL_TYPE_WINDING 涂色规则取反。 |
2814| PATH_FILL_TYPE_INVERSE_EVEN_ODD | PATH_FILL_TYPE_EVEN_ODD 涂色规则取反。 |
2815
2816
2817### OH_Drawing_PenLineCapStyle
2818
2819```
2820enum OH_Drawing_PenLineCapStyle
2821```
2822
2823**描述**
2824
2825枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。
2826
2827**起始版本:** 8
2828
2829| 枚举值 | 描述 |
2830| -------- | -------- |
2831| LINE_FLAT_CAP | 没有笔帽样式,线条头尾端点处横切。 |
2832| LINE_SQUARE_CAP | 笔帽的样式为方框,线条的头尾端点处多出一个方框,方框宽度和线段一样宽,高度时线段厚度的一半。 |
2833| LINE_ROUND_CAP | 笔帽的样式为圆弧,线条的头尾端点处多出一个半圆弧,半圆的直径与线段厚度一致。 |
2834
2835
2836### OH_Drawing_PenLineJoinStyle
2837
2838```
2839enum OH_Drawing_PenLineJoinStyle
2840```
2841
2842**描述**
2843
2844枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。
2845
2846**起始版本:** 8
2847
2848| 枚举值 | 描述 |
2849| -------- | -------- |
2850| LINE_MITER_JOIN | 转角类型为尖角,如果折线角度比较小,则尖角会很长,需要使用限制值(miter limit)进行限制。 |
2851| LINE_ROUND_JOIN | 转角类型为圆头。 |
2852| LINE_BEVEL_JOIN | 转角类型为平头。 |
2853
2854
2855### OH_Drawing_PlaceholderVerticalAlignment
2856
2857```
2858enum OH_Drawing_PlaceholderVerticalAlignment
2859```
2860
2861**描述**
2862
2863占位符垂直对齐枚举。
2864
2865**起始版本:** 11
2866
2867| 枚举值 | 描述 |
2868| -------- | -------- |
2869| ALIGNMENT_OFFSET_AT_BASELINE | 偏移于基线对齐。 |
2870| ALIGNMENT_ABOVE_BASELINE | 高于基线对齐。 |
2871| ALIGNMENT_BELOW_BASELINE | 低于基线对齐。 |
2872| ALIGNMENT_TOP_OF_ROW_BOX | 行框顶部对齐。 |
2873| ALIGNMENT_BOTTOM_OF_ROW_BOX | 行框底部对齐。 |
2874| ALIGNMENT_CENTER_OF_ROW_BOX | 行框中心对齐。 |
2875
2876
2877### OH_Drawing_PointMode
2878
2879```
2880enum OH_Drawing_PointMode
2881```
2882
2883**描述**
2884
2885绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。
2886
2887**起始版本:** 12
2888
2889| 枚举值 | 描述 |
2890| -------- | -------- |
2891| POINT_MODE_POINTS | 分别绘制每个点。 |
2892| POINT_MODE_LINES | 将每两个点绘制为线段。 |
2893| POINT_MODE_POLYGON | 将点阵列绘制为开放多边形。 |
2894
2895
2896### OH_Drawing_RectHeightStyle
2897
2898```
2899enum OH_Drawing_RectHeightStyle
2900```
2901
2902**描述**
2903
2904矩形框高度样式枚举。
2905
2906**起始版本:** 11
2907
2908| 枚举值 | 描述 |
2909| -------- | -------- |
2910| RECT_HEIGHT_STYLE_TIGHT | 紧密样式。 |
2911| RECT_HEIGHT_STYLE_MAX | 最大样式。 |
2912| RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE | 包含行间距中间样式。 |
2913| RECT_HEIGHT_STYLE_INCLUDELINESPACETOP | 包含行间距顶部样式。 |
2914| RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM | 包含行间距底部样式。 |
2915| RECT_HEIGHT_STYLE_STRUCT | 结构样式。 |
2916
2917
2918### OH_Drawing_RectWidthStyle
2919
2920```
2921enum OH_Drawing_RectWidthStyle
2922```
2923
2924**描述**
2925
2926矩形框宽度样式枚举。
2927
2928**起始版本:** 11
2929
2930| 枚举值 | 描述 |
2931| -------- | -------- |
2932| RECT_WIDTH_STYLE_TIGHT | 紧密样式。 |
2933| RECT_WIDTH_STYLE_MAX | 最大样式。 |
2934
2935
2936### OH_Drawing_ScaleToFit
2937
2938```
2939enum OH_Drawing_ScaleToFit
2940```
2941
2942**描述**
2943
2944矩阵缩放方式枚举。
2945
2946**起始版本:** 12
2947
2948| 枚举值 | 描述 |
2949| -------- | -------- |
2950| SCALE_TO_FIT_FILL | 按水平轴和垂直轴缩放以填充目标矩形。 |
2951| SCALE_TO_FIT_START | 缩放并对齐到左侧和顶部。 |
2952| SCALE_TO_FIT_CENTER | 缩放并居中对齐。 |
2953| SCALE_TO_FIT_END | 缩放并向右和向下对齐。 |
2954
2955
2956### OH_Drawing_SrcRectConstraint
2957
2958```
2959enum OH_Drawing_SrcRectConstraint
2960```
2961
2962**描述**
2963
2964源矩形区域约束类型枚举。
2965
2966**起始版本:** 12
2967
2968| 枚举值 | 描述 |
2969| -------- | -------- |
2970| STRICT_SRC_RECT_CONSTRAINT | 严格约束,源矩形区域必须完全包含在图像中。 |
2971| FAST_SRC_RECT_CONSTRAINT | 快速约束,源矩形区域可以部分位于图像之外。 |
2972
2973
2974### OH_Drawing_TextAlign
2975
2976```
2977enum OH_Drawing_TextAlign
2978```
2979
2980**描述**
2981
2982文字对齐方式。
2983
2984| 枚举值 | 描述 |
2985| -------- | -------- |
2986| TEXT_ALIGN_LEFT | 左对齐。 |
2987| TEXT_ALIGN_RIGHT | 右对齐。 |
2988| TEXT_ALIGN_CENTER | 居中对齐。 |
2989| TEXT_ALIGN_JUSTIFY | 两端对齐,即紧靠左和右边缘,中间单词空隙由空格填充,最后一行除外。 |
2990| 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相同。 |
2991| 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相同。 |
2992
2993
2994### OH_Drawing_TextBaseline
2995
2996```
2997enum OH_Drawing_TextBaseline
2998```
2999
3000**描述**
3001
3002基线位置。
3003
3004| 枚举值 | 描述 |
3005| -------- | -------- |
3006| TEXT_BASELINE_ALPHABETIC | 用于表音文字,基线在中间偏下的位置。 |
3007| TEXT_BASELINE_IDEOGRAPHIC | 用于表意文字,基线位于底部。 |
3008
3009
3010### OH_Drawing_TextDecoration
3011
3012```
3013enum OH_Drawing_TextDecoration
3014```
3015
3016**描述**
3017
3018文本装饰。
3019
3020| 枚举值 | 描述 |
3021| -------- | -------- |
3022| TEXT_DECORATION_NONE | 无装饰。 |
3023| TEXT_DECORATION_UNDERLINE | 下划线。 |
3024| TEXT_DECORATION_OVERLINE | 上划线。 |
3025| TEXT_DECORATION_LINE_THROUGH | 删除线。 |
3026
3027
3028### OH_Drawing_TextDecorationStyle
3029
3030```
3031enum OH_Drawing_TextDecorationStyle
3032```
3033
3034**描述**
3035
3036文本装饰样式枚举。
3037
3038**起始版本:** 11
3039
3040| 枚举值 | 描述 |
3041| -------- | -------- |
3042| TEXT_DECORATION_STYLE_SOLID | 实心样式。 |
3043| TEXT_DECORATION_STYLE_DOUBLE | 双重样式。 |
3044| TEXT_DECORATION_STYLE_DOTTED | 圆点样式。 |
3045| TEXT_DECORATION_STYLE_DASHED | 虚线样式。 |
3046| TEXT_DECORATION_STYLE_WAVY | 波浪样式。 |
3047
3048
3049### OH_Drawing_TextDirection
3050
3051```
3052enum OH_Drawing_TextDirection
3053```
3054
3055**描述**
3056
3057文字方向。
3058
3059| 枚举值 | 描述 |
3060| -------- | -------- |
3061| TEXT_DIRECTION_RTL | 方向:从右到左。 |
3062| TEXT_DIRECTION_LTR | 方向:从左到右。 |
3063
3064
3065### OH_Drawing_TextEncoding
3066
3067```
3068enum OH_Drawing_TextEncoding
3069```
3070
3071**描述**
3072
3073文本编码类型枚举。
3074
3075**起始版本:** 12
3076
3077| 枚举值 | 描述 |
3078| -------- | -------- |
3079| TEXT_ENCODING_UTF8 | 单字节,表示UTF-8或ASCII。 |
3080| TEXT_ENCODING_UTF16 | 双字节,表示大部分Unicode。 |
3081| TEXT_ENCODING_UTF32 | 四字节,表示所有Unicode。 |
3082| TEXT_ENCODING_GLYPH_ID | 双字节,表示字形索引。 |
3083
3084
3085### OH_Drawing_TextHeightBehavior
3086
3087```
3088enum OH_Drawing_TextHeightBehavior
3089```
3090
3091**描述**
3092
3093文本高度修饰符模式枚举。
3094
3095**起始版本:** 12
3096
3097| 枚举值 | 描述 |
3098| -------- | -------- |
3099| TEXT_HEIGHT_ALL | 段落中第一行顶部和段落中最后一行底部[OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight)设置的高度生效。 |
3100| TEXT_HEIGHT_DISABLE_FIRST_ASCENT | 禁止段落中第一行顶部[OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight)设置的高度生效。 |
3101| TEXT_HEIGHT_DISABLE_LAST_ASCENT | 禁止段落中最后一行底部[OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight)设置的高度生效。 |
3102| TEXT_HEIGHT_DISABLE_ALL | 禁止段落中第一行顶部和段落中最后一行底部[OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight)设置的高度生效。 |
3103
3104
3105### OH_Drawing_TextStyleType
3106
3107```
3108enum OH_Drawing_TextStyleType
3109```
3110
3111**描述**
3112
3113文本样式类型枚举。
3114
3115**起始版本:** 12
3116
3117| 枚举值 | 描述 |
3118| -------- | -------- |
3119| TEXT_STYLE_NONE | 无文本样式。 |
3120| TEXT_STYLE_ALL_ATTRIBUTES | 所有文本样式。 |
3121| TEXT_STYLE_FONT | 字体样式。 |
3122| TEXT_STYLE_FOREGROUND | 文本前景样式。 |
3123| TEXT_STYLE_BACKGROUND | 文本背景样式。 |
3124| TEXT_STYLE_SHADOW | 文本阴影样式。 |
3125| TEXT_STYLE_DECORATIONS | 文本装饰样式。 |
3126| TEXT_STYLE_LETTER_SPACING | 文本字符间距样式。 |
3127| TEXT_STYLE_WORD_SPACING | 文本单词间距样式。 |
3128
3129
3130### OH_Drawing_TileMode
3131
3132```
3133enum OH_Drawing_TileMode
3134```
3135
3136**描述**
3137
3138着色器效果平铺模式的枚举。
3139
3140**起始版本:** 11
3141
3142| 枚举值 | 描述 |
3143| -------- | -------- |
3144| CLAMP | 如果着色器效果超出其原始边界,则复制边缘颜色。 |
3145| REPEAT | 在水平和垂直方向上重复着色器效果图像。 |
3146| MIRROR | 水平和垂直重复着色器效果图像,交替镜像。 |
3147| DECAL | 只在原始区域内绘制,其他地方返回透明黑色。 |
3148
3149
3150### OH_Drawing_VertexMode
3151
3152```
3153enum OH_Drawing_VertexMode
3154```
3155
3156**描述**
3157
3158用于指定如何解释给定顶点的几何形状的枚举类型。
3159
3160**起始版本:** 12
3161
3162| 枚举值 | 描述 |
3163| -------- | -------- |
3164| VERTEX_MODE_TRIANGLES | 每三个顶点表示一个三角形,如果顶点数不是3的倍数,则多余的顶点会被忽略。 |
3165| VERTEX_MODE_TRIANGLESSTRIP | 相邻三个顶点表示一个三角形,每个新的顶点将与前两个顶点组成一个新的三角形。 |
3166| VERTEX_MODE_TRIANGLEFAN | 第一个顶点作为中心点,后续的每个顶点都与前一个顶点和中心点组成一个三角形。 |
3167
3168
3169### OH_Drawing_WordBreakType
3170
3171```
3172enum OH_Drawing_WordBreakType
3173```
3174
3175**描述**
3176
3177单词的断词方式枚举。
3178
3179**起始版本:** 11
3180
3181| 枚举值 | 描述 |
3182| -------- | -------- |
3183| WORD_BREAK_TYPE_NORMAL | 常规方式。 |
3184| WORD_BREAK_TYPE_BREAK_ALL | 全部中断方式。 |
3185| WORD_BREAK_TYPE_BREAK_WORD | 单词中断方式。 |
3186| WORD_BREAK_TYPE_BREAK_HYPHEN<sup>18+</sup>  | 每行末尾单词尝试通过连字符“-”进行断行,若无法添加连字符“-”,则跟WORD_BREAK_TYPE_BREAK_WORD保持一致。|
3187
3188
3189
3190## 函数说明
3191
3192### OH_Drawing_PathGetSegment()
3193
3194```
3195OH_Drawing_ErrorCode OH_Drawing_PathGetSegment (OH_Drawing_Path* path, bool forceClosed, float start, float stop, bool startWithMoveTo, OH_Drawing_Path* dst, bool* result)
3196```
3197
3198**描述**
3199
3200截取路径的片段并追加到目标路径上。
3201
3202**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3203
3204**起始版本:** 18
3205
3206**参数:**
3207
3208| 名称 | 描述 |
3209| -------- | -------- |
3210| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。  |
3211| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。  |
3212| start | 表示与路径起始点的距离,距离路径起始点start距离的位置即为截取路径片段的起始点,小于0时会被视作0,大于等于stop时会截取失败。  |
3213| stop | 表示与路径起始点的距离,距离路径起始点stop距离的位置即为截取路径片段的终点,小于等于start时会截取失败,大于路径长度时会被视作路径长度。  |
3214| startWithMoveTo | 表示是否在目标路径执行[OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto)移动到截取路径片段的起始点位置。true表示执行,false表示不执行。  |
3215| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,截取成功时会将得到的路径片段追加到目标路径上,截取失败时不做改变。  |
3216| result | 返回是否成功截取路径片段的结果。true表示截取成功,false表示截取失败。作为出参使用。  |
3217
3218**返回:**
3219
3220函数返回执行错误码。
3221
3222返回OH_DRAWING_SUCCESS,表示执行成功。
3223
3224返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数path、dst、result至少有一个为空指针。
3225
3226### OH_Drawing_CreateSumPathEffect()
3227
3228```
3229OH_Drawing_PathEffect* OH_Drawing_CreateSumPathEffect (OH_Drawing_PathEffect* firstPathEffect, OH_Drawing_PathEffect* secondPathEffect )
3230```
3231
3232**描述**
3233
3234创建一个使用两种路径效果分别生效后叠加的路径效果对象。
3235
3236**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3237
3238**起始版本:** 18
3239
3240**参数:**
3241
3242| 名称 | 描述 |
3243| -------- | -------- |
3244| firstPathEffect | 指向路径对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针。  |
3245| secondPathEffect | 指向路径对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针。  |
3246
3247**返回:**
3248
3249函数返回一个指针,指针指向创建的路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)。
3250
3251如果返回nullptr,则创建失败,失败的可能原因是firstPathEffect或者secondPathEffect为nullptr。
3252
3253### OH_Drawing_CreatePathDashEffect()
3254
3255```
3256OH_Drawing_PathEffect* OH_Drawing_CreatePathDashEffect (const OH_Drawing_Path* path, float advance, float phase, OH_Drawing_PathDashStyle type )
3257```
3258
3259**描述**
3260
3261创建一个虚线效果的路径效果对象。
3262
3263**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3264
3265**起始版本:** 18
3266
3267**参数:**
3268
3269| 名称 | 描述 |
3270| -------- | -------- |
3271| path | 表示虚线样式的路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。  |
3272| advance | 表示虚线段的步长。  |
3273| phase | 表示虚线段内图形在虚线步长范围内的偏移量。  |
3274| type | 表示虚线路径效果样式。  |
3275
3276**返回:**
3277
3278函数返回一个指针,指针指向创建的路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)。
3279
3280如果返回nullptr,则创建失败,失败的可能原因是path为nullptr或者advance小于等于0。
3281
3282### OH_Drawing_CreateDiscretePathEffect()
3283
3284```
3285OH_Drawing_PathEffect* OH_Drawing_CreateDiscretePathEffect (float segLength, float deviation )
3286```
3287
3288**描述**
3289
3290创建一种将路径打散并且在路径上产生不规则分布的路径效果对象。
3291
3292**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3293
3294**起始版本:** 18
3295
3296**参数:**
3297
3298| 名称 | 描述 |
3299| -------- | -------- |
3300| segLength | 表示路径中每进行一次打散操作的长度,该值大于0时有效果。  |
3301| deviation | 表示绘制时的末端点的最大移动偏离量。  |
3302
3303**返回:**
3304
3305函数返回一个指针,指针指向创建的路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)。
3306
3307
3308### OH_Drawing_CreateCornerPathEffect()
3309
3310```
3311OH_Drawing_PathEffect* OH_Drawing_CreateCornerPathEffect (float radius)
3312```
3313
3314**描述**
3315
3316创建一个将路径的夹角变成指定半径的圆角的路径效果对象。
3317
3318**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3319
3320**起始版本:** 18
3321
3322**参数:**
3323
3324| 名称 | 描述 |
3325| -------- | -------- |
3326| radius | 表示圆角的半径,该值必须大于0时才生效。  |
3327
3328**返回:**
3329
3330函数返回一个指针,指针指向创建的路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)。
3331
3332如果返回nullptr,则创建失败,失败的可能原因是radius小于等于0。
3333
3334
3335
3336### OH_Drawing_CreateComposePathEffect()
3337
3338```
3339OH_Drawing_PathEffect* OH_Drawing_CreateComposePathEffect (OH_Drawing_PathEffect* outer, OH_Drawing_PathEffect* inner )
3340```
3341
3342**描述**
3343
3344创建路径组合的路径效果对象。首先应用内部路径效果,然后应用外部路径效果。
3345
3346**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3347
3348**起始版本:** 18
3349
3350**参数:**
3351
3352| 名称 | 描述 |
3353| -------- | -------- |
3354| outer | 表示组合路径效果中外部路径效果[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针。  |
3355| inner | 表示组合路径效果中内部路径效果[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针。  |
3356
3357**返回:**
3358
3359函数返回一个指针,指针指向创建的路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)。
3360
3361如果返回nullptr,则创建失败,失败的原因可能是outer或者inner为nullptr。
3362
3363### OH_Drawing_GpuContextCreate()
3364
3365```
3366OH_Drawing_GpuContext* OH_Drawing_GpuContextCreate (void)
3367```
3368
3369**描述**
3370
3371用于创建一个图形处理器上下文对象, 使用的后端类型取决于运行设备。
3372
3373**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3374
3375**起始版本:** 16
3376
3377**返回:**
3378
3379返回一个指针,指针指向创建的图形处理器上下文对象[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。
3380
3381
3382### OH_Drawing_CanvasDrawArcWithCenter()
3383
3384```
3385OH_Drawing_ErrorCode OH_Drawing_CanvasDrawArcWithCenter (OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, float startAngle, float sweepAngle, bool useCenter )
3386```
3387
3388**描述**
3389
3390绘制一段圆弧。该方法允许指定圆弧的起始角度、扫描角度以及圆弧的起点和终点是否连接圆弧的中心点。
3391
3392**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3393
3394**起始版本:** 18
3395
3396**参数:**
3397
3398| 名称 | 描述 |
3399| -------- | -------- |
3400| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。  |
3401| rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。  |
3402| startAngle | 弧的起始角度,单位为度,该参数为浮点数。0度时起始点位于椭圆的右端点,为正数时以顺时针方向放置起始点,为负数时以逆时针方向放置起始点。  |
3403| sweepAngle | 弧的扫描角度,单位为度,该参数为浮点数。为正数时顺时针扫描,为负数时逆时针扫描。扫描角度可以超过360度,将绘制一个完整的椭圆。  |
3404| useCenter | 表示绘制时弧形的起点和终点是否连接弧形的中心点。true表示连接,false表示不连接。  |
3405
3406**返回:**
3407
3408函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者rect为空。
3409
3410### OH_Drawing_CanvasDrawNestedRoundRect()
3411
3412```
3413OH_Drawing_ErrorCode OH_Drawing_CanvasDrawNestedRoundRect (OH_Drawing_Canvas* canvas, const OH_Drawing_RoundRect* outer, const OH_Drawing_RoundRect* inner )
3414```
3415
3416**描述**
3417
3418绘制两个嵌套的圆角矩形,外部矩形边界必须包含内部矩形边界,否则无绘制效果。
3419
3420**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3421
3422**起始版本:** 18
3423
3424**参数:**
3425
3426| 名称 | 描述 |
3427| -------- | -------- |
3428| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。  |
3429| outer | 指向圆角矩形对象[OH_Drawing_RoundRect](#oh_drawing_roundrect)的指针,表示外部圆角矩形边界。  |
3430| inner | 指向圆角矩形对象[OH_Drawing_RoundRect](#oh_drawing_roundrect)的指针,表示内部圆角矩形边界。  |
3431
3432**返回:**
3433
3434函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas、outer或者inner为空。
3435
3436### OH_Drawing_CanvasQuickRejectPath()
3437
3438```
3439OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectPath (OH_Drawing_Canvas* canvas, const OH_Drawing_Path* path, bool* quickReject )
3440```
3441
3442**描述**
3443
3444
3445判断路径与画布区域是否不相交。画布区域包含边界。
3446
3447**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3448
3449**起始版本:** 18
3450
3451**参数:**
3452
3453| 名称 | 描述 |
3454| -------- | -------- |
3455| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。  |
3456| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。  |
3457| quickReject | 表示路径与画布区域是否不相交,true表示路径与画布区域不相交,false表示路径与画布区域相交。  |
3458
3459**返回:**
3460
3461函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas、path或者quickReject为空。
3462
3463### OH_Drawing_CanvasQuickRejectRect()
3464
3465```
3466OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectRect (OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, bool* quickReject )
3467```
3468
3469**描述**
3470
3471判断矩形和画布区域是否不相交。画布区域包含边界。
3472
3473**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3474
3475**起始版本:** 18
3476
3477**参数:**
3478
3479| 名称 | 描述 |
3480| -------- | -------- |
3481| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。  |
3482| rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。  |
3483| quickReject | 表示矩形与画布区域是否不相交,true表示矩形与画布区域不相交,false表示矩形与画布区域相交。  |
3484
3485**返回:**
3486
3487函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas、rect或者quickReject为空。
3488
3489### OH_Drawing_CanvasDrawPixelMapNine()
3490
3491```
3492OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPixelMapNine (OH_Drawing_Canvas* canvas, OH_Drawing_PixelMap* pixelMap, const OH_Drawing_Rect* center, const OH_Drawing_Rect* dst, OH_Drawing_FilterMode mode )
3493```
3494
3495**描述**
3496
3497通过绘制两条水平线和两条垂直线将像素图分割成9个部分:四个边,四个角和中心。 若角落的4个区域尺寸不超过目标矩形,则会在不缩放的情况下被绘制在目标矩形,反之则会按比例缩放绘制在目标矩形。 如果还有剩余空间,剩下的5个区域会通过拉伸或压缩来绘制,以便能够完全覆盖目标矩形。
3498
3499**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3500
3501**起始版本:** 18
3502
3503**参数:**
3504
3505| 名称 | 描述 |
3506| -------- | -------- |
3507| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。  |
3508| pixelMap | 指向像素图[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。  |
3509| center | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,表示分割像素图的中心矩形。矩形四条边所在的直线将像素图分成了9个部分。  |
3510| dst | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,表示画布上的目标区域。  |
3511| mode | 过滤模式枚举[OH_Drawing_FilterMode](#oh_drawing_filtermode-1)。  |
3512
3513**返回:**
3514
3515函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas、pixelMap或dst为空。
3516
3517### OH_Drawing_SurfaceCreateOnScreen()
3518
3519```
3520OH_Drawing_Surface* OH_Drawing_SurfaceCreateOnScreen (OH_Drawing_GpuContext* gpuContext, OH_Drawing_Image_Info imageInfo, void* window )
3521```
3522**描述**
3523
3524使用图形处理器上下文创建一个与屏幕窗口绑定的surface对象,用于管理画布绘制的内容。
3525
3526本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码的取值。 gpuContext或window为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
3527
3528**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3529
3530**起始版本:** 16
3531
3532**参数:**
3533
3534| 名称 | 描述 |
3535| -------- | -------- |
3536| gpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 该图形处理器上下文对象必须由[OH_Drawing_GpuContextCreate](#oh_drawing_gpucontextcreate)创建,否则surface对象会创建失败。  |
3537| imageInfo | 图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)结构体。  |
3538| window | 指向屏幕窗口对象的指针。  |
3539
3540**返回:**
3541
3542返回一个指针,指针指向创建的surface对象[OH_Drawing_Surface](#oh_drawing_surface)。
3543
3544### OH_Drawing_SurfaceFlush()
3545
3546```
3547OH_Drawing_ErrorCode OH_Drawing_SurfaceFlush (OH_Drawing_Surface* surface)
3548```
3549
3550**描述**
3551
3552将surface对象上的画布绘制内容提交给GPU处理,完成绘制内容上屏显示。
3553
3554**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3555
3556**起始版本:** 16
3557
3558**参数:**
3559
3560| 名称 | 描述 |
3561| -------- | -------- |
3562| surface | 指向创建的surface对象的指针[OH_Drawing_Surface](#oh_drawing_surface)。 该surface对象必须由[OH_Drawing_SurfaceCreateOnScreen](#oh_drawing_surfacecreateonscreen)创建,否则该接口调用将没有任何效果。  |
3563
3564**返回:**
3565
3566函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数surface为空。
3567
3568### OH_Drawing_ErrorCodeReset()
3569
3570```
3571void OH_Drawing_ErrorCodeReset (void )
3572```
3573
3574**描述**
3575
3576将本模块的错误码重置为OH_DRAWING_SUCCESS。
3577
3578通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)获取的本模块错误码会在不以错误码为返回值的接口执行失败时被置为对应的错误编号,但是不会在执行成功后被重置为OH_DRAWING_SUCCESS。
3579
3580调用本接口可将错误码重置为OH_DRAWING_SUCCESS,避免多个接口间互相干扰,方便开发者调试。
3581
3582**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3583
3584**起始版本:** 18
3585
3586### OH_Drawing_FontSetThemeFontFollowed()
3587
3588```
3589OH_Drawing_ErrorCode OH_Drawing_FontSetThemeFontFollowed (OH_Drawing_Font* font, bool followed )
3590```
3591
3592**描述**
3593
3594设置字型中的字体是否跟随主题字体。设置跟随主题字体后,若系统启用主题字体并且字型未被设置字体,字型会使用该主题字体。
3595
3596**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3597
3598**起始版本:** 15
3599
3600**参数:**
3601
3602| 名称 | 描述 |
3603| -------- | -------- |
3604| font | 指示字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
3605| followed | 字型中的字体是否跟随主题字体,true表示跟随主题字体,false表示不跟随主题字体。 |
3606
3607**返回:**
3608
3609函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font为空。
3610
3611### OH_Drawing_FontIsThemeFontFollowed()
3612
3613```
3614OH_Drawing_ErrorCode OH_Drawing_FontIsThemeFontFollowed (const OH_Drawing_Font* font, bool* followed )
3615```
3616
3617**描述**
3618
3619获取字型中的字体是否跟随主题字体。默认不跟随主题字体。
3620
3621**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3622
3623**起始版本:** 15
3624
3625**参数:**
3626
3627| 名称 | 描述 |
3628| -------- | -------- |
3629| font | 指示字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
3630| followed | 返回字型中的字体是否跟随主题字体的结果,true表示跟随主题字体,false表示不跟随主题字体。作为出参使用。 |
3631
3632**返回:**
3633
3634函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font或者followed其中一个为空。
3635
3636### OH_Drawing_GetFontCollectionGlobalInstance()
3637
3638```
3639OH_Drawing_FontCollection* OH_Drawing_GetFontCollectionGlobalInstance (void )
3640```
3641**描述**
3642
3643获取全局字体集对象OH_Drawing_FontCollection,可感知主题字信息,禁止释放该对象。
3644
3645**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3646
3647**起始版本:** 14
3648
3649**返回:**
3650
3651指向全局字体集对象的指针。
3652
3653### OH_Drawing_CreateLineTypography()
3654
3655```
3656OH_Drawing_LineTypography* OH_Drawing_CreateLineTypography (OH_Drawing_TypographyCreate* handler)
3657```
3658
3659**描述**
3660
3661创建一个排版行对象[OH_Drawing_LineTypography](#oh_drawing_linetypography)的指针,排版行对象保存着文本内容以及样式的载体, 可以用于计算单行排版信息。
3662
3663**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3664
3665**起始版本:** 18
3666
3667**参数:**
3668
3669| 名称 | 描述 |
3670| -------- | -------- |
3671| handler | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
3672
3673**返回:**
3674
3675返回一个指向排版行对象[OH_Drawing_LineTypography](#oh_drawing_linetypography)的指针。
3676
3677### OH_Drawing_DestroyLineTypography()
3678
3679```
3680void OH_Drawing_DestroyLineTypography (OH_Drawing_LineTypography* lineTypography)
3681```
3682
3683**描述**
3684
3685释放排版行对象[OH_Drawing_LineTypography](#oh_drawing_linetypography)占用的内存。
3686
3687**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3688
3689**起始版本:** 18
3690
3691**参数:**
3692
3693| 名称 | 描述 |
3694| -------- | -------- |
3695| lineTypography | 指向排版行对象[OH_Drawing_LineTypography](#oh_drawing_linetypography)的指针,由[OH_Drawing_CreateLineTypography](#oh_drawing_createlinetypography)获取。 |
3696
3697### OH_Drawing_LineTypographyGetLineBreak()
3698
3699```
3700size_t OH_Drawing_LineTypographyGetLineBreak (OH_Drawing_LineTypography* lineTypography, size_t startIndex, double width )
3701```
3702
3703**描述**
3704
3705计算在限定排版宽度的情况下,从指定位置处开始可以排版的字符个数。
3706
3707**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3708
3709**起始版本:** 18
3710
3711**参数:**
3712
3713| 名称 | 描述 |
3714| -------- | -------- |
3715| lineTypography | 指向排版行对象[OH_Drawing_LineTypography](#oh_drawing_linetypography)的指针,由[OH_Drawing_CreateLineTypography](#oh_drawing_createlinetypography)获取。 |
3716| startIndex | 开始计算排版的起始位置(包括起始位置)。取值范围需要为[0,文本字符总数)的整数。 |
3717| width | 换行宽度,大于0的浮点数,单位为物理像素px。 |
3718
3719**返回:**
3720
3721返回在限定排版宽度的情况下,从指定位置处开始可以排版的字符总数,取值为整数。
3722
3723### OH_Drawing_LineTypographyCreateLine()
3724
3725```
3726OH_Drawing_TextLine* OH_Drawing_LineTypographyCreateLine (OH_Drawing_LineTypography* lineTypography, size_t startIndex, size_t count )
3727```
3728
3729**描述**
3730
3731根据指定区间文本内容创建一个指向文本行对象**OH_Drawing_TextLine**的指针。
3732
3733**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3734
3735**起始版本:** 18
3736
3737**参数:**
3738
3739| 名称 | 描述 |
3740| -------- | -------- |
3741| lineTypography | 指向排版行对象[OH_Drawing_LineTypography](#oh_drawing_linetypography)的指针,由[OH_Drawing_CreateLineTypography](#oh_drawing_createlinetypography)获取。 |
3742| startIndex | 表示计算排版的起始位置,整数,取值范围为[0, 文本字符总数)。 |
3743| count | 表示从指定排版起始位置开始进行排版的字符个数,取值为[0,文本字符总数)的整数,startIndex和count之和不能大于文本字符总数。 可以先使用[OH_Drawing_LineTypographyGetLineBreak](#oh_drawing_linetypographygetlinebreak)获得合理的可用于进行排版的字符总数。如果该值设置为0,则返回nullptr。 |
3744
3745**返回:**
3746
3747返回一个指向文本行对象**OH_Drawing_TextLine**的指针。
3748
3749### OH_Drawing_CreateTextTab()
3750
3751```
3752OH_Drawing_TextTab* OH_Drawing_CreateTextTab (OH_Drawing_TextAlign alignment, float location )
3753```
3754
3755**描述**
3756
3757创建文本制表符对象。
3758
3759**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3760
3761**起始版本:** 18
3762
3763**参数:**
3764
3765| 名称 | 描述 |
3766| -------- | -------- |
3767| alignment | 制表符之后的文本对齐方式。1为右对齐,2为居中对齐,0或其它为左对齐。 |
3768| float | 文本制表符之后的文本对齐的位置,相对于当前文本起始位置的偏移。单位为物理像素px,最小值为1.0。 |
3769
3770**返回:**
3771
3772OH_Drawing_TextTab 返回指向文本制表符对象的指针。如果返回空指针,表示创建失败。失败的原因可能为没有可用的内存。
3773
3774### OH_Drawing_DestroyTextTab()
3775
3776```
3777void OH_Drawing_DestroyTextTab (OH_Drawing_TextTab* )
3778```
3779
3780**描述**
3781
3782释放文本制表符对象占据的内存。
3783
3784**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3785
3786**起始版本:** 18
3787
3788**参数:**
3789
3790| 名称 | 描述 |
3791| -------- | -------- |
3792| OH_Drawing_TextTab | 指向文本制表符对象的指针。 |
3793
3794### OH_Drawing_GetTextTabAlignment()
3795
3796```
3797OH_Drawing_TextAlign OH_Drawing_GetTextTabAlignment (OH_Drawing_TextTab* )
3798```
3799
3800**描述**
3801
3802获取文本制表符对象的对齐方式。
3803
3804**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3805
3806**起始版本:** 18
3807
3808**参数:**
3809
3810| 名称 | 描述 |
3811| -------- | -------- |
3812| OH_Drawing_TextTab | 指向文本制表符对象的指针。 |
3813
3814**返回:**
3815
3816返回文本对齐方式。1为右对齐,2为居中对齐,0或其它为左对齐。
3817
3818### OH_Drawing_GetTextTabLocation()
3819
3820```
3821float OH_Drawing_GetTextTabLocation (OH_Drawing_TextTab* )
3822```
3823
3824**描述**
3825
3826获取文本制表符的位置。
3827
3828**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3829
3830**起始版本:** 18
3831
3832**参数:**
3833
3834| 名称 | 描述 |
3835| -------- | -------- |
3836| OH_Drawing_TextTab | 指向文本制表符对象的指针。 |
3837
3838**返回:**
3839
3840返回文本制表符对象的位置。
3841
3842### OH_Drawing_SetTypographyTextTab()
3843
3844```
3845void OH_Drawing_SetTypographyTextTab (OH_Drawing_TypographyStyle* , OH_Drawing_TextTab* TextTab )
3846```
3847
3848**描述**
3849
3850设置文本制表符对齐方式及位置。当设置了文本对齐方式或者省略号风格时制表符不生效,当制表符位置小于1.0时为替换成空格的效果。
3851
3852**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3853
3854**起始版本:** 18
3855
3856**参数:**
3857
3858| 名称 | 描述 |
3859| -------- | -------- |
3860| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针。 |
3861| OH_Drawing_TextTab | 指向文本制表符对象的指针。 |
3862
3863### OH_Drawing_FontGetBounds()
3864
3865```
3866OH_Drawing_ErrorCode OH_Drawing_FontGetBounds (const OH_Drawing_Font* font, const uint16_t* glyphs, uint32_t count, OH_Drawing_Array* bounds )
3867```
3868
3869**描述**
3870
3871获取字体指定字形索引的矩形边界。
3872
3873**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3874
3875**起始版本:** 18
3876
3877**参数:**
3878
3879| 名称 | 描述 |
3880| -------- | -------- |
3881| font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
3882| glyphs | 字形索引数组。 |
3883| count | 字形数组的长度。 |
3884| bounds | 矩形边界数组。 |
3885
3886**返回:**
3887
3888函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font、glyphs或bounds为空,或者count为零。
3889
3890### OH_Drawing_FontGetPathForGlyph()
3891
3892```
3893OH_Drawing_ErrorCode OH_Drawing_FontGetPathForGlyph (const OH_Drawing_Font* font, uint16_t glyph, OH_Drawing_Path* path )
3894```
3895
3896**描述**
3897
3898获取字体指定字形索引的轮廓。
3899
3900**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3901
3902**起始版本:** 18
3903
3904**参数:**
3905
3906| 名称 | 描述 |
3907| -------- | -------- |
3908| font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
3909| glyph | 指定的字形索引。 |
3910| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针, 用于存储得到的字形路径。 |
3911
3912**返回:**
3913
3914函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font或者path为空, 或者指定glyph不存在。
3915
3916### OH_Drawing_RectCreateArray()
3917
3918```
3919OH_Drawing_Array* OH_Drawing_RectCreateArray (size_t size)
3920```
3921
3922**描述**
3923
3924用于创建一个矩形数组对象, 用来存储多个矩形对象。不再需要[OH_Drawing_Array](#oh_drawing_array)时,请使用[OH_Drawing_RectDestroyArray](#oh_drawing_rectdestroyarray)接口释放该对象的指针。
3925
3926**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3927
3928**起始版本:** 18
3929
3930**参数:**
3931
3932| 名称 | 描述 |
3933| -------- | -------- |
3934| size | 指定矩形数组的大小,不超过字形索引数量最大值65536。 |
3935
3936**返回:**
3937
3938返回创建的数组对象[OH_Drawing_Array](#oh_drawing_array)指针,如果返回的对象指针为空,表示创建失败。 失败的原因可能为:没有可用的内存或参数错误。
3939
3940### OH_Drawing_RectGetArraySize()
3941
3942```
3943OH_Drawing_ErrorCode OH_Drawing_RectGetArraySize (OH_Drawing_Array* rectArray, size_t* pSize )
3944```
3945
3946**描述**
3947
3948用于获取矩形数组对象[OH_Drawing_Array](#oh_drawing_array)的大小。
3949
3950**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3951
3952**起始版本:** 18
3953
3954**参数:**
3955
3956| 名称 | 描述 |
3957| -------- | -------- |
3958| rectArray | 指向矩形数组对象[OH_Drawing_Array](#oh_drawing_array)的指针。 |
3959| pSize | 指向size_t类型的指针,用于存储矩形数组大小,作为出参使用。 |
3960
3961**返回:**
3962
3963函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数rectArray或者pSize为空。
3964
3965### OH_Drawing_RectGetArrayElement()
3966
3967```
3968OH_Drawing_ErrorCode OH_Drawing_RectGetArrayElement (OH_Drawing_Array* rectArray, size_t index, OH_Drawing_Rect** rect )
3969```
3970
3971**描述**
3972
3973用于获取矩形数组对象中指定索引的矩形对象。
3974
3975**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3976
3977**起始版本:** 18
3978
3979**参数:**
3980
3981| 名称 | 描述 |
3982| -------- | -------- |
3983| rectArray | 指向矩形数组对象[OH_Drawing_Array](#oh_drawing_array)的指针。 |
3984| index | 矩形数组的索引。 |
3985| rect | 指向[OH_Drawing_Rect](#oh_drawing_rect)的二级指针,作为出参,返回给调用者。 |
3986
3987**返回:**
3988
3989函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数rectArray或者rect为空,或者index越界。
3990
3991### OH_Drawing_RectDestroyArray()
3992
3993```
3994OH_Drawing_ErrorCode OH_Drawing_RectDestroyArray (OH_Drawing_Array* rectArray)
3995```
3996
3997**描述**
3998
3999用于销毁矩形数组对象并回收该对象占有的内存。
4000
4001**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4002
4003**起始版本:** 18
4004
4005**参数:**
4006
4007| 名称 | 描述 |
4008| -------- | -------- |
4009| rectArray | 指向矩形数组对象[OH_Drawing_Array](#oh_drawing_array)的指针。 |
4010
4011**返回:**
4012
4013函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数rectArray为空。
4014
4015### OH_Drawing_TypographyGetTextLines()
4016
4017```
4018OH_Drawing_Array* OH_Drawing_TypographyGetTextLines (OH_Drawing_Typography* typography)
4019```
4020
4021**描述**
4022
4023获取排版对象的文本行数组。文本行数组中包含一个或多个文本行对象。不再需要[OH_Drawing_Array](#oh_drawing_array)时,请使用[OH_Drawing_DestroyTextLines](#oh_drawing_destroytextlines)接口释放该对象的指针。
4024
4025**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4026
4027**起始版本:** 18
4028
4029**参数:**
4030
4031| 名称 | 描述 |
4032| -------- | -------- |
4033| typography | 指向排版对象[OH_Drawing_Typography](#oh_drawing_typography)的指针。 |
4034
4035**返回:**
4036
4037指向文本行数组[OH_Drawing_Array](#oh_drawing_array)的指针。
4038
4039### OH_Drawing_DestroyTextLines()
4040
4041```
4042void OH_Drawing_DestroyTextLines (OH_Drawing_Array* lines)
4043```
4044
4045**描述**
4046
4047释放文本行数组的内存。
4048
4049**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4050
4051**起始版本:** 18
4052
4053**参数:**
4054
4055| 名称 | 描述 |
4056| -------- | -------- |
4057| lines | 指向文本行数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
4058
4059### OH_Drawing_DestroyTextLine()
4060
4061```
4062void OH_Drawing_DestroyTextLine (OH_Drawing_TextLine* line)
4063```
4064
4065**描述**
4066
4067释放单个文本行对象的内存。只能释放单独申请内存的文本行对象,不能释放文本行数组中的某一个文本行对象的内存。
4068
4069**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4070
4071**起始版本:** 18
4072
4073**参数:**
4074
4075| 名称 | 描述 |
4076| -------- | -------- |
4077| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4078
4079### OH_Drawing_GetTextLineByIndex()
4080
4081```
4082OH_Drawing_TextLine* OH_Drawing_GetTextLineByIndex (OH_Drawing_Array* lines, size_t index )
4083```
4084
4085**描述**
4086
4087获取文本行数组指定索引处的文本行对象。
4088
4089**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4090
4091**起始版本:** 18
4092
4093**参数:**
4094
4095| 名称 | 描述 |
4096| -------- | -------- |
4097| lines | 指向文本行数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
4098| index | 指定的文本行数组的索引。 |
4099
4100**返回:**
4101
4102指向指定索引处的文本行对象**OH_Drawing_TextLine**的指针。
4103
4104### OH_Drawing_TextLineGetGlyphCount()
4105
4106```
4107double OH_Drawing_TextLineGetGlyphCount (OH_Drawing_TextLine* line)
4108```
4109
4110**描述**
4111
4112获取文本行对象中字形的数量。
4113
4114**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4115
4116**起始版本:** 18
4117
4118**参数:**
4119
4120| 名称 | 描述 |
4121| -------- | -------- |
4122| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4123
4124**返回:**
4125
4126文本行对象中字形的数量。
4127
4128### OH_Drawing_TextLineGetTextRange()
4129
4130```
4131void OH_Drawing_TextLineGetTextRange (OH_Drawing_TextLine* line, size_t* start, size_t* end )
4132```
4133
4134**描述**
4135
4136获取文本行对象中的文本在整个段落文本中的索引区间。
4137
4138**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4139
4140**起始版本:** 18
4141
4142**参数:**
4143
4144| 名称 | 描述 |
4145| -------- | -------- |
4146| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4147| start | 指向区间左侧端点索引的指针。 |
4148| end | 指向区间右侧端点索引的指针。 |
4149
4150### OH_Drawing_TextLineGetGlyphRuns()
4151
4152```
4153OH_Drawing_Array* OH_Drawing_TextLineGetGlyphRuns (OH_Drawing_TextLine* line)
4154```
4155
4156**描述**
4157
4158获取文本行对象中的文本渲染单元数组。
4159
4160**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4161
4162**起始版本:** 18
4163
4164**参数:**
4165
4166| 名称 | 描述 |
4167| -------- | -------- |
4168| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4169
4170**返回:**
4171
4172指向文本渲染单元**OH_Drawing_Run**数组[OH_Drawing_Array](#oh_drawing_array)的指针,不再需要[OH_Drawing_Array](#oh_drawing_array)时,请使用[OH_Drawing_DestroyRuns](#oh_drawing_destroyruns)接口释放该对象的指针。
4173
4174### OH_Drawing_DestroyRuns()
4175
4176```
4177void OH_Drawing_DestroyRuns (OH_Drawing_Array* runs)
4178```
4179
4180**描述**
4181
4182释放文本渲染单元数组的内存。
4183
4184**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4185
4186**起始版本:** 18
4187
4188**参数:**
4189
4190| 名称 | 描述 |
4191| -------- | -------- |
4192| runs | 指向文本渲染单元**OH_Drawing_Run**数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
4193
4194### OH_Drawing_GetRunByIndex()
4195
4196```
4197OH_Drawing_Run* OH_Drawing_GetRunByIndex (OH_Drawing_Array* runs, size_t index )
4198```
4199
4200**描述**
4201
4202获取文本渲染单元数组指定索引处的文本渲染单元对象。
4203
4204**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4205
4206**起始版本:** 18
4207
4208**参数:**
4209
4210| 名称 | 描述 |
4211| -------- | -------- |
4212| runs | 指向文本渲染单元**OH_Drawing_Run**数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
4213| index | 文本渲染单元数组的索引。 |
4214
4215**返回:**
4216
4217指向指定索引处的文本渲染单元对象**OH_Drawing_Run**的指针。
4218
4219### OH_Drawing_TextLinePaint()
4220
4221```
4222void OH_Drawing_TextLinePaint (OH_Drawing_TextLine* line, OH_Drawing_Canvas* canvas, double x, double y )
4223```
4224
4225**描述**
4226
4227在画布上以坐标点 (x, y) 为左上角位置绘制文本行。
4228
4229**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4230
4231**起始版本:** 18
4232
4233**参数:**
4234
4235| 名称 | 描述 |
4236| -------- | -------- |
4237| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4238| canvas | 指向绘制的目标画布[OH_Drawing_Canvas](#oh_drawing_canvas)。 |
4239| x | 绘制的左上角位置的横坐标,单位为物理像素px。 |
4240| y | 绘制的左上角位置的纵坐标,单位为物理像素px。 |
4241
4242### OH_Drawing_TextLineCreateTruncatedLine()
4243
4244```
4245OH_Drawing_TextLine* OH_Drawing_TextLineCreateTruncatedLine (OH_Drawing_TextLine* line, double width, int mode, const char* ellipsis )
4246```
4247
4248**描述**
4249
4250创建一个截断的文本行对象。
4251
4252**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4253
4254**起始版本:** 18
4255
4256**参数:**
4257
4258| 名称 | 描述 |
4259| -------- | -------- |
4260| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4261| width | 截断后的行宽度。 |
4262| mode | 截断的类型,取值对应为[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举,当前仅支持头部截断ELLIPSIS_MODAL_HEAD和尾部截断ELLIPSIS_MODAL_TAIL。 |
4263| ellipsis | 截断的标记字符串。 |
4264
4265**返回:**
4266
4267返回指向截断的文本行对象**OH_Drawing_TextLine**指针。
4268
4269### OH_Drawing_TextLineGetTypographicBounds()
4270
4271```
4272double OH_Drawing_TextLineGetTypographicBounds (OH_Drawing_TextLine* line, double* ascent, double* descent, double* leading )
4273```
4274
4275**描述**
4276
4277获取文本行对象的排版边界。文本行排版边界与排版字体、排版字号有关,与字符本身无关。 例如字符串为" a b ",'a'字符前面有1个空格,'b'字符后面有1个空格,排版边界就包括行首和末尾空格的边界。例如字符串为"j"或"E",排版边界相同,即与字符本身无关。
4278
4279**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4280
4281**起始版本:** 18
4282
4283**参数:**
4284
4285| 名称 | 描述 |
4286| -------- | -------- |
4287| line | 指向文本行对象**OH_Drawing_TextLine**的指针。height = ascent + descent + leading。 |
4288| ascent | 指向文本行对象上升高度的指针。 |
4289| descent | 指向文本行对象下降高度的指针。 |
4290| leading | 指向文本行对象行间距的指针。 |
4291
4292**返回:**
4293
4294排版边界的总宽度。
4295
4296### OH_Drawing_TextLineGetImageBounds()
4297
4298```
4299OH_Drawing_Rect* OH_Drawing_TextLineGetImageBounds (OH_Drawing_TextLine* line)
4300```
4301
4302**描述**
4303
4304获取文本行对象的图像边界。文本行图像边界与排版字体、排版字号、字符本身都有关,相当于视觉边界。 例如字符串为" a b ",'a'字符前面有1个空格,'b'字符后面有1个空格,用户在界面上只能看到"a b",图像边界即为不包括带行首和末尾空格的边界。 例如字符串为"j"或"E",视觉边界不同,即与字符本身有关,"j"字符串的视觉边界宽度小于"E"字符串的视觉边界宽度,"j"字符串的视觉边界高度大于"E"字符串的视觉边界高度。
4305
4306**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4307
4308**起始版本:** 18
4309
4310**参数:**
4311
4312| 名称 | 描述 |
4313| -------- | -------- |
4314| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4315
4316**返回:**
4317
4318指向文本行对象的图像边界[OH_Drawing_Rect](#oh_drawing_rect)的指针,不再需要[OH_Drawing_Rect](#oh_drawing_rect)时,请使用[OH_Drawing_RectDestroy](#oh_drawing_rectdestroy)接口释放该对象的指针。
4319
4320### OH_Drawing_TextLineGetTrailingSpaceWidth()
4321
4322```
4323double OH_Drawing_TextLineGetTrailingSpaceWidth (OH_Drawing_TextLine* line)
4324```
4325
4326**描述**
4327
4328获取文本行对象尾部空白字符的宽度。
4329
4330**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4331
4332**起始版本:** 18
4333
4334**参数:**
4335
4336| 名称 | 描述 |
4337| -------- | -------- |
4338| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4339
4340**返回:**
4341
4342文本行对象尾部空白字符的宽度。
4343
4344### OH_Drawing_TextLineGetStringIndexForPosition()
4345
4346```
4347int32_t OH_Drawing_TextLineGetStringIndexForPosition (OH_Drawing_TextLine* line, OH_Drawing_Point* point )
4348```
4349
4350**描述**
4351
4352获取文本行对象中指定位置处的字符索引。
4353
4354**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4355
4356**起始版本:** 18
4357
4358**参数:**
4359
4360| 名称 | 描述 |
4361| -------- | -------- |
4362| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4363| point | 指向要查找索引的位置[OH_Drawing_Point](#oh_drawing_point)指针。 |
4364
4365**返回:**
4366
4367指定位置处的字符串索引。例如文本字符串为"abc","a"字符的索引为0,"b"字符的索引为1,"c"字符的索引为2。如果指定的位置在"a"字符处,则返回0。
4368
4369### OH_Drawing_TextLineGetOffsetForStringIndex()
4370
4371```
4372double OH_Drawing_TextLineGetOffsetForStringIndex (OH_Drawing_TextLine* line, int32_t index )
4373```
4374
4375**描述**
4376
4377获取文本行对象中指定字符串索引处的偏移量。
4378
4379**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4380
4381**起始版本:** 18
4382
4383**参数:**
4384
4385| 名称 | 描述 |
4386| -------- | -------- |
4387| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4388| index | 要获取偏移量的字符串索引。 |
4389
4390**返回:**
4391
4392指定字符串索引处的偏移量。
4393
4394### OH_Drawing_TextLineEnumerateCaretOffsets()
4395
4396```
4397void OH_Drawing_TextLineEnumerateCaretOffsets (OH_Drawing_TextLine* line, Drawing_CaretOffsetsCallback callback )
4398```
4399
4400**描述**
4401
4402枚举文本行对象中每个字符的偏移量和索引值,传递给用户自定义的回调函数,用户可以使用偏移量和索引值进行其他操作。
4403
4404**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4405
4406**起始版本:** 18
4407
4408**参数:**
4409
4410| 名称 | 描述 |
4411| -------- | -------- |
4412| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4413| callback | 用户自定义函数[Drawing_CaretOffsetsCallback](#drawing_caretoffsetscallback)。 |
4414
4415### OH_Drawing_TextLineGetAlignmentOffset()
4416
4417```
4418double OH_Drawing_TextLineGetAlignmentOffset (OH_Drawing_TextLine* line, double alignmentFactor, double alignmentWidth )
4419```
4420
4421**描述**
4422
4423获取文本行对象根据对齐因子和对齐宽度计算对齐后所需的偏移量。
4424
4425**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4426
4427**起始版本:** 18
4428
4429**参数:**
4430
4431| 名称 | 描述 |
4432| -------- | -------- |
4433| line | 指向文本行对象**OH_Drawing_TextLine**的指针。 |
4434| alignmentFactor | 对齐因子,即对齐的程度。小于等于0.0表示左对齐,大于0.0小于0.5表示偏左对齐,0.5表示居中对齐,大于0.5小于1.0表示偏右对齐,大于等于1.0表示右对齐。 |
4435| alignmentWidth | 对齐宽度,即最终偏移后的文本行对象右下角相对于起始位置的偏移值。如果指定对齐宽度小于文本行对象的实际宽度,则返回0。 |
4436
4437**返回:**
4438
4439计算得到的对齐所需偏移量。
4440
4441### OH_Drawing_AddTextStyleDecoration()
4442
4443```
4444void OH_Drawing_AddTextStyleDecoration (OH_Drawing_TextStyle* , int  )
4445```
4446
4447**描述**
4448
4449新增指定装饰,可同时显示多种装饰线。
4450
4451**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4452
4453**起始版本:** 18
4454
4455**参数:**
4456
4457| 名称 | 描述 |
4458| -------- | -------- |
4459| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4460| int | 要新增的装饰。设置1为新增下划线,设置2为新增上划线,设置4为新增删除线。可通过位或操作一次新增多种装饰线,设置非[OH_Drawing_TextDecoration](#oh_drawing_textdecoration)枚举的装饰样式则保持原有装饰。 |
4461
4462### OH_Drawing_RemoveTextStyleDecoration()
4463
4464```
4465void OH_Drawing_RemoveTextStyleDecoration (OH_Drawing_TextStyle* , int  )
4466```
4467
4468**描述**
4469
4470删除指定装饰。
4471
4472**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4473
4474**起始版本:** 18
4475
4476**参数:**
4477
4478| 名称 | 描述 |
4479| -------- | -------- |
4480| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4481| int | 要删除的装饰。应该与现有的装饰相匹配,设置1为删除下划线,设置2为删除上划线,设置4为删除删除线,可通过位或操作一次删除多种装饰线。 设置非[OH_Drawing_TextDecoration](#oh_drawing_textdecoration)枚举的装饰样式则保持原有装饰。 |
4482
4483### OH_Drawing_FontGetTextPath()
4484
4485```
4486OH_Drawing_ErrorCode OH_Drawing_FontGetTextPath (const OH_Drawing_Font* font, const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding, float x, float y, OH_Drawing_Path* path )
4487```
4488
4489**描述**
4490
4491获取文字轮廓路径。
4492
4493**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4494
4495**起始版本:** 18
4496
4497**参数:**
4498
4499| 名称 | 描述 |
4500| -------- | -------- |
4501| font | 指示字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
4502| text | 指示要获取轮廓路径的文本字符串。 |
4503| byteLength | 指示要获取对应文本路径的字节长度,如果此字节长度大于text字符串的字节长度,会发生未定义行为。 |
4504| encoding | 指示文本编码格式,支持 UTF-8、UTF-16、UTF-32,以及字形索引,具体类型格式可见[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 |
4505| x | 指示文本在绘图区域内以原点为起始位置的X坐标。 |
4506| y | 指示文本在绘图区域内以原点为起始位置的Y坐标。 |
4507| path | 返回获取到的文字轮廓路径对象,作为出参使用。 |
4508
4509**返回:**
4510
4511返回错误代码。 如果操作成功,则返回 OH_DRAWING_SUCCESS。 如果 font、text 或 path 中的任何一个为空指针,则返回 OH_DRAWING_ERROR_INVALID_PARAMETER。
4512
4513### OH_Drawing_GetDrawingArraySize()
4514
4515```
4516size_t OH_Drawing_GetDrawingArraySize (OH_Drawing_Array* drawingArray)
4517```
4518
4519**描述**
4520
4521获取传入类型为对象数组[OH_Drawing_Array](#oh_drawing_array)中的对象个数。
4522
4523**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4524
4525**起始版本:** 14
4526
4527**参数:**
4528
4529| 名称 | 描述 |
4530| -------- | -------- |
4531| drawingArray | 指向对象数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
4532
4533**返回:**
4534
4535数组中的对象个数。
4536
4537
4538### OH_Drawing_GetRunStringIndices()
4539
4540```
4541OH_Drawing_Array* OH_Drawing_GetRunStringIndices (OH_Drawing_Run* run, int64_t start, int64_t length )
4542```
4543
4544**描述**
4545
4546获取渲染单元指定范围内字形的字符索引数组,该索引是相对于整个段落的偏移。
4547
4548**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4549
4550**起始版本:** 18
4551
4552**参数:**
4553
4554| 名称 | 描述 |
4555| -------- | -------- |
4556| run | 指向渲染单元**OH_Drawing_Run**对象的指针。 |
4557| start | 渲染单元内指定的开始位置,传入负数时该方法返回空指针。 |
4558| length | 渲染单元内指定的长度,length为0时获取渲染单元的所有字符索引,length小于0时该方法返回空指针。 |
4559
4560**返回:**
4561
4562返回字形的字符索引数组[OH_Drawing_Array](#oh_drawing_array)对象的指针,不再需要[OH_Drawing_Array](#oh_drawing_array)时,请使用[OH_Drawing_DestroyRunStringIndices](#oh_drawing_destroyrunstringindices)接口释放该对象的指针。
4563
4564
4565### OH_Drawing_GetRunStringIndicesByIndex()
4566
4567```
4568uint64_t OH_Drawing_GetRunStringIndicesByIndex (OH_Drawing_Array* stringIndices, size_t index )
4569```
4570
4571**描述**
4572
4573获取字符索引数组中指定下标的字符索引值。
4574
4575**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4576
4577**起始版本:** 18
4578
4579**参数:**
4580
4581| 名称 | 描述 |
4582| -------- | -------- |
4583| stringIndices | 字符索引数组。 |
4584| index | 渲染单元字形的字符索引数组下标。 |
4585
4586**返回:**
4587
4588返回渲染单元单个字形的字符索引。
4589
4590
4591### OH_Drawing_DestroyRunStringIndices()
4592
4593```
4594void OH_Drawing_DestroyRunStringIndices (OH_Drawing_Array* stringIndices)
4595```
4596
4597**描述**
4598
4599释放字形的字符索引数组对象指针。
4600
4601**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4602
4603**起始版本:** 18
4604
4605**参数:**
4606
4607| 名称 | 描述 |
4608| -------- | -------- |
4609| stringIndices | 字符索引数组。 |
4610
4611
4612### OH_Drawing_GetRunStringRange()
4613
4614```
4615void OH_Drawing_GetRunStringRange (OH_Drawing_Run* run, uint64_t* location, uint64_t* length )
4616```
4617
4618**描述**
4619
4620获取渲染单元生成字形的字符范围。
4621
4622**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4623
4624**起始版本:** 18
4625
4626**参数:**
4627
4628| 名称 | 描述 |
4629| -------- | -------- |
4630| run | 指向渲染单元**OH_Drawing_Run**对象的指针。 |
4631| location | 表示渲染单元字形的字符范围的开始位置,该位置是相对于整个段落的偏移。 |
4632| length | 表示渲染单元字符范围的长度。 |
4633
4634
4635### OH_Drawing_GetRunTypographicBounds()
4636
4637```
4638float OH_Drawing_GetRunTypographicBounds (OH_Drawing_Run* run, float* ascent, float* descent, float* leading )
4639```
4640
4641**描述**
4642
4643获取渲染单元的排版边界。文本排版边界与字符本身无关,与排版字号和字体有关。
4644
4645**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4646
4647**起始版本:** 18
4648
4649**参数:**
4650
4651| 名称 | 描述 |
4652| -------- | -------- |
4653| run | 指向渲染单元**OH_Drawing_Run**对象的指针。 |
4654| ascent | 渲染单元中最高字符到基准线的距离。 |
4655| descent | 渲染单元中最低字符到基准线的距离。 |
4656| leading | 渲染单元行间距。 |
4657
4658**返回:**
4659
4660返回渲染单元排版宽度。
4661
4662
4663### OH_Drawing_RunPaint()
4664
4665```
4666void OH_Drawing_RunPaint (OH_Drawing_Canvas* canvas, OH_Drawing_Run* run, double x, double y )
4667```
4668
4669**描述**
4670
4671在画布上绘制渲染单元包含的文本。
4672
4673**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4674
4675**起始版本:** 18
4676
4677**参数:**
4678
4679| 名称 | 描述 |
4680| -------- | -------- |
4681| canvas | 指向画布[OH_Drawing_Canvas](#oh_drawing_canvas)对象的指针。 |
4682| run | 指向渲染单元**OH_Drawing_Run**对象的指针。 |
4683| x | 渲染单元x坐标。 |
4684| y | 渲染单元y坐标。 |
4685
4686
4687### OH_Drawing_GetRunImageBounds()
4688
4689```
4690OH_Drawing_Rect* OH_Drawing_GetRunImageBounds (OH_Drawing_Run* run)
4691```
4692
4693**描述**
4694
4695获取渲染单元的图像边界,文本图像边界与字符本身有关,相当于视觉边界。
4696
4697**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4698
4699**起始版本:** 18
4700
4701**参数:**
4702
4703| 名称 | 描述 |
4704| -------- | -------- |
4705| run | 指向渲染单元**OH_Drawing_Run**对象的指针。 |
4706
4707**返回:**
4708
4709返回指向渲染单元图像边界[OH_Drawing_Rect](#oh_drawing_rect)对象的指针,不再需要[OH_Drawing_Rect](#oh_drawing_rect)时,请使用[OH_Drawing_DestroyRunImageBounds](#oh_drawing_destroyrunimagebounds)接口释放该对象的指针。
4710
4711
4712### OH_Drawing_DestroyRunImageBounds()
4713
4714```
4715void OH_Drawing_DestroyRunImageBounds (OH_Drawing_Rect* rect)
4716```
4717
4718**描述**
4719
4720释放渲染单元图像边界对象指针。
4721
4722**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4723
4724**起始版本:** 18
4725
4726**参数:**
4727
4728| 名称 | 描述 |
4729| -------- | -------- |
4730| rect | 指向渲染单元图像边界[OH_Drawing_Rect](#oh_drawing_rect)对象的指针。 |
4731
4732
4733### OH_Drawing_GetRunGlyphs()
4734
4735```
4736OH_Drawing_Array* OH_Drawing_GetRunGlyphs (OH_Drawing_Run* run, int64_t start, int64_t length )
4737```
4738
4739**描述**
4740
4741获取渲染单元指定范围内的字形数组。
4742
4743**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4744
4745**起始版本:** 18
4746
4747**参数:**
4748
4749| 名称 | 描述 |
4750| -------- | -------- |
4751| run | 指向渲染单元**OH_Drawing_Run**对象的指针。 |
4752| start | 渲染单元内指定的开始位置,传入负数时该方法返回空指针。 |
4753| length | 渲染单元内指定的长度,length为0时获取渲染单元的所有字符索引,length小于0时该方法返回空指针。 |
4754
4755**返回:**
4756
4757返回指向渲染单元字形数组[OH_Drawing_Array](#oh_drawing_array)对象的指针,不再需要[OH_Drawing_Array](#oh_drawing_array)时,请使用[OH_Drawing_DestroyRunGlyphs](#oh_drawing_destroyrunglyphs)接口释放该对象的指针。
4758
4759
4760### OH_Drawing_GetRunGlyphsByIndex()
4761
4762```
4763uint16_t OH_Drawing_GetRunGlyphsByIndex (OH_Drawing_Array* glyphs, size_t index )
4764```
4765
4766**描述**
4767
4768根据索引获取渲染单元单个字形。
4769
4770**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4771
4772**起始版本:** 18
4773
4774**参数:**
4775
4776| 名称 | 描述 |
4777| -------- | -------- |
4778| glyphs | 指向渲染单元字形数组[OH_Drawing_Array](#oh_drawing_array)对象的指针。 |
4779| index | 渲染单元字形数组下标。 |
4780
4781**返回:**
4782
4783渲染单元单个字形。
4784
4785
4786### OH_Drawing_DestroyRunGlyphs()
4787
4788```
4789void OH_Drawing_DestroyRunGlyphs (OH_Drawing_Array* glyphs)
4790```
4791
4792**描述**
4793
4794释放渲染单元字形数组对象指针。
4795
4796**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4797
4798**起始版本:** 18
4799
4800**参数:**
4801
4802| 名称 | 描述 |
4803| -------- | -------- |
4804| glyphs | 指向渲染单元字形数组[OH_Drawing_Array](#oh_drawing_array)对象的指针。 |
4805
4806### OH_Drawing_GetRunPositions()
4807
4808```
4809OH_Drawing_Array* OH_Drawing_GetRunPositions (OH_Drawing_Run* run, int64_t start, int64_t length )
4810```
4811
4812**描述**
4813
4814获取渲染单元指定范围内字形的位置。
4815
4816**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4817
4818**起始版本:** 18
4819
4820**参数:**
4821
4822| 名称 | 描述 |
4823| -------- | -------- |
4824| run | 指向渲染单元**OH_Drawing_Run**对象的指针。 |
4825| start | 渲染单元内指定的开始位置,传入负数时该方法返回空指针。 |
4826| length | 渲染单元内指定的长度,length为0时获取渲染单元的所有字符索引,length小于0时该方法返回空指针。 |
4827
4828**返回:**
4829
4830返回指向渲染单元字形位置数组[OH_Drawing_Array](#oh_drawing_array)对象的指针,不再需要[OH_Drawing_Array](#oh_drawing_array)时,请使用[OH_Drawing_DestroyRunPositions](#oh_drawing_destroyrunpositions)接口释放该对象的指针。
4831
4832### OH_Drawing_GetRunPositionsByIndex()
4833
4834```
4835OH_Drawing_Point* OH_Drawing_GetRunPositionsByIndex (OH_Drawing_Array* positions, size_t index )
4836```
4837
4838**描述**
4839
4840根据索引获取渲染单元中单个字形位置。
4841
4842**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4843
4844**起始版本:** 18
4845
4846**参数:**
4847
4848| 名称 | 描述 |
4849| -------- | -------- |
4850| positions | 指向渲染单元字形位置数组[OH_Drawing_Array](#oh_drawing_array)对象的指针。 |
4851| index | 渲染单元字形位置数组下标。 |
4852
4853**返回:**
4854
4855返回指向渲染单元单个字形位置[OH_Drawing_Point](#oh_drawing_point)对象的指针。
4856
4857
4858### OH_Drawing_DestroyRunPositions()
4859
4860```
4861void OH_Drawing_DestroyRunPositions (OH_Drawing_Array* positions)
4862```
4863
4864**描述**
4865
4866释放渲染单元字形位置数组对象指针。
4867
4868**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4869
4870**起始版本:** 18
4871
4872**参数:**
4873
4874| 名称 | 描述 |
4875| -------- | -------- |
4876| positions | 指向渲染单元字形位置数组[OH_Drawing_Array](#oh_drawing_array)对象的指针。 |
4877
4878### OH_Drawing_GetRunGlyphCount()
4879
4880```
4881uint32_t OH_Drawing_GetRunGlyphCount (OH_Drawing_Run* run)
4882```
4883
4884**描述**
4885
4886获取渲染单元字形数量。
4887
4888**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4889
4890**起始版本:** 18
4891
4892**参数:**
4893
4894| 名称 | 描述 |
4895| -------- | -------- |
4896| run | 指向渲染单元**OH_Drawing_Run**对象的指针。 |
4897
4898**返回:**
4899
4900返回渲染单元字形数量。
4901
4902### OH_Drawing_MatchFontDescriptors()
4903
4904```
4905OH_Drawing_FontDescriptor* OH_Drawing_MatchFontDescriptors (OH_Drawing_FontDescriptor* , size_t*  )
4906```
4907
4908**描述**
4909
4910获取与指定字体描述符匹配的所有系统字体描述符,其中[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的path字段不作为有效的匹配字段,其余字段不是默认值时生效,如果参数[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的所有字段都是默认值,则获取所有系统字体描述符。如果匹配失败,返回NULL。不再需要[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)时,请使用[OH_Drawing_DestroyFontDescriptors](_drawing.md#oh_drawing_destroyfontdescriptors)接口释放该对象的指针。
4911
4912**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4913
4914**起始版本:** 18
4915
4916**参数:**
4917
4918| 名称                                                         | 描述                                                         |
4919| ------------------------------------------------------------ | ------------------------------------------------------------ |
4920| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)指针。 建议使用 [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor)获得有效的[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)实例,如果自己创建 [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)实例,请确保不用于匹配的字段是默认值。 |
4921| size_t                                                       | 表示返回值数组的成员个数。                                   |
4922
4923**返回:**
4924
4925[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)数组,释放时请使用[OH_Drawing_DestroyFontDescriptors](#oh_drawing_destroyfontdescriptors)。
4926
4927### OH_Drawing_DestroyFontDescriptors()
4928
4929```
4930void OH_Drawing_DestroyFontDescriptors (OH_Drawing_FontDescriptor* , size_t  )
4931```
4932
4933**描述**
4934
4935释放字体描述符[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)数组。
4936
4937**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4938
4939**起始版本:** 18
4940
4941**参数:**
4942
4943| 名称 | 描述 |
4944| -------- | -------- |
4945| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)数组。 |
4946| size_t | [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)数组的成员个数。 |
4947
4948### OH_Drawing_DestroySystemFontFullNames()
4949
4950```
4951void OH_Drawing_DestroySystemFontFullNames (OH_Drawing_Array* )
4952```
4953
4954**描述**
4955
4956释放通过字体类型获取的对应字体的字体名称数组占用的内存。
4957
4958**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4959
4960**起始版本:** 14
4961
4962**参数:**
4963
4964| 名称 | 描述 |
4965| -------- | -------- |
4966| OH_Drawing_Array | 表示字体名称数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
4967
4968### OH_Drawing_GetSystemFontFullNameByIndex()
4969
4970```
4971const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex (OH_Drawing_Array* , size_t  )
4972```
4973
4974**描述**
4975
4976在字体名称数组中通过索引获取对应位置的字体名称。
4977
4978**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4979
4980**起始版本:** 14
4981
4982**参数:**
4983
4984| 名称 | 描述 |
4985| -------- | -------- |
4986| OH_Drawing_Array | 表示字体名称数组[OH_Drawing_Array](#oh_drawing_array)的指针。 |
4987| size_t | 数组的索引。 |
4988
4989**返回:**
4990
4991返回对应索引的字体名称[OH_Drawing_String](_o_h___drawing___string.md)的指针。
4992
4993### OH_Drawing_GetSystemFontFullNamesByType()
4994
4995```
4996OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType (OH_Drawing_SystemFontType )
4997```
4998
4999**描述**
5000
5001根据字体类型获取对应字体的字体名称数组。
5002
5003**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5004
5005**起始版本:** 14
5006
5007**参数:**
5008
5009| 名称 | 描述 |
5010| -------- | -------- |
5011| OH_Drawing_SystemFontType | 表示字体类型的枚举值[OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)。 |
5012
5013**返回:**
5014
5015返回对应字体类型的字体名称数组[OH_Drawing_Array](#oh_drawing_array)的指针,不再需要[OH_Drawing_Array](#oh_drawing_array)时,请使用[OH_Drawing_DestroySystemFontFullNames](#oh_drawing_destroysystemfontfullnames)接口释放该对象的指针。
5016
5017### OH_Drawing_GetFontDescriptorByFullName()
5018
5019```
5020OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName (const OH_Drawing_String* , OH_Drawing_SystemFontType  )
5021```
5022
5023**描述**
5024
5025根据字体名称和字体类型获取指定的字体描述符,支持系统字体、风格字体和用户已安装字体。 字体描述符是描述字体特征的一种数据结构,它包含了定义字体外观和属性的详细信息。
5026
5027**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5028
5029**起始版本:** 14
5030
5031**参数:**
5032
5033| 名称 | 描述 |
5034| -------- | -------- |
5035| [OH_Drawing_String](_o_h___drawing___string.md) | 表示指向字体名称字符串[OH_Drawing_String](_o_h___drawing___string.md)的指针。 |
5036| OH_Drawing_SystemFontType | 表示字体类型的枚举值[OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)。 |
5037
5038**返回:**
5039
5040指向字体描述符对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针,不再需要[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)时,请使用[OH_Drawing_DestroyFontDescriptor](#oh_drawing_destroyfontdescriptor)接口释放该对象的指针。
5041
5042### OH_Drawing_TypefaceCreateFromFileWithArguments()
5043
5044```
5045OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFileWithArguments (const char* path, const OH_Drawing_FontArguments* fontArguments )
5046```
5047
5048**描述**
5049
5050从指定文件路径创建带有字型参数的字体对象。 如果字体对象不支持字型参数中描述的可变维度,此函数将会创建默认字型参数的字体对象。 在这种情况下,此函数将提供与[OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile)相同的功能。
5051
5052**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5053
5054**起始版本:** 13
5055
5056**参数:**
5057
5058| 名称 | 描述 |
5059| -------- | -------- |
5060| path | 指向字体对象所在文件路径的指针。 |
5061| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 |
5062
5063**返回:**
5064
5065函数返回一个指针,指针指向创建的字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 如果返回的对象指针为空,则表示字体对象创建失败。失败的原因可能为:没有可用的内存、 传入的文件路径对象指针或字型参数为空、传入的路径无效。
5066
5067
5068### OH_Drawing_TypefaceCreateFromCurrent()
5069
5070```
5071OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromCurrent (const OH_Drawing_Typeface* current, const OH_Drawing_FontArguments* fontArguments )
5072```
5073
5074**描述**
5075
5076通过已存在的字体对象创建带有字型参数的字体对象。
5077
5078**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5079
5080**起始版本:** 13
5081
5082**参数:**
5083
5084| 名称 | 描述 |
5085| -------- | -------- |
5086| current | 指向字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)的指针。 |
5087| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 |
5088
5089**返回:**
5090
5091函数返回一个指针,指针指向创建的字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 如果返回的对象指针为空,则表示字体对象创建失败。失败的原因可能为:没有可用的内存、 传入的文件路径对象指针或字型参数为空、传入的字体对象不支持字型参数对象中描述的可变维度。
5092
5093
5094### OH_Drawing_FontArgumentsAddVariation()
5095
5096```
5097OH_Drawing_ErrorCode OH_Drawing_FontArgumentsAddVariation (OH_Drawing_FontArguments* fontArguments, const char* axis, float value )
5098```
5099
5100**描述**
5101
5102给字型参数对象添加可变维度。
5103
5104**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5105
5106**起始版本:** 13
5107
5108**参数:**
5109
5110| 名称 | 描述 |
5111| -------- | -------- |
5112| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 |
5113| axis | 字型参数对象可变维度的标签,必须为4个ASCII字符。具体可支持的标签取决于加载的字体文件,如'wght'即为字重标签。 |
5114| value | 可变维度标签对应的取值。 |
5115
5116**返回:**
5117
5118函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数fontArguments或axis任意一个为NULL或者axis的长度不为4。
5119
5120
5121### OH_Drawing_FontArgumentsCreate()
5122
5123```
5124OH_Drawing_FontArguments* OH_Drawing_FontArgumentsCreate (void)
5125```
5126
5127**描述**
5128
5129用于创建一个字型参数对象。字型参数用于创建带有自定义属性的字体对象。
5130
5131**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5132
5133**起始版本:** 13
5134
5135**返回:**
5136
5137返回一个指针,指针指向创建的字型参数对象。
5138
5139
5140### OH_Drawing_FontArgumentsDestroy()
5141
5142```
5143OH_Drawing_ErrorCode OH_Drawing_FontArgumentsDestroy (OH_Drawing_FontArguments* fontArguments)
5144```
5145
5146**描述**
5147
5148用于销毁一个字型参数对象。
5149
5150**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5151
5152**起始版本:** 13
5153
5154**参数:**
5155
5156| 名称 | 描述 |
5157| -------- | -------- |
5158| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 |
5159
5160**返回:**
5161
5162函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数fontArguments为NULL。
5163
5164
5165### OH_Drawing_TypographyGetLongestLineWithIndent()
5166
5167```
5168double OH_Drawing_TypographyGetLongestLineWithIndent (OH_Drawing_Typography* )
5169```
5170
5171**描述**
5172
5173获取排版对象最长行的宽度(该宽度包含当前行缩进的宽度),该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。
5174
5175**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5176
5177**起始版本:** 13
5178
5179**参数:**
5180
5181| 名称 | 描述 |
5182| -------- | -------- |
5183| OH_Drawing_Typography | 指向[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
5184
5185**返回:**
5186
5187返回最长行的宽度(该宽度包含当前行缩进的宽度),单位:物理像素px。
5188
5189
5190
5191### OH_Drawing_RecordCmdDestroy()
5192
5193```
5194OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy (OH_Drawing_RecordCmd* recordCmd)
5195```
5196
5197**描述**
5198
5199销毁录制指令对象,并回收该对象占有的内存。
5200
5201**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5202
5203**起始版本:** 13
5204
5205**参数:**
5206
5207| 名称 | 描述 |
5208| -------- | -------- |
5209| recordCmd | 指向对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的指针。 |
5210
5211**返回:**
5212
5213函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmd为空。
5214
5215
5216### OH_Drawing_RecordCmdUtilsBeginRecording()
5217
5218```
5219OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, int32_t width, int32_t height, OH_Drawing_Canvas** canvas )
5220```
5221
5222**描述**
5223
5224开始录制。此接口需要与[OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording)接口成对使用。
5225
5226指令录制工具生成录制类型的画布对象,可调用drawing的绘制接口,记录接下来所有的绘制指令。
5227
5228**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5229
5230**起始版本:** 13
5231
5232**参数:**
5233
5234| 名称 | 描述 |
5235| -------- | -------- |
5236| recordCmdUtils | 指向录制工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 |
5237| width | 画布的宽度。 |
5238| height | 画布的高度。 |
5239| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的二级指针,作为出参,开发者无需释放。 该画布对象不支持嵌套调用[OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd)接口。 |
5240
5241**返回:**
5242
5243函数返回执行错误码。 返回OH_DRAWING_SUCCESS, 表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER, 表示参数recordCmdUtils或者canvas为空。 当width和height小于等于0的时,也会返回OH_DRAWING_ERROR_INVALID_PARAMETER。 返回OH_DRAWING_ERROR_ALLOCATION_FAILED,表示系统内存不足。
5244
5245
5246### OH_Drawing_RecordCmdUtilsCreate()
5247
5248```
5249OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate (void )
5250```
5251
5252**描述**
5253
5254创建一个录制指令工具对象。
5255
5256**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5257
5258**起始版本:** 13
5259
5260**返回:**
5261
5262返回用于录制指令的工具对象。
5263
5264
5265### OH_Drawing_RecordCmdUtilsDestroy()
5266
5267```
5268OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy (OH_Drawing_RecordCmdUtils* recordCmdUtils)
5269```
5270
5271**描述**
5272
5273销毁一个录制指令工具对象,并回收该对象占有的内存。
5274
5275**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5276
5277**起始版本:** 13
5278
5279**参数:**
5280
5281| 名称 | 描述 |
5282| -------- | -------- |
5283| recordCmdUtils | 指向录制指令工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 |
5284
5285**返回:**
5286
5287函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmdUtils为空。
5288
5289
5290### OH_Drawing_RecordCmdUtilsFinishRecording()
5291
5292```
5293OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, OH_Drawing_RecordCmd** recordCmd )
5294```
5295
5296**描述**
5297
5298结束录制。在调用此接口前,需要先调用[OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording)接口。
5299
5300指令录制工具结束录制指令,将录制类型画布对象记录的绘制指令存入生成的录制指令对象。
5301
5302**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5303
5304**起始版本:** 13
5305
5306**参数:**
5307
5308| 名称 | 描述 |
5309| -------- | -------- |
5310| recordCmdUtils | 指向录制指令工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 |
5311| recordCmd | 指向录制指令对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的二级指针,作为出参,开发者调用[OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd)接口绘制该对象。 需要调用[OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy)接口释放。 |
5312
5313**返回:**
5314
5315函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmdUtils或者recordCmd为空。 返回OH_DRAWING_ERROR_ALLOCATION_FAILED,表示系统内存不足。
5316
5317
5318### OH_Drawing_CanvasDrawRecordCmd()
5319
5320```
5321OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd (OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd )
5322```
5323
5324**描述**
5325
5326用于绘制录制指令对象。
5327
5328**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5329
5330**起始版本:** 13
5331
5332**参数:**
5333
5334| 名称 | 描述 |
5335| -------- | -------- |
5336| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针,仅支持录制类型画布。 |
5337| recordCmd | 指向录制指令对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的指针。 |
5338
5339**返回:**
5340
5341函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者recordCmd为空。
5342
5343
5344
5345### OH_Drawing_TypographyDestroyTextBox()
5346
5347```
5348void OH_Drawing_TypographyDestroyTextBox (OH_Drawing_TextBox* )
5349```
5350
5351**描述**
5352
5353释放文本框占用的内存。
5354
5355**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5356
5357**起始版本:** 12
5358
5359**参数:**
5360
5361| 名称 | 描述 |
5362| -------- | -------- |
5363| OH_Drawing_TextBox | 指向文本框对象[OH_Drawing_TextBox](#oh_drawing_textbox)的指针。 |
5364
5365
5366### OH_Drawing_SetTextShadow()
5367
5368```
5369void OH_Drawing_SetTextShadow (OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius )
5370```
5371
5372**描述**
5373
5374设置字体阴影对象的参数。
5375
5376**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5377
5378**起始版本:** 12
5379
5380**参数:**
5381
5382| 名称 | 描述 |
5383| -------- | -------- |
5384| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 |
5385| color | 字体阴影的颜色,例如入参为0xAABBCCDD,AA代表透明度,BB代表红色分量的值,CC代表绿色分量的值,DD代表蓝色分量的值。 |
5386| OH_Drawing_Point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针,字体阴影基于当前文本的偏移位置。 |
5387| blurRadius | 模糊半径,浮点数,没有单位,值为0.0时表示没有模糊效果。 |
5388
5389
5390
5391### OH_Drawing_CanvasDrawSingleCharacter()
5392
5393```
5394OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter (OH_Drawing_Canvas* canvas, const char* str, const OH_Drawing_Font* font, float x, float y )
5395```
5396
5397**描述**
5398
5399用于绘制单个字符。当前字型中的字体不支持待绘制字符时,退化到使用系统字体绘制字符。
5400
5401**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5402
5403**起始版本:** 12
5404
5405**参数:**
5406
5407| 名称 | 描述 |
5408| -------- | -------- |
5409| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
5410| str | 待绘制的单个字符。可以传入字符串,但只会以UTF-8编码解析并绘制字符串中的首个字符。 |
5411| font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5412| x | 字符对象基线左端点(靠近字符左下角)的横坐标。 |
5413| y | 字符对象基线左端点(靠近字符左下角)的纵坐标。 |
5414
5415**返回:**
5416
5417函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas、str、font任意一个为NULL或者str的长度为0。
5418
5419
5420
5421### OH_Drawing_FontMeasureSingleCharacter()
5422
5423```
5424OH_Drawing_ErrorCode OH_Drawing_FontMeasureSingleCharacter (const OH_Drawing_Font* font, const char* str, float* textWidth )
5425```
5426
5427**描述**
5428
5429用于测量单个字符的宽度。当前字型中的字体不支持待测量字符时,退化到使用系统字体测量字符宽度。
5430
5431**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5432
5433**起始版本:** 12
5434
5435**参数:**
5436
5437| 名称 | 描述 |
5438| -------- | -------- |
5439| font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5440| str | 待测量的单个字符。可以传入字符串,但只会以UTF-8编码解析并测量字符串中的首个字符。 |
5441| textWidth | 用于存储得到的字符宽度。 |
5442
5443**返回:**
5444
5445函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font、str、textWidth任意一个为NULL或者str的长度为0。
5446
5447
5448
5449### OH_Drawing_TypographyPaintOnPath()
5450
5451```
5452void OH_Drawing_TypographyPaintOnPath (OH_Drawing_Typography* typography, OH_Drawing_Canvas* canvas, OH_Drawing_Path* path, double hOffset, double vOffset)
5453```
5454
5455**描述**
5456
5457沿指定路径绘制文本。建议搭配[OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines)接口设置最大行为1行,避免因文本宽度超过排版宽度出现跨行重叠问题。
5458
5459**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5460
5461**起始版本:** 12
5462
5463**参数:**
5464
5465| 名称 | 描述 |
5466| -------- | -------- |
5467| typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
5468| canvas | 指向OH_Drawing_Canvas对象的指针,由[OH_Drawing_CanvasCreate](#oh_drawing_canvascreate)获取。 |
5469| path | 指向OH_Drawing_Path对象的指针,由[OH_Drawing_PathCreate](#oh_drawing_pathcreate)获取。 |
5470| hOffset | 水平偏移量,文本沿路径的水平偏移(X 轴),向前为正,向后为负。 |
5471| vOffset | 垂直偏移量,文本沿路径的垂直偏移(Y 轴),向下为正,向上为负。 |
5472
5473
5474### OH_Drawing_RoundRectOffset()
5475
5476```
5477OH_Drawing_ErrorCode OH_Drawing_RoundRectOffset (OH_Drawing_RoundRect* roundRect, float dx, float dy )
5478```
5479
5480**描述**
5481
5482用于将圆角矩形沿x轴方向和y轴方向平移指定距离。
5483
5484**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5485
5486**起始版本:** 12
5487
5488**参数:**
5489
5490| 名称 | 描述 |
5491| -------- | -------- |
5492| roundRect | 指向圆角矩形对象[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)的指针。 |
5493| dx | x轴方向偏移量。 |
5494| dy | y轴方向偏移量。 |
5495
5496**返回:**
5497
5498函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数roundRect为空。
5499
5500
5501### OH_Drawing_PointGetX()
5502
5503```
5504OH_Drawing_ErrorCode OH_Drawing_PointGetX (const OH_Drawing_Point* point, float* x )
5505```
5506
5507**描述**
5508
5509用于获取点的x轴坐标。
5510
5511**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5512
5513**起始版本:** 12
5514
5515**参数:**
5516
5517| 名称 | 描述 |
5518| -------- | -------- |
5519| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 |
5520| x | 表示点的x轴坐标。 |
5521
5522**返回:**
5523
5524函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point或者x为空。
5525
5526
5527### OH_Drawing_PointGetY()
5528
5529```
5530OH_Drawing_ErrorCode OH_Drawing_PointGetY (const OH_Drawing_Point* point, float* y )
5531```
5532
5533**描述**
5534
5535用于获取点的y轴坐标。
5536
5537**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5538
5539**起始版本:** 12
5540
5541**参数:**
5542
5543| 名称 | 描述 |
5544| -------- | -------- |
5545| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 |
5546| y | 表示点的y轴坐标。 |
5547
5548**返回:**
5549
5550函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point或者y为空。
5551
5552
5553### OH_Drawing_PointSet()
5554
5555```
5556OH_Drawing_ErrorCode OH_Drawing_PointSet (OH_Drawing_Point* point, float x, float y )
5557```
5558
5559**描述**
5560
5561用于设置点的x轴和y轴坐标。
5562
5563**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5564
5565**起始版本:** 12
5566
5567**参数:**
5568
5569| 名称 | 描述 |
5570| -------- | -------- |
5571| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 |
5572| x | 表示点的x轴坐标。 |
5573| y | 表示点的y轴坐标。 |
5574
5575**返回:**
5576
5577函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point为空。
5578
5579
5580### OH_Drawing_FontMeasureText()
5581
5582```
5583OH_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 )
5584```
5585
5586**描述**
5587
5588用于获取文本的宽度和边界框。
5589
5590**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5591
5592**起始版本:** 12
5593
5594**参数:**
5595
5596| 名称 | 描述 |
5597| -------- | -------- |
5598| font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
5599| text | 指向文本的指针。 |
5600| byteLength | 表示以字节为单位的文本长度。 |
5601| encoding | 文本编码类型。 |
5602| bounds | 用于承载获取的边界框,可以为NULL。 |
5603| textWidth | 表示文本宽度。 |
5604
5605**返回:**
5606
5607函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font,text,textWidth至少有一个为空, 或者byteLength为0。
5608
5609
5610### OH_Drawing_CanvasClipRegion()
5611
5612```
5613OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion (OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region, OH_Drawing_CanvasClipOp clipOp )
5614```
5615
5616**描述**
5617
5618用于裁剪一个区域。
5619
5620**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5621
5622**起始版本:** 12
5623
5624**参数:**
5625
5626| 名称 | 描述 |
5627| -------- | -------- |
5628| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
5629| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
5630| clipOp | 表示裁剪类型。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 |
5631
5632**返回:**
5633
5634函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者region为空。返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示clipOp不在枚举范围内。
5635
5636
5637### OH_Drawing_CanvasDrawColor()
5638
5639```
5640OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor (OH_Drawing_Canvas* canvas, uint32_t color, OH_Drawing_BlendMode blendMode )
5641```
5642
5643**描述**
5644
5645用于使用指定的颜色及混合模式来填充整个画布。
5646
5647**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5648
5649**起始版本:** 12
5650
5651**参数:**
5652
5653| 名称 | 描述 |
5654| -------- | -------- |
5655| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
5656| color | 表示指定的颜色,用一个32位(ARGB)的变量表示。 |
5657| blendMode | 表示指定的混合模式。 |
5658
5659**返回:**
5660
5661函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas为空。返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示blendMode不在枚举范围内。
5662
5663
5664### OH_Drawing_CanvasGetImageInfo()
5665
5666```
5667OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo (OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo )
5668```
5669
5670**描述**
5671
5672用于获取画布的图像信息。
5673
5674**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5675
5676**起始版本:** 12
5677
5678**参数:**
5679
5680| 名称 | 描述 |
5681| -------- | -------- |
5682| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
5683| imageInfo | 指向图像信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
5684
5685**返回:**
5686
5687函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者imageInfo为空。
5688
5689
5690### OH_Drawing_CanvasIsClipEmpty()
5691
5692```
5693OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty (OH_Drawing_Canvas* canvas, bool* isClipEmpty )
5694```
5695
5696**描述**
5697
5698用于判断裁剪后可绘制区域是否为空。
5699
5700**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5701
5702**起始版本:** 12
5703
5704**参数:**
5705
5706| 名称 | 描述 |
5707| -------- | -------- |
5708| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
5709| isClipEmpty | 表示裁剪后可绘制区域是否为空。true表示为空,false表示不为空。 |
5710
5711**返回:**
5712
5713函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者isClipEmpty为空。
5714
5715
5716### OH_Drawing_CanvasDrawPoint()
5717
5718```
5719OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint (OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point )
5720```
5721
5722**描述**
5723
5724用于画一个点。
5725
5726**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5727
5728**起始版本:** 12
5729
5730**参数:**
5731
5732| 名称 | 描述 |
5733| -------- | -------- |
5734| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
5735| point | 指向点对象[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)的指针。 |
5736
5737**返回:**
5738
5739函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者point为空。
5740
5741
5742### OH_Drawing_MatrixGetAll()
5743
5744```
5745OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll (OH_Drawing_Matrix* matrix, float value[9] )
5746```
5747
5748**描述**
5749
5750获取矩阵所有元素值。
5751
5752**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5753
5754**起始版本:** 12
5755
5756**参数:**
5757
5758| 名称 | 描述 |
5759| -------- | -------- |
5760| matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
5761| value | 用于存储得到的矩阵元素值的数组。 |
5762
5763**返回:**
5764
5765返回错误码。 返回OH_DRAWING_SUCCESS,表示成功获取矩阵的所有元素值。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示获取矩阵元素值失败,原因是矩阵对象或者存储矩阵元素值数组为空。
5766
5767
5768
5769### OH_Drawing_ErrorCodeGet()
5770
5771```
5772OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet ()
5773```
5774
5775**描述**
5776
5777获取本模块的最近一次的错误码。当函数成功运行后,本函数返回的错误码不会被修改。
5778
5779**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5780
5781**起始版本:** 12
5782
5783**返回:**
5784
5785函数返回错误码枚举值。
5786
5787### OH_Drawing_BrushCopy()
5788
5789```
5790OH_Drawing_Brush* OH_Drawing_BrushCopy (OH_Drawing_Brush* brush)
5791```
5792
5793**描述**
5794
5795创建一个画刷对象副本[OH_Drawing_Brush](#oh_drawing_brush),用于拷贝一个已有画刷对象。
5796
5797本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5798
5799brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5800
5801**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5802
5803**起始版本:** 12
5804
5805**参数:**
5806
5807| 名称 | 描述 |
5808| -------- | -------- |
5809| brush | 指向画刷对象的指针。 |
5810
5811**返回:**
5812
5813函数会返回一个指针,指针指向创建的画刷对象副本[OH_Drawing_Brush](#oh_drawing_brush)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是brush为NULL。
5814
5815
5816
5817### OH_Drawing_FilterSetImageFilter()
5818
5819```
5820void OH_Drawing_FilterSetImageFilter (OH_Drawing_Filter* , OH_Drawing_ImageFilter* )
5821```
5822
5823**描述**
5824
5825为滤波器对象设置图像滤波器对象。
5826
5827本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5828
5829OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5830
5831**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5832
5833**起始版本:** 12
5834
5835**参数:**
5836
5837| 名称 | 描述 |
5838| -------- | -------- |
5839| OH_Drawing_Filter | 指示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 |
5840| OH_Drawing_ImageFilter | 指示指向图像滤波器[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)对象的指针,为NULL表示清空滤波器对象中的图像滤波器效果。 |
5841
5842
5843### OH_Drawing_ImageFilterCreateBlur()
5844
5845```
5846OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur (float sigmaX, float sigmaY, OH_Drawing_TileMode , OH_Drawing_ImageFilter* input )
5847```
5848
5849**描述**
5850
5851创建具有模糊效果的图像滤波器。
5852
5853**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5854
5855**起始版本:** 12
5856
5857**参数:**
5858
5859| 名称 | 描述 |
5860| -------- | -------- |
5861| sigmaX | 表示沿x轴方向上高斯模糊的标准差,必须大于0。 |
5862| sigmaY | 表示沿y轴方向上高斯模糊的标准差,必须大于0。 |
5863| OH_Drawing_TileMode | 图像滤波器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 |
5864| input | 表示将要和当前图像滤波器叠加的输入滤波器, 如果为NULL,表示直接将当前图像滤波器作用于原始图像。 |
5865
5866**返回:**
5867
5868函数会返回一个指针,指针指向创建的图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空。
5869
5870
5871### OH_Drawing_ImageFilterCreateFromColorFilter()
5872
5873```
5874OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter (OH_Drawing_ColorFilter* colorFilter, OH_Drawing_ImageFilter* input )
5875```
5876
5877**描述**
5878
5879创建具有颜色变换效果的图像滤波器。
5880
5881本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5882
5883colorFilter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5884
5885**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5886
5887**起始版本:** 12
5888
5889**参数:**
5890
5891| 名称 | 描述 |
5892| -------- | -------- |
5893| colorFilter | 指向具有颜色变换效果的颜色滤波器对象[OH_Drawing_ColorFilter](#oh_drawing_colorfilter)。 |
5894| input | 表示将要和当前图像滤波器叠加的输入滤波器, 如果为NULL,表示直接将当前图像滤波器作用于原始图像。 |
5895
5896**返回:**
5897
5898函数会返回一个指针,指针指向创建的图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是colorFilter为NULL。
5899
5900
5901### OH_Drawing_ImageFilterDestroy()
5902
5903```
5904void OH_Drawing_ImageFilterDestroy (OH_Drawing_ImageFilter* )
5905```
5906
5907**描述**
5908
5909销毁图像滤波器对象并回收该对象占有内存。
5910
5911**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5912
5913**起始版本:** 12
5914
5915**参数:**
5916
5917| 名称 | 描述 |
5918| -------- | -------- |
5919| OH_Drawing_ImageFilter | 指向图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)的指针。 |
5920
5921
5922### OH_Drawing_MatrixMapPoints()
5923
5924```
5925void OH_Drawing_MatrixMapPoints (const OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, OH_Drawing_Point2D* dst, int count )
5926```
5927
5928**描述**
5929
5930通过矩阵变换将源点数组映射到目标点数组。
5931
5932本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5933
5934OH_Drawing_Matrix、src、dst任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5935
5936**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5937
5938**起始版本:** 12
5939
5940**参数:**
5941
5942| 名称 | 描述 |
5943| -------- | -------- |
5944| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
5945| src | 源点数组。 |
5946| dst | 目标点数组,个数要与源点相等。 |
5947| count | 源点数组以及目标点数组的个数。 |
5948
5949
5950### OH_Drawing_MatrixMapRect()
5951
5952```
5953bool OH_Drawing_MatrixMapRect (const OH_Drawing_Matrix* , const OH_Drawing_Rect* src, OH_Drawing_Rect* dst )
5954```
5955
5956**描述**
5957
5958将目标矩形设置为一个新的矩形,该矩形是能够包围源矩形的四个顶点通过矩阵变换映射后形成的新顶点的最小矩形。
5959
5960本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5961
5962OH_Drawing_Matrix、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5963
5964**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5965
5966**起始版本:** 12
5967
5968**参数:**
5969
5970| 名称 | 描述 |
5971| -------- | -------- |
5972| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
5973| src | 源矩形。 |
5974| dst | 目标矩形。 |
5975
5976**返回:**
5977
5978函数返回源矩形与映射后的目标矩形是否相等。true表示相等,false表示不相等。
5979
5980
5981### OH_Drawing_PathAddPolygon()
5982
5983```
5984void OH_Drawing_PathAddPolygon (OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed )
5985```
5986
5987**描述**
5988
5989向路径添加多边形。
5990
5991本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
5992
5993path、points任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
5994
5995**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5996
5997**起始版本:** 12
5998
5999**参数:**
6000
6001| 名称 | 描述 |
6002| -------- | -------- |
6003| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6004| points | 表示多边形的顶点坐标数组。 |
6005| count | 表示多边形顶点坐标数组的大小。 |
6006| isClosed | 是否添加连接起始点和终止点的线,true表示添加,false表示不添加。 |
6007
6008
6009### OH_Drawing_PathAddCircle()
6010
6011```
6012void OH_Drawing_PathAddCircle (OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection  )
6013```
6014
6015**描述**
6016
6017按指定方向,向路径添加圆形。
6018
6019本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6020
6021path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6022
6023radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE;
6024
6025OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6026
6027**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6028
6029**起始版本:** 12
6030
6031**参数:**
6032
6033| 名称 | 描述 |
6034| -------- | -------- |
6035| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6036| x | 表示圆心的x轴坐标。 |
6037| y | 表示圆心的y轴坐标。 |
6038| radius | 表示圆形的半径。 |
6039| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
6040
6041
6042### OH_Drawing_PathBuildFromSvgString()
6043
6044```
6045bool OH_Drawing_PathBuildFromSvgString (OH_Drawing_Path* path, const char* str )
6046```
6047
6048**描述**
6049
6050解析SVG字符串表示的路径。
6051
6052本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6053
6054path、str任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6055
6056**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6057
6058**起始版本:** 12
6059
6060**参数:**
6061
6062| 名称 | 描述 |
6063| -------- | -------- |
6064| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6065| str | 表示SVG字符串。 |
6066
6067**返回:**
6068
6069函数返回解析SVG字符串是否成功。true表示成功,false表示不成功。
6070
6071
6072### OH_Drawing_PathGetBounds()
6073
6074```
6075void OH_Drawing_PathGetBounds (OH_Drawing_Path* , OH_Drawing_Rect*  )
6076```
6077
6078**描述**
6079
6080获取包含路径的最小边界框。
6081
6082本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6083
6084OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6085
6086**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6087
6088**起始版本:** 12
6089
6090**参数:**
6091
6092| 名称 | 描述 |
6093| -------- | -------- |
6094| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6095| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
6096
6097
6098### OH_Drawing_PathIsClosed()
6099
6100```
6101bool OH_Drawing_PathIsClosed (OH_Drawing_Path* path, bool forceClosed )
6102```
6103
6104**描述**
6105
6106获取路径是否闭合。
6107
6108本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6109
6110path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6111
6112**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6113
6114**起始版本:** 12
6115
6116**参数:**
6117
6118| 名称 | 描述 |
6119| -------- | -------- |
6120| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6121| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
6122
6123**返回:**
6124
6125返回路径是否闭合。true表示路径的测量结果为已闭合,false表示路径的测量结果为未闭合。
6126
6127
6128### OH_Drawing_PathGetPositionTangent()
6129
6130```
6131bool OH_Drawing_PathGetPositionTangent (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent )
6132```
6133
6134**描述**
6135
6136获取距路径起始点指定距离的坐标点和切线值。
6137
6138本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6139
6140path、position、tangent任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6141
6142**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6143
6144**起始版本:** 12
6145
6146**参数:**
6147
6148| 名称 | 描述 |
6149| -------- | -------- |
6150| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6151| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
6152| distance | 表示距离起始点的距离,小于0时会被视作0,大于路径长度时会被视作路径长度。 |
6153| position | 表示距路径起始点指定距离的坐标点。 |
6154| tangent | 表示距路径起始点指定距离的切线值,tangent.x表示该点切线的余弦值,tangent.y表示该点切线的正弦值。 |
6155
6156**返回:**
6157
6158返回测量是否成功。true表示成功,false表示失败。
6159
6160
6161### OH_Drawing_PathOp()
6162
6163```
6164bool OH_Drawing_PathOp (OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op )
6165```
6166
6167**描述**
6168
6169将两个路径按照指定的路径操作类型合并。
6170
6171本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6172
6173path、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6174
6175op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6176
6177**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6178
6179**起始版本:** 12
6180
6181**参数:**
6182
6183| 名称 | 描述 |
6184| -------- | -------- |
6185| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,操作完成后的路径结果将会保存在此路径对象中。 |
6186| other | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6187| op | 路径操作枚举类型,支持可选的具体模式可见[OH_Drawing_PathOpMode](#oh_drawing_pathopmode)枚举。 |
6188
6189**返回:**
6190
6191返回操作后的路径是否为空。true表示路径不为空,false表示路径为空。
6192
6193
6194### OH_Drawing_PathGetMatrix()
6195
6196```
6197bool OH_Drawing_PathGetMatrix (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag )
6198```
6199
6200**描述**
6201
6202获取距路径起始点指定距离的相应变换矩阵。
6203
6204本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6205
6206path、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6207
6208flag不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6209
6210**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6211
6212**起始版本:** 12
6213
6214**参数:**
6215
6216| 名称 | 描述 |
6217| -------- | -------- |
6218| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6219| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
6220| distance | 表示距离起始点的距离,小于0时会被视作0,大于路径长度时会被视作路径长度。 |
6221| matrix | 表示要获取的变换矩阵。 |
6222| flag | 矩阵信息维度枚举,支持可选的具体模式可见[OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags)枚举。 |
6223
6224**返回:**
6225
6226返回获取变换矩阵是否成功。true表示获取成功,false表示获取失败,失败的原因可能是path为NULL或者长度为0。
6227
6228
6229### OH_Drawing_PenGetFillPath()
6230
6231```
6232bool OH_Drawing_PenGetFillPath (OH_Drawing_Pen* , const OH_Drawing_Path* src, OH_Drawing_Path* dst, const OH_Drawing_Rect* , const OH_Drawing_Matrix*  )
6233```
6234
6235**描述**
6236
6237获取使用画笔绘制的源路径轮廓,并用目标路径表示。
6238
6239本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6240
6241OH_Drawing_Pen、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6242
6243**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6244
6245**起始版本:** 12
6246
6247**参数:**
6248
6249| 名称 | 描述 |
6250| -------- | -------- |
6251| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
6252| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6253| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6254| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,推荐使用NULL。 |
6255| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,推荐使用NULL, 默认是一个单位矩阵。 |
6256
6257**返回:**
6258
6259获取目标路径是否成功。true表示获取成功,false表示获取失败。
6260
6261
6262### OH_Drawing_PenCopy()
6263
6264```
6265OH_Drawing_Pen* OH_Drawing_PenCopy (OH_Drawing_Pen* pen)
6266```
6267
6268**描述**
6269
6270创建一个画笔对象副本[OH_Drawing_Pen](#oh_drawing_pen),用于拷贝一个已有画笔对象。
6271
6272本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6273
6274pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6275
6276**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6277
6278**起始版本:** 12
6279
6280**参数:**
6281
6282| 名称 | 描述 |
6283| -------- | -------- |
6284| pen | 指向画笔对象的指针。 |
6285
6286**返回:**
6287
6288函数会返回一个指针,指针指向创建的画笔对象副本[OH_Drawing_Pen](#oh_drawing_pen)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是pen为NULL。
6289
6290
6291### OH_Drawing_PixelMapGetFromNativePixelMap()
6292
6293```
6294OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap (NativePixelMap_* )
6295```
6296
6297**描述**
6298
6299从图像框架定义的像素图对象中获取本模块定义的像素图对象。
6300
6301**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6302
6303**起始版本:** 12
6304
6305**参数:**
6306
6307| 名称 | 描述 |
6308| -------- | -------- |
6309| NativePixelMap_ | 指向图像框架定义的像素图对象**NativePixelMap_**的指针。 |
6310
6311**返回:**
6312
6313函数会返回一个指向本模块定义的像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。如果对象返回NULL,表示创建失败; 可能的原因是NativePixelMap_为NULL。
6314
6315
6316### OH_Drawing_PixelMapGetFromOhPixelMapNative()
6317
6318```
6319OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative (OH_PixelmapNative* )
6320```
6321
6322**描述**
6323
6324从图像框架定义的像素图对象中获取本模块定义的像素图对象。
6325
6326**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6327
6328**起始版本:** 12
6329
6330**参数:**
6331
6332| 名称 | 描述 |
6333| -------- | -------- |
6334| OH_PixelmapNative | 指向图像框架定义的像素图对象**OH_PixelmapNative**的指针。 |
6335
6336**返回:**
6337
6338函数会返回一个指向本模块定义的像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。如果对象返回NULL,表示创建失败; 可能的原因是OH_PixelmapNative为NULL。
6339
6340
6341### OH_Drawing_PixelMapDissolve()
6342
6343```
6344void OH_Drawing_PixelMapDissolve (OH_Drawing_PixelMap* )
6345```
6346
6347**描述**
6348
6349解除本模块定义的像素图对象和图像框架定义的像素图对象之间的关系,该关系通过调用 [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap)或[OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative)建立。
6350
6351**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6352
6353**起始版本:** 12
6354
6355**参数:**
6356
6357| 名称 | 描述 |
6358| -------- | -------- |
6359| OH_Drawing_PixelMap | 指向像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。 |
6360
6361
6362### OH_Drawing_RectJoin()
6363
6364```
6365bool OH_Drawing_RectJoin (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other )
6366```
6367
6368**描述**
6369
6370将两个矩形取并集。
6371
6372本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6373
6374rect、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6375
6376**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6377
6378**起始版本:** 12
6379
6380**参数:**
6381
6382| 名称 | 描述 |
6383| -------- | -------- |
6384| rect | 指向矩形对象的指针。 |
6385| other | 指向矩形对象的指针。 |
6386
6387**返回:**
6388
6389返回两个矩形取并集的结果。true表示成功,false表示失败,失败的原因可能是两个矩形至少有一个为NULL或者other矩形大小为空。
6390
6391
6392### OH_Drawing_RegionContains()
6393
6394```
6395bool OH_Drawing_RegionContains (OH_Drawing_Region* region, int32_t x, int32_t y )
6396```
6397
6398**描述**
6399
6400判断区域是否包含指定坐标点。
6401
6402本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6403
6404region为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6405
6406**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6407
6408**起始版本:** 12
6409
6410**参数:**
6411
6412| 名称 | 描述 |
6413| -------- | -------- |
6414| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
6415| int32_t | 表示指定坐标点的x轴坐标。 |
6416| int32_t | 表示指定坐标点的y轴坐标。 |
6417
6418**返回:**
6419
6420返回区域是否包含指定坐标点。true表示区域包含该坐标点,false表示区域不包含该坐标点。
6421
6422
6423### OH_Drawing_RegionOp()
6424
6425```
6426bool OH_Drawing_RegionOp (OH_Drawing_Region* region, const OH_Drawing_Region* other, OH_Drawing_RegionOpMode op )
6427```
6428
6429**描述**
6430
6431将两个区域按照指定的区域操作类型合并。
6432
6433本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6434
6435region、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6436
6437op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6438
6439**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6440
6441**起始版本:** 12
6442
6443**参数:**
6444
6445| 名称 | 描述 |
6446| -------- | -------- |
6447| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针,操作完成后的区域结果将会保存在此区域对象中。 |
6448| other | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
6449| op | 区域操作枚举类型,支持可选的具体模式可见[OH_Drawing_RegionOpMode](#oh_drawing_regionopmode)枚举。 |
6450
6451**返回:**
6452
6453返回操作后的区域是否为空。true表示区域不为空,false表示区域为空。
6454
6455
6456### OH_Drawing_RegionSetPath()
6457
6458```
6459bool OH_Drawing_RegionSetPath (OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip )
6460```
6461
6462**描述**
6463
6464给区域对象设置为指定区域内路径表示的范围。
6465
6466本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6467
6468region、path、clip任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6469
6470**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6471
6472**起始版本:** 12
6473
6474**参数:**
6475
6476| 名称 | 描述 |
6477| -------- | -------- |
6478| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
6479| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
6480| clip | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 |
6481
6482**返回:**
6483
6484返回操作后的区域是否为空。true表示区域不为空,false表示区域为空。
6485
6486
6487### OH_Drawing_ShaderEffectCreateColorShader()
6488
6489```
6490OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader (const uint32_t color)
6491```
6492
6493**描述**
6494
6495创建具有单一颜色的着色器。
6496
6497**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6498
6499**起始版本:** 12
6500
6501**参数:**
6502
6503| 名称 | 描述 |
6504| -------- | -------- |
6505| color | 表示着色器的ARGB格式颜色,该参数为32位无符号整数。|
6506
6507**返回:**
6508
6509函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空。
6510
6511
6512### OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix()
6513
6514```
6515OH_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*  )
6516```
6517
6518**描述**
6519
6520创建着色器,在两个指定点之间生成线性渐变。
6521
6522本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6523
6524startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6525
6526OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6527
6528**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6529
6530**起始版本:** 12
6531
6532**参数:**
6533
6534| 名称 | 描述 |
6535| -------- | -------- |
6536| startPt | 表示渐变的起点。 |
6537| endPt | 表示渐变的终点。 |
6538| colors | 表示在两个点之间分布的颜色。 |
6539| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在起点和终点之间。 |
6540| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
6541| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 |
6542| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 |
6543
6544**返回:**
6545
6546函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是startPt、endPt、colors至少一个为NULL。
6547
6548
6549### OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix()
6550
6551```
6552OH_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*  )
6553```
6554
6555**描述**
6556
6557创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。
6558
6559本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6560
6561centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6562
6563OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6564
6565**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6566
6567**起始版本:** 12
6568
6569**参数:**
6570
6571| 名称 | 描述 |
6572| -------- | -------- |
6573| centerPt | 表示渐变的圆心。 |
6574| radius | 表示渐变的半径。 |
6575| colors | 表示在径向上分布的颜色。 |
6576| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在径向上。 |
6577| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
6578| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 |
6579| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 |
6580
6581**返回:**
6582
6583函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是centerPt、colors至少一个为NULL。
6584
6585
6586### OH_Drawing_ShaderEffectCreateTwoPointConicalGradient()
6587
6588```
6589OH_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*  )
6590```
6591
6592**描述**
6593
6594创建着色器,在给定两个圆之间生成渐变。
6595
6596本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6597
6598startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6599
6600OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6601
6602**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6603
6604**起始版本:** 12
6605
6606**参数:**
6607
6608| 名称 | 描述 |
6609| -------- | -------- |
6610| startPt | 表示渐变的起点圆心。 |
6611| startRadius | 表示渐变的起点半径,需为非负数。 |
6612| endPt | 表示渐变的终点圆心。 |
6613| endRadius | 表示渐变的终点半径,需为非负数。 |
6614| colors | 表示在两个圆之间分布的颜色。 |
6615| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在两个圆之间。 |
6616| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
6617| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
6618| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 |
6619
6620**返回:**
6621
6622函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是startPt、endPt、colors至少一个为NULL。
6623
6624
6625
6626### OH_Drawing_TextBlobUniqueID()
6627
6628```
6629uint32_t OH_Drawing_TextBlobUniqueID (const OH_Drawing_TextBlob* )
6630```
6631
6632**描述**
6633
6634获取文本的标识符,该标识符是唯一的非零值。
6635
6636本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6637
6638OH_Drawing_TextBlob为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6639
6640**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6641
6642**起始版本:** 12
6643
6644**参数:**
6645
6646| 名称 | 描述 |
6647| -------- | -------- |
6648| OH_Drawing_TextBlob | 指向文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)的指针。 |
6649
6650**返回:**
6651
6652返回文本对象的标识符。
6653
6654
6655### OH_Drawing_PenSetShadowLayer()
6656
6657```
6658void OH_Drawing_PenSetShadowLayer (OH_Drawing_Pen* , OH_Drawing_ShadowLayer* )
6659```
6660
6661**描述**
6662
6663设置画笔阴影层效果,设置的阴影层效果当前仅在绘制文字时生效。
6664
6665本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6666
6667OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6668
6669**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6670
6671**起始版本:** 12
6672
6673**参数:**
6674
6675| 名称 | 描述 |
6676| -------- | -------- |
6677| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
6678| OH_Drawing_ShadowLayer | 指向阴影层对象[OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer)的指针,为NULL表示清空阴影层效果。 |
6679
6680
6681### OH_Drawing_BrushSetShadowLayer()
6682
6683```
6684void OH_Drawing_BrushSetShadowLayer (OH_Drawing_Brush* , OH_Drawing_ShadowLayer* )
6685```
6686
6687**描述**
6688
6689为画刷设置阴影层,设置的阴影层效果当前仅在绘制文字时生效。
6690
6691本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6692
6693OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6694
6695**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6696
6697**起始版本:** 12
6698
6699**参数:**
6700
6701| 名称 | 描述 |
6702| -------- | -------- |
6703| OH_Drawing_Brush | 指向画刷对象的指针。 |
6704| OH_Drawing_ShadowLayer | 表示指向阴影层的指针,为NULL表示清空画刷的阴影层效果。 |
6705
6706
6707### OH_Drawing_ShadowLayerCreate()
6708
6709```
6710OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate (float blurRadius, float x, float y, uint32_t color )
6711```
6712
6713**描述**
6714
6715创建一个阴影层对象。
6716
6717本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6718
6719blurRadius小于0等于时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6720
6721**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6722
6723**起始版本:** 12
6724
6725**参数:**
6726
6727| 名称 | 描述 |
6728| -------- | -------- |
6729| blurRadius | 表示阴影的半径,必须大于零。 |
6730| x | 表示x轴上的偏移点。 |
6731| y | 表示y轴上的偏移点。 |
6732| color | 表示阴影的颜色。 |
6733
6734**返回:**
6735
6736返回创建的阴影层对象的指针。
6737
6738
6739### OH_Drawing_ShadowLayerDestroy()
6740
6741```
6742void OH_Drawing_ShadowLayerDestroy (OH_Drawing_ShadowLayer* )
6743```
6744
6745**描述**
6746
6747销毁阴影层对象,并收回该对象占用的内存。
6748
6749**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6750
6751**起始版本:** 12
6752
6753**参数:**
6754
6755| 名称 | 描述 |
6756| -------- | -------- |
6757| OH_Drawing_ShadowLayer | 表示指向阴影层对象的指针。 |
6758
6759
6760### OH_Drawing_FontSetBaselineSnap()
6761
6762```
6763void OH_Drawing_FontSetBaselineSnap (OH_Drawing_Font* , bool baselineSnap )
6764```
6765
6766**描述**
6767
6768当前画布矩阵轴对齐时,将字型基线设置为是否与像素对齐。
6769
6770本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6771
6772OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6773
6774**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6775
6776**起始版本:** 12
6777
6778**参数:**
6779
6780| 名称 | 描述 |
6781| -------- | -------- |
6782| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
6783| baselineSnap | 指示字型基线是否和像素对齐,true表示对齐,false表示不对齐。 |
6784
6785
6786### OH_Drawing_FontIsBaselineSnap()
6787
6788```
6789bool OH_Drawing_FontIsBaselineSnap (const OH_Drawing_Font* )
6790```
6791
6792**描述**
6793
6794当前画布矩阵轴对齐时,获取字型基线是否与像素对齐。
6795
6796本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6797
6798OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6799
6800**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6801
6802**起始版本:** 12
6803
6804**参数:**
6805
6806| 名称 | 描述 |
6807| -------- | -------- |
6808| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
6809
6810**返回:**
6811
6812返回字型基线是否与像素对齐,true为对齐,false为没有对齐。
6813
6814
6815### OH_Drawing_FontSetEdging()
6816
6817```
6818void OH_Drawing_FontSetEdging (OH_Drawing_Font* , OH_Drawing_FontEdging  )
6819```
6820
6821**描述**
6822
6823用于设置字型边缘效果。
6824
6825本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6826
6827OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
6828
6829OH_Drawing_FontEdging不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
6830
6831**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6832
6833**起始版本:** 12
6834
6835**参数:**
6836
6837| 名称 | 描述 |
6838| -------- | -------- |
6839| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
6840| OH_Drawing_FontEdging | 字型边缘效果。 |
6841
6842
6843### OH_Drawing_FontGetEdging()
6844
6845```
6846OH_Drawing_FontEdging OH_Drawing_FontGetEdging (const OH_Drawing_Font* )
6847```
6848
6849**描述**
6850
6851获取字型边缘效果。
6852
6853本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6854
6855OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6856
6857**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6858
6859**起始版本:** 12
6860
6861**参数:**
6862
6863| 名称 | 描述 |
6864| -------- | -------- |
6865| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
6866
6867**返回:**
6868
6869返回字型边缘效果。
6870
6871
6872
6873### OH_Drawing_FontSetForceAutoHinting()
6874
6875```
6876void OH_Drawing_FontSetForceAutoHinting (OH_Drawing_Font* , bool isForceAutoHinting )
6877```
6878
6879**描述**
6880
6881用于设置是否自动调整字型轮廓。
6882
6883本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6884
6885OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6886
6887**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6888
6889**起始版本:** 12
6890
6891**参数:**
6892
6893| 名称 | 描述 |
6894| -------- | -------- |
6895| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
6896| isForceAutoHinting | 是否自动调整字型轮廓,true为自动调整,false为不自动调整。 |
6897
6898
6899### OH_Drawing_FontIsForceAutoHinting()
6900
6901```
6902bool OH_Drawing_FontIsForceAutoHinting (const OH_Drawing_Font* )
6903```
6904
6905**描述**
6906
6907获取字型轮廓是否自动调整。
6908
6909本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6910
6911OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6912
6913**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6914
6915**起始版本:** 12
6916
6917**参数:**
6918
6919| 名称 | 描述 |
6920| -------- | -------- |
6921| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
6922
6923**返回:**
6924
6925返回字型轮廓是否自动调整,true为自动调整,false为不自动调整。
6926
6927
6928### OH_Drawing_FontSetSubpixel()
6929
6930```
6931void OH_Drawing_FontSetSubpixel (OH_Drawing_Font* , bool isSubpixel )
6932```
6933
6934**描述**
6935
6936设置字型是否使用次像素渲染。
6937
6938本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6939
6940OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6941
6942**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6943
6944**起始版本:** 12
6945
6946**参数:**
6947
6948| 名称 | 描述 |
6949| -------- | -------- |
6950| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
6951| isSubpixel | 字型是否使用次像素渲染,true为使用,false为不使用。 |
6952
6953
6954### OH_Drawing_FontIsSubpixel()
6955
6956```
6957bool OH_Drawing_FontIsSubpixel (const OH_Drawing_Font* )
6958```
6959
6960**描述**
6961
6962获取字型是否使用次像素渲染。
6963
6964本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6965
6966OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6967
6968**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6969
6970**起始版本:** 12
6971
6972**参数:**
6973
6974| 名称 | 描述 |
6975| -------- | -------- |
6976| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
6977
6978**返回:**
6979
6980返回字型是否使用次像素渲染,true为使用,false为不使用。
6981
6982
6983### OH_Drawing_FontGetTextSize()
6984
6985```
6986float OH_Drawing_FontGetTextSize (const OH_Drawing_Font* )
6987```
6988
6989**描述**
6990
6991获取字型文字大小。
6992
6993本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
6994
6995OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
6996
6997**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
6998
6999**起始版本:** 12
7000
7001**参数:**
7002
7003| 名称 | 描述 |
7004| -------- | -------- |
7005| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7006
7007**返回:**
7008
7009返回一个浮点数,表示字型文字大小。
7010
7011
7012### OH_Drawing_FontTextToGlyphs()
7013
7014```
7015uint32_t OH_Drawing_FontTextToGlyphs (const OH_Drawing_Font* , const void* text, uint32_t byteLength, OH_Drawing_TextEncoding encoding, uint16_t* glyphs, int maxGlyphCount )
7016```
7017
7018**描述**
7019
7020用于将文本转换为字形索引。
7021
7022本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7023
7024OH_Drawing_Font、text、glyphs任意一个为NULL或者byteLength等于0或者maxGlyphCount小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7025
7026**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7027
7028**起始版本:** 12
7029
7030**参数:**
7031
7032| 名称 | 描述 |
7033| -------- | -------- |
7034| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7035| text | 文本存储首地址。 |
7036| byteLength | 文本长度,单位为字节。 |
7037| encoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 |
7038| glyphs | 字形索引存储首地址,用于存储得到的字形索引。 |
7039| maxGlyphCount | 文本所表示的最大字符数量。 |
7040
7041**返回:**
7042
7043返回字形索引数量。
7044
7045
7046### OH_Drawing_FontGetWidths()
7047
7048```
7049void OH_Drawing_FontGetWidths (const OH_Drawing_Font* , const uint16_t* glyphs, int count, float* widths )
7050```
7051
7052**描述**
7053
7054用于获取字符串中每个字符的宽度。
7055
7056本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7057
7058OH_Drawing_Font、glyphs、widths任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7059
7060**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7061
7062**起始版本:** 12
7063
7064**参数:**
7065
7066| 名称 | 描述 |
7067| -------- | -------- |
7068| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7069| glyphs | 字形索引存储首地址。 |
7070| count | 字形索引的数量。 |
7071| widths | 字形宽度存储首地址,用于存储得到的字形宽度。 |
7072
7073
7074### OH_Drawing_FontIsLinearText()
7075
7076```
7077bool OH_Drawing_FontIsLinearText (const OH_Drawing_Font* )
7078```
7079
7080**描述**
7081
7082获取字型是否使用线性缩放。
7083
7084本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7085
7086OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7087
7088**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7089
7090**起始版本:** 12
7091
7092**参数:**
7093
7094| 名称 | 描述 |
7095| -------- | -------- |
7096| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7097
7098**返回:**
7099
7100返回字型是否使用线性缩放,true为使用,false为不使用。
7101
7102
7103### OH_Drawing_FontGetTextSkewX()
7104
7105```
7106float OH_Drawing_FontGetTextSkewX (const OH_Drawing_Font* )
7107```
7108
7109**描述**
7110
7111获取字型文本在x轴上的倾斜度。
7112
7113本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7114
7115OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7116
7117**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7118
7119**起始版本:** 12
7120
7121**参数:**
7122
7123| 名称 | 描述 |
7124| -------- | -------- |
7125| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7126
7127**返回:**
7128
7129返回一个浮点数,表示x轴上的文本倾斜度。
7130
7131
7132### OH_Drawing_FontIsFakeBoldText()
7133
7134```
7135bool OH_Drawing_FontIsFakeBoldText (const OH_Drawing_Font* )
7136```
7137
7138**描述**
7139
7140获取是否增加笔画宽度以接近粗体字体。
7141
7142本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7143
7144OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7145
7146**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7147
7148**起始版本:** 12
7149
7150**参数:**
7151
7152| 名称 | 描述 |
7153| -------- | -------- |
7154| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7155
7156**返回:**
7157
7158返回是否增加笔画宽度以接近粗体字体,true为增加,false为不增加。
7159
7160
7161### OH_Drawing_FontSetScaleX()
7162
7163```
7164void OH_Drawing_FontSetScaleX (OH_Drawing_Font* , float scaleX )
7165```
7166
7167**描述**
7168
7169用于设置字型对象在x轴上的缩放比例。
7170
7171本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7172
7173OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7174
7175**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7176
7177**起始版本:** 12
7178
7179**参数:**
7180
7181| 名称 | 描述 |
7182| -------- | -------- |
7183| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7184| scaleX | 文本在x轴上的缩放比例。 |
7185
7186
7187### OH_Drawing_FontGetScaleX()
7188
7189```
7190float OH_Drawing_FontGetScaleX (const OH_Drawing_Font* )
7191```
7192
7193**描述**
7194
7195获取字型对象在x轴上的缩放比例。
7196
7197本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7198
7199OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7200
7201**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7202
7203**起始版本:** 12
7204
7205**参数:**
7206
7207| 名称 | 描述 |
7208| -------- | -------- |
7209| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7210
7211**返回:**
7212
7213返回文本在x轴上的缩放比例。
7214
7215
7216### OH_Drawing_FontSetHinting()
7217
7218```
7219void OH_Drawing_FontSetHinting (OH_Drawing_Font* , OH_Drawing_FontHinting  )
7220```
7221
7222**描述**
7223
7224用于设置字型轮廓效果。
7225
7226本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7227
7228OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
7229
7230OH_Drawing_FontHinting不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
7231
7232**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7233
7234**起始版本:** 12
7235
7236**参数:**
7237
7238| 名称 | 描述 |
7239| -------- | -------- |
7240| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7241| OH_Drawing_FontHinting | 字型轮廓枚举类型[OH_Drawing_FontHinting](#oh_drawing_fonthinting)。 |
7242
7243
7244### OH_Drawing_FontGetHinting()
7245
7246```
7247OH_Drawing_FontHinting OH_Drawing_FontGetHinting (const OH_Drawing_Font* )
7248```
7249
7250**描述**
7251
7252获取字型轮廓效果枚举类型。
7253
7254本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7255
7256OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7257
7258**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7259
7260**起始版本:** 12
7261
7262**参数:**
7263
7264| 名称 | 描述 |
7265| -------- | -------- |
7266| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7267
7268**返回:**
7269
7270OH_Drawing_FontHinting 返回字型轮廓效果枚举类型[OH_Drawing_FontHinting](#oh_drawing_fonthinting)。
7271
7272
7273### OH_Drawing_FontSetEmbeddedBitmaps()
7274
7275```
7276void OH_Drawing_FontSetEmbeddedBitmaps (OH_Drawing_Font* , bool isEmbeddedBitmaps )
7277```
7278
7279**描述**
7280
7281用于设置字型是否转换成位图处理。
7282
7283本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7284
7285OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7286
7287**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7288
7289**起始版本:** 12
7290
7291**参数:**
7292
7293| 名称 | 描述 |
7294| -------- | -------- |
7295| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7296| isEmbeddedBitmaps | 设置字型是否转换成位图处理,true表示转换成位图处理,false表示不转换成位图处理。 |
7297
7298
7299### OH_Drawing_FontIsEmbeddedBitmaps()
7300
7301```
7302bool OH_Drawing_FontIsEmbeddedBitmaps (const OH_Drawing_Font* )
7303```
7304
7305**描述**
7306
7307获取字型是否转换成位图处理。
7308
7309本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7310
7311OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7312
7313**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7314
7315**起始版本:** 12
7316
7317**参数:**
7318
7319| 名称 | 描述 |
7320| -------- | -------- |
7321| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
7322
7323**返回:**
7324
7325返回字型是否转换成位图处理,true表示转换成位图处理,false表示不转换成位图处理。
7326
7327
7328### OH_Drawing_BitmapBuild()
7329
7330```
7331void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap* , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat*  )
7332```
7333
7334**描述**
7335
7336用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。
7337
7338本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7339
7340OH_Drawing_Bitmap、OH_Drawing_BitmapFormat任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7341
7342**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7343
7344**起始版本:** 8
7345
7346**参数:**
7347
7348| 名称 | 描述 |
7349| -------- | -------- |
7350| OH_Drawing_Bitmap | 指向位图对象的指针。 |
7351| width | 位图要初始化设置的宽度。 |
7352| height | 位图要初始化设置的高度。 |
7353| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型。 |
7354
7355
7356### OH_Drawing_BitmapCreate()
7357
7358```
7359OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void )
7360```
7361
7362**描述**
7363
7364用于创建一个位图对象。
7365
7366**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7367
7368**起始版本:** 8
7369
7370**返回:**
7371
7372函数会返回一个指针,指针指向创建的位图对象。
7373
7374
7375### OH_Drawing_BitmapCreateFromPixels()
7376
7377```
7378OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels (OH_Drawing_Image_Info* , void* pixels, uint32_t rowBytes )
7379```
7380
7381**描述**
7382
7383用于创建一个位图对象,并将位图像素存储内存地址设置为开发者申请内存的地址。
7384
7385本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7386
7387OH_Drawing_Image_Info、pixels任意一个为NULL或者rowBytes等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7388
7389**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7390
7391**起始版本:** 12
7392
7393**参数:**
7394
7395| 名称 | 描述 |
7396| -------- | -------- |
7397| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
7398| pixels | 指向像素存储的内存首地址,内存由开发者申请,保证有效性。 |
7399| rowBytes | 每行像素的大小,小于等于0时无效。 |
7400
7401**返回:**
7402
7403函数返回一个指针,指针指向创建的位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)。
7404
7405
7406### OH_Drawing_BitmapDestroy()
7407
7408```
7409void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap* )
7410```
7411
7412**描述**
7413
7414用于销毁位图对象并回收该对象占有内存。
7415
7416**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7417
7418**起始版本:** 8
7419
7420**参数:**
7421
7422| 名称 | 描述 |
7423| -------- | -------- |
7424| OH_Drawing_Bitmap | 指向位图对象的指针。 |
7425
7426
7427### OH_Drawing_BitmapGetAlphaFormat()
7428
7429```
7430OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat (OH_Drawing_Bitmap* )
7431```
7432
7433**描述**
7434
7435用于获取指定位图的像素透明度分量。
7436
7437本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7438
7439OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7440
7441**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7442
7443**起始版本:** 12
7444
7445**参数:**
7446
7447| 名称 | 描述 |
7448| -------- | -------- |
7449| OH_Drawing_Bitmap | 指向位图对象的指针。 |
7450
7451**返回:**
7452
7453函数返回位图的像素透明度分量,支持格式参考[OH_Drawing_AlphaFormat](#oh_drawing_alphaformat)。
7454
7455
7456### OH_Drawing_BitmapGetColorFormat()
7457
7458```
7459OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat (OH_Drawing_Bitmap* )
7460```
7461
7462**描述**
7463
7464用于获取指定位图的像素存储格式。
7465
7466本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7467
7468OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7469
7470**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7471
7472**起始版本:** 12
7473
7474**参数:**
7475
7476| 名称 | 描述 |
7477| -------- | -------- |
7478| OH_Drawing_Bitmap | 指向位图对象的指针。 |
7479
7480**返回:**
7481
7482函数返回位图的像素存储格式,支持格式参考[OH_Drawing_ColorFormat](#oh_drawing_colorformat)。
7483
7484
7485### OH_Drawing_BitmapGetHeight()
7486
7487```
7488uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap* )
7489```
7490
7491**描述**
7492
7493用于获取指定位图的高度。
7494
7495本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7496
7497OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7498
7499**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7500
7501**起始版本:** 8
7502
7503**参数:**
7504
7505| 名称 | 描述 |
7506| -------- | -------- |
7507| OH_Drawing_Bitmap | 指向位图对象的指针。 |
7508
7509**返回:**
7510
7511函数返回位图的高度。
7512
7513
7514### OH_Drawing_BitmapGetImageInfo()
7515
7516```
7517void OH_Drawing_BitmapGetImageInfo (OH_Drawing_Bitmap* , OH_Drawing_Image_Info*  )
7518```
7519
7520**描述**
7521
7522用于获取指定位图的信息。
7523
7524本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7525
7526OH_Drawing_Bitmap、OH_Drawing_Image_Info任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7527
7528**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7529
7530**起始版本:** 12
7531
7532**参数:**
7533
7534| 名称 | 描述 |
7535| -------- | -------- |
7536| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
7537| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
7538
7539
7540### OH_Drawing_BitmapGetPixels()
7541
7542```
7543void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap* )
7544```
7545
7546**描述**
7547
7548用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。
7549
7550本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7551
7552OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7553
7554**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7555
7556**起始版本:** 8
7557
7558**参数:**
7559
7560| 名称 | 描述 |
7561| -------- | -------- |
7562| OH_Drawing_Bitmap | 指向位图对象的指针。 |
7563
7564**返回:**
7565
7566函数返回位图的像素地址。
7567
7568
7569### OH_Drawing_BitmapGetWidth()
7570
7571```
7572uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap* )
7573```
7574
7575**描述**
7576
7577用于获取指定位图的宽度。
7578
7579本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7580
7581OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7582
7583**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7584
7585**起始版本:** 8
7586
7587**参数:**
7588
7589| 名称 | 描述 |
7590| -------- | -------- |
7591| OH_Drawing_Bitmap | 指向位图对象的指针。 |
7592
7593**返回:**
7594
7595函数返回位图的宽度。
7596
7597### OH_Drawing_BitmapReadPixels()
7598
7599```
7600bool OH_Drawing_BitmapReadPixels (OH_Drawing_Bitmap* , const OH_Drawing_Image_Info* dstInfo, void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY )
7601```
7602
7603**描述**
7604
7605将位图中的矩形区域像素数据读取到指定的内存缓冲区中。
7606
7607本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7608
7609OH_Drawing_Bitmap、dstInfo、dstPixels任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7610
7611**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7612
7613**起始版本:** 12
7614
7615**参数:**
7616
7617| 名称 | 描述 |
7618| -------- | -------- |
7619| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
7620| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
7621| dstPixels | 目标像素存储区域。 |
7622| dstRowBytes | 目标像素数据每行的字节数,应大于或等于图片信息对象中的最小每行字节数。 |
7623| srcX | 源位图中读取像素数据的起始x轴坐标,应小于源位图的宽度。 |
7624| srcY | 源位图中读取像素数据的起始y轴坐标,应小于源位图的高度。 |
7625
7626**返回:**
7627
7628返回接口调用成功与否的结果。true表示复制成功,false表示复制失败。
7629
7630
7631### OH_Drawing_BrushCreate()
7632
7633```
7634OH_Drawing_Brush* OH_Drawing_BrushCreate (void )
7635```
7636
7637**描述**
7638
7639用于创建一个画刷对象。
7640
7641**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7642
7643**起始版本:** 8
7644
7645**返回:**
7646
7647函数会返回一个指针,指针指向创建的画刷对象。
7648
7649
7650### OH_Drawing_BrushDestroy()
7651
7652```
7653void OH_Drawing_BrushDestroy (OH_Drawing_Brush* )
7654```
7655
7656**描述**
7657
7658用于销毁画刷对象并回收该对象占有的内存。
7659
7660**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7661
7662**起始版本:** 8
7663
7664**参数:**
7665
7666| 名称 | 描述 |
7667| -------- | -------- |
7668| OH_Drawing_Brush | 指向画刷对象的指针。 |
7669
7670
7671### OH_Drawing_BrushGetAlpha()
7672
7673```
7674uint8_t OH_Drawing_BrushGetAlpha (const OH_Drawing_Brush* )
7675```
7676
7677**描述**
7678
7679获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。
7680
7681本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7682
7683OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7684
7685**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7686
7687**起始版本:** 11
7688
7689**参数:**
7690
7691| 名称 | 描述 |
7692| -------- | -------- |
7693| OH_Drawing_Brush | 表示指向画刷对象的指针。 |
7694
7695**返回:**
7696
7697返回一个8位变量,用于表示透明度值。
7698
7699
7700### OH_Drawing_BrushGetColor()
7701
7702```
7703uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush* )
7704```
7705
7706**描述**
7707
7708用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。
7709
7710本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7711
7712OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7713
7714**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7715
7716**起始版本:** 8
7717
7718**参数:**
7719
7720| 名称 | 描述 |
7721| -------- | -------- |
7722| OH_Drawing_Brush | 指向画刷对象的指针。 |
7723
7724**返回:**
7725
7726函数返回一个描述颜色的32位(ARGB)变量。
7727
7728
7729### OH_Drawing_BrushGetFilter()
7730
7731```
7732void OH_Drawing_BrushGetFilter (OH_Drawing_Brush* , OH_Drawing_Filter*  )
7733```
7734
7735**描述**
7736
7737从画刷获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。
7738
7739本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7740
7741OH_Drawing_Brush、OH_Drawing_Filter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7742
7743**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7744
7745**起始版本:** 12
7746
7747**参数:**
7748
7749| 名称 | 描述 |
7750| -------- | -------- |
7751| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 |
7752| OH_Drawing_Filter | 表示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 |
7753
7754
7755### OH_Drawing_BrushIsAntiAlias()
7756
7757```
7758bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush* )
7759```
7760
7761**描述**
7762
7763用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
7764
7765本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7766
7767OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7768
7769**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7770
7771**起始版本:** 8
7772
7773**参数:**
7774
7775| 名称 | 描述 |
7776| -------- | -------- |
7777| OH_Drawing_Brush | 指向画刷对象的指针。 |
7778
7779**返回:**
7780
7781函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。
7782
7783
7784### OH_Drawing_BrushReset()
7785
7786```
7787void OH_Drawing_BrushReset (OH_Drawing_Brush* )
7788```
7789
7790**描述**
7791
7792将画刷重置至初始状态,清空所有已设置的属性。
7793
7794本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7795
7796OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7797
7798**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7799
7800**起始版本:** 12
7801
7802**参数:**
7803
7804| 名称 | 描述 |
7805| -------- | -------- |
7806| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 |
7807
7808
7809### OH_Drawing_BrushSetAlpha()
7810
7811```
7812void OH_Drawing_BrushSetAlpha (OH_Drawing_Brush* , uint8_t alpha )
7813```
7814
7815**描述**
7816
7817为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。
7818
7819本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7820
7821OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7822
7823**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7824
7825**起始版本:** 11
7826
7827**参数:**
7828
7829| 名称 | 描述 |
7830| -------- | -------- |
7831| OH_Drawing_Brush | 指向画刷对象的指针。 |
7832| alpha | 表示要设置的透明度值,是一个8位变量。 |
7833
7834
7835### OH_Drawing_BrushSetAntiAlias()
7836
7837```
7838void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush* , bool  )
7839```
7840
7841**描述**
7842
7843用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
7844
7845本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7846
7847OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7848
7849**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7850
7851**起始版本:** 8
7852
7853**参数:**
7854
7855| 名称 | 描述 |
7856| -------- | -------- |
7857| OH_Drawing_Brush | 指向画刷对象的指针。 |
7858| bool | 真为抗锯齿,假则不做抗锯齿处理。 |
7859
7860
7861### OH_Drawing_BrushSetBlendMode()
7862
7863```
7864void OH_Drawing_BrushSetBlendMode (OH_Drawing_Brush* , OH_Drawing_BlendMode  )
7865```
7866
7867**描述**
7868
7869为画刷设置一个混合器,该混合器实现了指定的混合模式枚举。
7870
7871本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7872
7873OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
7874
7875OH_Drawing_BlendMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
7876
7877**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7878
7879**起始版本:** 12
7880
7881**参数:**
7882
7883| 名称 | 描述 |
7884| -------- | -------- |
7885| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 |
7886| OH_Drawing_BlendMode | 混合模式枚举类型[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 |
7887
7888
7889### OH_Drawing_BrushSetColor()
7890
7891```
7892void OH_Drawing_BrushSetColor (OH_Drawing_Brush* , uint32_t color )
7893```
7894
7895**描述**
7896
7897用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。
7898
7899本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7900
7901OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7902
7903**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7904
7905**起始版本:** 8
7906
7907**参数:**
7908
7909| 名称 | 描述 |
7910| -------- | -------- |
7911| OH_Drawing_Brush | 指向画刷对象的指针。 |
7912| color | 描述颜色的32位(ARGB)变量。 |
7913
7914
7915### OH_Drawing_BrushSetFilter()
7916
7917```
7918void OH_Drawing_BrushSetFilter (OH_Drawing_Brush* , OH_Drawing_Filter*  )
7919```
7920
7921**描述**
7922
7923为画刷设置滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。
7924
7925本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7926
7927OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7928
7929**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7930
7931**起始版本:** 11
7932
7933**参数:**
7934
7935| 名称 | 描述 |
7936| -------- | -------- |
7937| OH_Drawing_Brush | 指向画刷对象的指针。 |
7938| OH_Drawing_Filter | 表示指向滤波器对象的指针,为NULL表示清空画刷滤波器。 |
7939
7940
7941### OH_Drawing_BrushSetShaderEffect()
7942
7943```
7944void OH_Drawing_BrushSetShaderEffect (OH_Drawing_Brush* , OH_Drawing_ShaderEffect*  )
7945```
7946
7947**描述**
7948
7949为画刷设置着色器效果。
7950
7951本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7952
7953OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7954
7955**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7956
7957**起始版本:** 11
7958
7959**参数:**
7960
7961| 名称 | 描述 |
7962| -------- | -------- |
7963| OH_Drawing_Brush | 指向画刷对象的指针。 |
7964| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针,为NULL表示清空画刷的着色器效果。 |
7965
7966
7967### OH_Drawing_CanvasAttachBrush()
7968
7969```
7970void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas* , const OH_Drawing_Brush*  )
7971```
7972
7973**描述**
7974
7975用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。执行该方法后,若画刷的效果发生改变并且开发者希望该变化生效于接下来的绘制动作,需要再次执行该方法以确保变化生效。
7976
7977本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
7978
7979OH_Drawing_Canvas、OH_Drawing_Brush任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
7980
7981**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
7982
7983**起始版本:** 8
7984
7985**参数:**
7986
7987| 名称 | 描述 |
7988| -------- | -------- |
7989| OH_Drawing_Canvas | 指向画布对象的指针。 |
7990| OH_Drawing_Brush | 指向画刷对象的指针。 |
7991
7992
7993### OH_Drawing_CanvasAttachPen()
7994
7995```
7996void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas* , const OH_Drawing_Pen*  )
7997```
7998
7999**描述**
8000
8001用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。执行该方法后,若画笔的效果发生改变并且开发者希望该变化生效于接下来的绘制动作,需要再次执行该方法以确保变化生效。
8002
8003本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8004
8005OH_Drawing_Canvas、OH_Drawing_Pen任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8006
8007**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8008
8009**起始版本:** 8
8010
8011**参数:**
8012
8013| 名称 | 描述 |
8014| -------- | -------- |
8015| OH_Drawing_Canvas | 指向画布对象的指针。 |
8016| OH_Drawing_Pen | 指向画笔对象的指针。 |
8017
8018
8019### OH_Drawing_CanvasBind()
8020
8021```
8022void OH_Drawing_CanvasBind (OH_Drawing_Canvas* , OH_Drawing_Bitmap*  )
8023```
8024
8025**描述**
8026
8027用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。绑定位图对象后的画布为非录制类型画布。
8028
8029本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8030
8031OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8032
8033**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8034
8035**起始版本:** 8
8036
8037**参数:**
8038
8039| 名称 | 描述 |
8040| -------- | -------- |
8041| OH_Drawing_Canvas | 指向画布对象的指针。 |
8042| OH_Drawing_Bitmap | 指向位图对象的指针。 |
8043
8044
8045### OH_Drawing_CanvasClear()
8046
8047```
8048void OH_Drawing_CanvasClear (OH_Drawing_Canvas* , uint32_t color )
8049```
8050
8051**描述**
8052
8053用于使用指定颜色去清空画布。
8054
8055本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8056
8057OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8058
8059**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8060
8061**起始版本:** 8
8062
8063**参数:**
8064
8065| 名称 | 描述 |
8066| -------- | -------- |
8067| OH_Drawing_Canvas | 指向画布对象的指针。 |
8068| color | 描述颜色的32位(ARGB)变量。 |
8069
8070
8071### OH_Drawing_CanvasClipPath()
8072
8073```
8074void OH_Drawing_CanvasClipPath (OH_Drawing_Canvas* , const OH_Drawing_Path* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
8075```
8076
8077**描述**
8078
8079用于裁剪一个自定义路径。
8080
8081本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8082
8083OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
8084
8085clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
8086
8087**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8088
8089**起始版本:** 11
8090
8091**参数:**
8092
8093| 名称 | 描述 |
8094| -------- | -------- |
8095| OH_Drawing_Canvas | 指向画布对象的指针。 |
8096| OH_Drawing_Path | 指向路径对象的指针。 |
8097| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 |
8098| doAntiAlias | 真为抗锯齿,假则不做抗锯齿处理。 |
8099
8100
8101### OH_Drawing_CanvasClipRect()
8102
8103```
8104void OH_Drawing_CanvasClipRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
8105```
8106
8107**描述**
8108
8109用于裁剪一个矩形。
8110
8111本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8112
8113OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
8114
8115clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
8116
8117**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8118
8119**起始版本:** 11
8120
8121**参数:**
8122
8123| 名称 | 描述 |
8124| -------- | -------- |
8125| OH_Drawing_Canvas | 指向画布对象的指针。 |
8126| OH_Drawing_Rect | 指向矩形对象的指针。 |
8127| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 |
8128| doAntiAlias | 值为true则做抗锯齿处理,反之不做。 |
8129
8130### OH_Drawing_CanvasClipRoundRect()
8131
8132```
8133void OH_Drawing_CanvasClipRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
8134```
8135
8136**描述**
8137
8138用于裁剪一个圆角矩形。
8139
8140本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8141
8142OH_Drawing_Canvas、OH_Drawing_RoundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
8143
8144clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
8145
8146**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8147
8148**起始版本:** 12
8149
8150**参数:**
8151
8152| 名称 | 描述 |
8153| -------- | -------- |
8154| OH_Drawing_Canvas | 指向画布对象的指针。 |
8155| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
8156| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 |
8157| doAntiAlias | 表示是否需要做抗锯齿处理,值为true时为需要,为false时为不需要。 |
8158
8159### OH_Drawing_CanvasConcatMatrix()
8160
8161```
8162void OH_Drawing_CanvasConcatMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
8163```
8164
8165**描述**
8166
8167画布现有矩阵左乘以传入矩阵,不影响该接口之前的绘制操作。
8168
8169本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8170
8171OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8172
8173**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8174
8175**起始版本:** 12
8176
8177**参数:**
8178
8179| 名称 | 描述 |
8180| -------- | -------- |
8181| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8182| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
8183
8184
8185### OH_Drawing_CanvasCreate()
8186
8187```
8188OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void )
8189```
8190
8191**描述**
8192
8193用于创建一个画布对象。
8194
8195**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8196
8197**起始版本:** 8
8198
8199**返回:**
8200
8201函数会返回一个指针,指针指向创建的画布对象。
8202
8203
8204### OH_Drawing_CanvasDestroy()
8205
8206```
8207void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas* )
8208```
8209
8210**描述**
8211
8212用于销毁画布对象并回收该对象占有的内存。
8213
8214**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8215
8216**起始版本:** 8
8217
8218**参数:**
8219
8220| 名称 | 描述 |
8221| -------- | -------- |
8222| OH_Drawing_Canvas | 指向画布对象的指针。 |
8223
8224
8225### OH_Drawing_CanvasDetachBrush()
8226
8227```
8228void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas* )
8229```
8230
8231**描述**
8232
8233用于去除掉画布中的画刷,使用后画布将不使用此前设置的画刷去填充图形形状。
8234
8235本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8236
8237OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8238
8239**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8240
8241**起始版本:** 8
8242
8243**参数:**
8244
8245| 名称 | 描述 |
8246| -------- | -------- |
8247| OH_Drawing_Canvas | 指向画布对象的指针。 |
8248
8249
8250### OH_Drawing_CanvasDetachPen()
8251
8252```
8253void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas* )
8254```
8255
8256**描述**
8257
8258用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。
8259
8260本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8261
8262OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8263
8264**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8265
8266**起始版本:** 8
8267
8268**参数:**
8269
8270| 名称 | 描述 |
8271| -------- | -------- |
8272| OH_Drawing_Canvas | 指向画布对象的指针。 |
8273
8274
8275### OH_Drawing_CanvasDrawArc()
8276
8277```
8278void OH_Drawing_CanvasDrawArc (OH_Drawing_Canvas* , const OH_Drawing_Rect* , float startAngle, float sweepAngle )
8279```
8280
8281**描述**
8282
8283用于画一个弧。当扫描角度的绝对值大于360度时,本接口绘制的是一个椭圆。
8284
8285本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8286
8287OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8288
8289**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8290
8291**起始版本:** 11
8292
8293**参数:**
8294
8295| 名称 | 描述 |
8296| -------- | -------- |
8297| OH_Drawing_Canvas | 指向画布对象的指针。 |
8298| OH_Drawing_Rect | 指向矩形对象的指针。 |
8299| startAngle | 弧的起始角度,0度时起始点位于椭圆的右端点,正数时以顺时针方向放置起始点,负数时以逆时针方向放置起始点。 |
8300| sweepAngle | 弧的扫描角度,正数时顺时针扫描,负数时逆时针扫描。它的有效范围在-360度到360度之间,当绝对值大于360度时,该函数绘制的是一个椭圆。 |
8301
8302
8303### OH_Drawing_CanvasDrawBackground()
8304
8305```
8306void OH_Drawing_CanvasDrawBackground (OH_Drawing_Canvas* , const OH_Drawing_Brush*  )
8307```
8308
8309**描述**
8310
8311用于画一个背景,此背景以画刷填充。
8312
8313本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8314
8315OH_Drawing_Canvas、OH_Drawing_Brush任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8316
8317**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8318
8319**起始版本:** 12
8320
8321**参数:**
8322
8323| 名称 | 描述 |
8324| -------- | -------- |
8325| OH_Drawing_Canvas | 指向画布对象的指针。 |
8326| OH_Drawing_Brush | 指向画刷对象的指针。 |
8327
8328
8329### OH_Drawing_CanvasDrawBitmap()
8330
8331```
8332void OH_Drawing_CanvasDrawBitmap (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , float left, float top )
8333```
8334
8335**描述**
8336
8337用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。
8338
8339本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8340
8341OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8342
8343**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8344
8345**起始版本:** 11
8346
8347**参数:**
8348
8349| 名称 | 描述 |
8350| -------- | -------- |
8351| OH_Drawing_Canvas | 指向画布对象的指针。 |
8352| OH_Drawing_Bitmap | 指向位图对象的指针。 |
8353| left | 位图对象左上角的横坐标。 |
8354| top | 位图对象左上角的纵坐标。 |
8355
8356
8357### OH_Drawing_CanvasDrawBitmapRect()
8358
8359```
8360void OH_Drawing_CanvasDrawBitmapRect (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*  )
8361```
8362
8363**描述**
8364
8365将位图的指定区域绘制到画布的指定区域。
8366
8367本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8368
8369OH_Drawing_Canvas、OH_Drawing_Bitmap、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8370
8371**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8372
8373**起始版本:** 12
8374
8375**参数:**
8376
8377| 名称 | 描述 |
8378| -------- | -------- |
8379| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8380| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
8381| src | 源位图指定矩形区域,为NULL将指定整个源位图区域。 |
8382| dst | 目标画布指定矩形区域。 |
8383| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 |
8384
8385
8386### OH_Drawing_CanvasDrawCircle()
8387
8388```
8389void OH_Drawing_CanvasDrawCircle (OH_Drawing_Canvas* , const OH_Drawing_Point* , float radius )
8390```
8391
8392**描述**
8393
8394用于画一个圆形。
8395
8396本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8397
8398OH_Drawing_Canvas、OH_Drawing_Point任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
8399
8400radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
8401
8402**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8403
8404**起始版本:** 11
8405
8406**参数:**
8407
8408| 名称 | 描述 |
8409| -------- | -------- |
8410| OH_Drawing_Canvas | 指向画布对象的指针。 |
8411| OH_Drawing_Point | 指向坐标点对象的指针,表示圆心。 |
8412| radius | 圆形的半径,小于等于0时无效。 |
8413
8414
8415### OH_Drawing_CanvasDrawImageRect()
8416
8417```
8418void OH_Drawing_CanvasDrawImageRect (OH_Drawing_Canvas* , OH_Drawing_Image* , OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*  )
8419```
8420
8421**描述**
8422
8423将图片绘制到画布的指定区域上。
8424
8425本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8426
8427OH_Drawing_Canvas、OH_Drawing_Image、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8428
8429**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8430
8431**起始版本:** 12
8432
8433**参数:**
8434
8435| 名称 | 描述 |
8436| -------- | -------- |
8437| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8438| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
8439| dst | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
8440| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 |
8441
8442
8443### OH_Drawing_CanvasDrawImageRectWithSrc()
8444
8445```
8446void 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  )
8447```
8448
8449**描述**
8450
8451将图片绘制到画布的指定区域上,源矩形选定的区域会缩放平移到目标矩形。
8452
8453本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8454
8455OH_Drawing_Canvas、OH_Drawing_Image、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8456
8457**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8458
8459**起始版本:** 12
8460
8461**参数:**
8462
8463| 名称 | 描述 |
8464| -------- | -------- |
8465| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8466| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
8467| src | 指向源矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
8468| dst | 指向目标矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
8469| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 |
8470| OH_Drawing_SrcRectConstraint | 约束类型,支持可选的具体类型可见[OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1)枚举。 |
8471
8472
8473### OH_Drawing_CanvasDrawLine()
8474
8475```
8476void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas* , float x1, float y1, float x2, float y2 )
8477```
8478
8479**描述**
8480
8481用于画一条直线段。
8482
8483本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8484
8485OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8486
8487**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8488
8489**起始版本:** 8
8490
8491**参数:**
8492
8493| 名称 | 描述 |
8494| -------- | -------- |
8495| OH_Drawing_Canvas | 指向画布对象的指针。 |
8496| x1 | 线段起始点的横坐标。 |
8497| y1 | 线段起始点的纵坐标。 |
8498| x2 | 线段结束点的横坐标。 |
8499| y2 | 线段结束点的纵坐标。 |
8500
8501
8502### OH_Drawing_CanvasDrawOval()
8503
8504```
8505void OH_Drawing_CanvasDrawOval (OH_Drawing_Canvas* , const OH_Drawing_Rect*  )
8506```
8507
8508**描述**
8509
8510用于画一个椭圆。
8511
8512本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8513
8514OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8515
8516**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8517
8518**起始版本:** 11
8519
8520**参数:**
8521
8522| 名称 | 描述 |
8523| -------- | -------- |
8524| OH_Drawing_Canvas | 指向画布对象的指针。 |
8525| OH_Drawing_Rect | 指向矩形对象的指针。 |
8526
8527
8528### OH_Drawing_CanvasDrawPath()
8529
8530```
8531void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas* , const OH_Drawing_Path*  )
8532```
8533
8534**描述**
8535
8536用于画一个自定义路径。
8537
8538本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8539
8540OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8541
8542**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8543
8544**起始版本:** 8
8545
8546**参数:**
8547
8548| 名称 | 描述 |
8549| -------- | -------- |
8550| OH_Drawing_Canvas | 指向画布对象的指针。 |
8551| OH_Drawing_Path | 指向路径对象的指针。 |
8552
8553
8554### OH_Drawing_CanvasDrawPixelMapRect()
8555
8556```
8557void OH_Drawing_CanvasDrawPixelMapRect (OH_Drawing_Canvas* , OH_Drawing_PixelMap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*  )
8558```
8559
8560**描述**
8561
8562用于将像素图的指定区域绘制到画布的指定区域。
8563
8564本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8565
8566OH_Drawing_Canvas、OH_Drawing_PixelMap、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8567
8568**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8569
8570**起始版本:** 12
8571
8572**参数:**
8573
8574| 名称 | 描述 |
8575| -------- | -------- |
8576| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8577| OH_Drawing_PixelMap | 指向像素图[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。 |
8578| src | 像素图指定矩形区域,为NULL将指定整个像素图区域。 |
8579| dst | 目标画布指定矩形区域。 |
8580| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 |
8581
8582
8583### OH_Drawing_CanvasDrawPoints()
8584
8585```
8586void OH_Drawing_CanvasDrawPoints (OH_Drawing_Canvas* , OH_Drawing_PointMode mode, uint32_t count, const OH_Drawing_Point2D*  )
8587```
8588
8589**描述**
8590
8591用于画多个点,绘制方式分为绘制单独的点、绘制成线段或绘制成开放多边形。
8592
8593本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8594
8595OH_Drawing_Canvas、OH_Drawing_Point2D任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
8596
8597mode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
8598
8599**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8600
8601**起始版本:** 12
8602
8603**参数:**
8604
8605| 名称 | 描述 |
8606| -------- | -------- |
8607| OH_Drawing_Canvas | 指向画布对象的指针。 |
8608| mode | 绘制多个点的方式,支持方式参考[OH_Drawing_PointMode](#oh_drawing_pointmode)。 |
8609| count | 点的数量,即点数组中点的个数。 |
8610| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 指向多个点的数组。 |
8611
8612
8613### OH_Drawing_CanvasDrawRect()
8614
8615```
8616void OH_Drawing_CanvasDrawRect (OH_Drawing_Canvas* , const OH_Drawing_Rect*  )
8617```
8618
8619**描述**
8620
8621用于画一个矩形。
8622
8623本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8624
8625OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8626
8627**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8628
8629**起始版本:** 11
8630
8631**参数:**
8632
8633| 名称 | 描述 |
8634| -------- | -------- |
8635| OH_Drawing_Canvas | 指向画布对象的指针。 |
8636| OH_Drawing_Rect | 指向矩形对象的指针。 |
8637
8638
8639### OH_Drawing_CanvasDrawRegion()
8640
8641```
8642void OH_Drawing_CanvasDrawRegion (OH_Drawing_Canvas* , const OH_Drawing_Region*  )
8643```
8644
8645**描述**
8646
8647用于画一块区域。
8648
8649本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8650
8651OH_Drawing_Canvas、OH_Drawing_Region任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8652
8653**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8654
8655**起始版本:** 12
8656
8657**参数:**
8658
8659| 名称 | 描述 |
8660| -------- | -------- |
8661| OH_Drawing_Canvas | 指向画布对象的指针。 |
8662| OH_Drawing_Region | 指向区域对象的指针。 |
8663
8664
8665### OH_Drawing_CanvasDrawRoundRect()
8666
8667```
8668void OH_Drawing_CanvasDrawRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect*  )
8669```
8670
8671**描述**
8672
8673用于画一个圆角矩形。
8674
8675本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8676
8677OH_Drawing_Canvas、OH_Drawing_RoundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8678
8679**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8680
8681**起始版本:** 11
8682
8683**参数:**
8684
8685| 名称 | 描述 |
8686| -------- | -------- |
8687| OH_Drawing_Canvas | 指向画布对象的指针。 |
8688| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
8689
8690
8691### OH_Drawing_CanvasDrawShadow()
8692
8693```
8694void 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 )
8695```
8696
8697**描述**
8698
8699绘制射灯类型阴影,使用路径描述环境光阴影的轮廓。
8700
8701本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8702
8703OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
8704
8705flag不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
8706
8707**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8708
8709**起始版本:** 12
8710
8711**参数:**
8712
8713| 名称 | 描述 |
8714| -------- | -------- |
8715| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8716| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,用于生成阴影。 |
8717| planeParams | 表示遮挡物相对于画布在Z轴上的偏移量,其值取决于x与y坐标。 |
8718| devLightPos | 光线相对于画布的位置。 |
8719| lightRadius | 光源半径,需大于或等于0。 |
8720| ambientColor | 环境阴影颜色,是一个32位(ARGB)变量。 |
8721| spotColor | 点阴影颜色,是一个32位(ARGB)变量。 |
8722| flag | 阴影标志枚举[OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags)。 |
8723
8724
8725### OH_Drawing_CanvasDrawTextBlob()
8726
8727```
8728void OH_Drawing_CanvasDrawTextBlob (OH_Drawing_Canvas* , const OH_Drawing_TextBlob* , float x, float y )
8729```
8730
8731**描述**
8732
8733用于画一段文字。若构造OH_Drawing_TextBlob的字体不支持待绘制字符,则该部分字符无法绘制。
8734
8735本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8736
8737OH_Drawing_Canvas、OH_Drawing_TextBlob任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8738
8739**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8740
8741**起始版本:** 11
8742
8743**参数:**
8744
8745| 名称 | 描述 |
8746| -------- | -------- |
8747| OH_Drawing_Canvas | 指向画布对象的指针。 |
8748| OH_Drawing_TextBlob | 指向文本对象的指针。 |
8749| x | 文本对象左下角的横坐标。 |
8750| y | 文本对象左下角的纵坐标。 |
8751
8752
8753### OH_Drawing_CanvasDrawVertices()
8754
8755```
8756void 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 )
8757```
8758
8759**描述**
8760
8761用于画顶点数组描述的三角网格。
8762
8763本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8764
8765OH_Drawing_Canvas或positions为NULL、vertexCount值小于3、indexCount值小于3且不为0,存在以上任意一种情况时设置错误码为OH_DRAWING_ERROR_INVALID_PARAMETER;
8766
8767vertexMmode、mode任意一个不在枚举范围内时设置错误码为OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
8768
8769**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8770
8771**起始版本:** 12
8772
8773**参数:**
8774
8775| 名称 | 描述 |
8776| -------- | -------- |
8777| OH_Drawing_Canvas | 指向画布对象的指针。 |
8778| vertexMmode | 绘制顶点的连接方式,支持方式参考[OH_Drawing_VertexMode](#oh_drawing_vertexmode)。 |
8779| vertexCount | 顶点数组元素的数量,值必须大于等于3。 |
8780| positions | 描述顶点位置的数组指针,不能为空,其长度必须等于vertexCount。 |
8781| texs | 描述顶点对应纹理空间坐标的数组指针,可以为空,若不为空其长度必须等于vertexCount。 |
8782| colors | 描述顶点对应颜色的数组指针,用于在三角形中进行插值,可以为空,若不为空其长度必须等于vertexCount。 |
8783| indexCount | 索引的数量,可以为0,若不为0则值必须大于等于3。 |
8784| indices | 描述顶点对应索引的数组指针,可以为空,若不为空其长度必须等于indexCount。 |
8785| mode | 混合模式枚举,支持方式参考[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 |
8786
8787
8788### OH_Drawing_CanvasGetHeight()
8789
8790```
8791int32_t OH_Drawing_CanvasGetHeight (OH_Drawing_Canvas* )
8792```
8793
8794**描述**
8795
8796获取画布高度。
8797
8798本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8799
8800OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8801
8802**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8803
8804**起始版本:** 12
8805
8806**参数:**
8807
8808| 名称 | 描述 |
8809| -------- | -------- |
8810| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8811
8812**返回:**
8813
8814函数返回画布高度,单位为像素。
8815
8816
8817### OH_Drawing_CanvasGetLocalClipBounds()
8818
8819```
8820void OH_Drawing_CanvasGetLocalClipBounds (OH_Drawing_Canvas* , OH_Drawing_Rect*  )
8821```
8822
8823**描述**
8824
8825获取画布裁剪区域的边界。该接口不可用于录制类型画布。
8826
8827本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8828
8829OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8830
8831**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8832
8833**起始版本:** 12
8834
8835**参数:**
8836
8837| 名称 | 描述 |
8838| -------- | -------- |
8839| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8840| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针, 开发者可调用[OH_Drawing_RectCreate](#oh_drawing_rectcreate)接口创建。 |
8841
8842
8843### OH_Drawing_CanvasGetSaveCount()
8844
8845```
8846uint32_t OH_Drawing_CanvasGetSaveCount (OH_Drawing_Canvas* )
8847```
8848
8849**描述**
8850
8851用于获取栈中保存的画布状态(画布矩阵)的数量。
8852
8853本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8854
8855OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8856
8857**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8858
8859**起始版本:** 11
8860
8861**参数:**
8862
8863| 名称 | 描述 |
8864| -------- | -------- |
8865| OH_Drawing_Canvas | 指向画布对象的指针。 |
8866
8867**返回:**
8868
8869函数会返回一个32位的值描述画布状态(画布矩阵)的数量,画布初始状态数量为1。
8870
8871
8872### OH_Drawing_CanvasGetTotalMatrix()
8873
8874```
8875void OH_Drawing_CanvasGetTotalMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
8876```
8877
8878**描述**
8879
8880获取画布3x3矩阵。
8881
8882本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8883
8884OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8885
8886**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8887
8888**起始版本:** 12
8889
8890**参数:**
8891
8892| 名称 | 描述 |
8893| -------- | -------- |
8894| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8895| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 |
8896
8897
8898### OH_Drawing_CanvasGetWidth()
8899
8900```
8901int32_t OH_Drawing_CanvasGetWidth (OH_Drawing_Canvas* )
8902```
8903
8904**描述**
8905
8906获取画布宽度。
8907
8908本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8909
8910OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8911
8912**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8913
8914**起始版本:** 12
8915
8916**参数:**
8917
8918| 名称 | 描述 |
8919| -------- | -------- |
8920| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8921
8922**返回:**
8923
8924函数返回画布宽度,单位为像素。
8925
8926
8927### OH_Drawing_CanvasReadPixels()
8928
8929```
8930bool OH_Drawing_CanvasReadPixels (OH_Drawing_Canvas* , OH_Drawing_Image_Info* , void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY )
8931```
8932
8933**描述**
8934
8935从画布中拷贝像素数据到指定地址。该接口不可用于录制类型画布。
8936
8937本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8938
8939OH_Drawing_Canvas、OH_Drawing_Image_Info、dstPixels任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8940
8941**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8942
8943**起始版本:** 12
8944
8945**参数:**
8946
8947| 名称 | 描述 |
8948| -------- | -------- |
8949| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8950| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 指向图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 |
8951| dstPixels | 目标像素存储首地址。 |
8952| dstRowBytes | 一行像素的大小,小于等于0时无效。 |
8953| srcX | 画布像素的x轴偏移量,单位为像素。 |
8954| srcY | 画布像素的y轴偏移量,单位为像素。 |
8955
8956**返回:**
8957
8958函数返回true表示像素成功拷贝到目标像素存储首地址,函数返回false表示拷贝失败。
8959
8960
8961### OH_Drawing_CanvasReadPixelsToBitmap()
8962
8963```
8964bool OH_Drawing_CanvasReadPixelsToBitmap (OH_Drawing_Canvas* , OH_Drawing_Bitmap* , int32_t srcX, int32_t srcY )
8965```
8966
8967**描述**
8968
8969从画布拷贝像素数据到位图中。该接口不可用于录制类型画布。
8970
8971本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
8972
8973OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
8974
8975**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
8976
8977**起始版本:** 12
8978
8979**参数:**
8980
8981| 名称 | 描述 |
8982| -------- | -------- |
8983| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
8984| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
8985| srcX | 画布像素的x轴偏移量,单位为像素。 |
8986| srcY | 画布像素的y轴偏移量,单位为像素。 |
8987
8988**返回:**
8989
8990函数返回true表示像素成功拷贝到位图,函数返回false表示拷贝失败。
8991
8992
8993### OH_Drawing_CanvasResetMatrix()
8994
8995```
8996void OH_Drawing_CanvasResetMatrix (OH_Drawing_Canvas* )
8997```
8998
8999**描述**
9000
9001重置当前画布的矩阵为单位矩阵。
9002
9003本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9004
9005OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9006
9007**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9008
9009**起始版本:** 12
9010
9011**参数:**
9012
9013| 名称 | 描述 |
9014| -------- | -------- |
9015| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
9016
9017
9018### OH_Drawing_CanvasRestore()
9019
9020```
9021void OH_Drawing_CanvasRestore (OH_Drawing_Canvas* )
9022```
9023
9024**描述**
9025
9026用于恢复保存在栈顶的画布状态(画布矩阵)。
9027
9028本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9029
9030OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9031
9032**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9033
9034**起始版本:** 8
9035
9036**参数:**
9037
9038| 名称 | 描述 |
9039| -------- | -------- |
9040| OH_Drawing_Canvas | 指向画布对象的指针。 |
9041
9042
9043### OH_Drawing_CanvasRestoreToCount()
9044
9045```
9046void OH_Drawing_CanvasRestoreToCount (OH_Drawing_Canvas* , uint32_t saveCount )
9047```
9048
9049**描述**
9050
9051用于恢复到指定数量的画布状态(画布矩阵)。
9052
9053本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9054
9055OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9056
9057**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9058
9059**起始版本:** 11
9060
9061**参数:**
9062
9063| 名称 | 描述 |
9064| -------- | -------- |
9065| OH_Drawing_Canvas | 指向画布对象的指针。 |
9066| saveCount | 要恢复的画布状态深度。小于等于1时,恢复为初始状态;大于已保存的画布状态数量时,不执行任何操作。 |
9067
9068
9069### OH_Drawing_CanvasRotate()
9070
9071```
9072void OH_Drawing_CanvasRotate (OH_Drawing_Canvas* , float degrees, float px, float py )
9073```
9074
9075**描述**
9076
9077用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。
9078
9079本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9080
9081OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9082
9083**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9084
9085**起始版本:** 11
9086
9087**参数:**
9088
9089| 名称 | 描述 |
9090| -------- | -------- |
9091| OH_Drawing_Canvas | 指向画布对象的指针。 |
9092| degrees | 旋转角度。 |
9093| px | 旋转中心的横坐标。 |
9094| py | 旋转中心的纵坐标。 |
9095
9096
9097### OH_Drawing_CanvasSave()
9098
9099```
9100void OH_Drawing_CanvasSave (OH_Drawing_Canvas* )
9101```
9102
9103**描述**
9104
9105用于保存当前画布的状态(画布矩阵)到一个栈顶。需要与恢复接口 [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)配合使用。
9106
9107本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9108
9109OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9110
9111**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9112
9113**起始版本:** 8
9114
9115**参数:**
9116
9117| 名称 | 描述 |
9118| -------- | -------- |
9119| OH_Drawing_Canvas | 指向画布对象的指针。 |
9120
9121
9122### OH_Drawing_CanvasSaveLayer()
9123
9124```
9125void OH_Drawing_CanvasSaveLayer (OH_Drawing_Canvas* , const OH_Drawing_Rect* , const OH_Drawing_Brush*  )
9126```
9127
9128**描述**
9129
9130保存矩阵和裁剪区域,为后续绘制分配位图。调用恢复接口 [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)将放弃对矩阵和剪切区域所做的更改,并绘制位图。
9131
9132本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9133
9134OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9135
9136**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9137
9138**起始版本:** 12
9139
9140**参数:**
9141
9142| 名称 | 描述 |
9143| -------- | -------- |
9144| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
9145| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,用于限制图层大小,为NULL表示无限制。 |
9146| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针,绘制位图时会应用画刷对象的透明度,滤波器效果,混合模式,为NULL表示不应用任何效果。 |
9147
9148
9149### OH_Drawing_CanvasScale()
9150
9151```
9152void OH_Drawing_CanvasScale (OH_Drawing_Canvas* , float sx, float sy )
9153```
9154
9155**描述**
9156
9157用于画布缩放。
9158
9159本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9160
9161OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9162
9163**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9164
9165**起始版本:** 11
9166
9167**参数:**
9168
9169| 名称 | 描述 |
9170| -------- | -------- |
9171| OH_Drawing_Canvas | 指向画布对象的指针。 |
9172| sx | x轴方向的缩放比例。 |
9173| sy | y轴方向的缩放比例。 |
9174
9175
9176### OH_Drawing_CanvasSetMatrix()
9177
9178```
9179void OH_Drawing_CanvasSetMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
9180```
9181
9182**描述**
9183
9184设置画布的矩阵状态。
9185
9186本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9187
9188OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9189
9190**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9191
9192**起始版本:** 12
9193
9194**参数:**
9195
9196| 名称 | 描述 |
9197| -------- | -------- |
9198| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 |
9199| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 |
9200
9201
9202### OH_Drawing_CanvasSkew()
9203
9204```
9205void OH_Drawing_CanvasSkew (OH_Drawing_Canvas* , float sx, float sy )
9206```
9207
9208**描述**
9209
9210用于画布倾斜变换。等同于将当前画布矩阵左乘(premultiply)倾斜变换矩阵,并应用到画布上。其中倾斜变换矩阵为:\|1 sx 0\| \|sy 1 0\| \|0 0 1\|。
9211
9212本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9213
9214OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9215
9216**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9217
9218**起始版本:** 12
9219
9220**参数:**
9221
9222| 名称 | 描述 |
9223| -------- | -------- |
9224| OH_Drawing_Canvas | 指向画布对象的指针。 |
9225| sx | 沿x轴的倾斜量。正值会使绘制沿y轴增量方向向右倾斜;负值会使绘制沿y轴增量方向向左倾斜。 |
9226| sy | 沿y轴的倾斜量。正值会使绘制沿x轴增量方向向下倾斜;负值会使绘制沿x轴增量方向向上倾斜。 |
9227
9228
9229### OH_Drawing_CanvasTranslate()
9230
9231```
9232void OH_Drawing_CanvasTranslate (OH_Drawing_Canvas* , float dx, float dy )
9233```
9234
9235**描述**
9236
9237用于平移画布一段距离。
9238
9239本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9240
9241OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9242
9243**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9244
9245**起始版本:** 11
9246
9247**参数:**
9248
9249| 名称 | 描述 |
9250| -------- | -------- |
9251| OH_Drawing_Canvas | 指向画布对象的指针。 |
9252| dx | x轴方向的移动距离。 |
9253| dy | y轴方向的移动距离。 |
9254
9255
9256### OH_Drawing_ColorFilterCreateBlendMode()
9257
9258```
9259OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode (uint32_t color, OH_Drawing_BlendMode  )
9260```
9261
9262**描述**
9263
9264创建具有混合模式的颜色滤波器。
9265
9266**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9267
9268**起始版本:** 11
9269
9270**参数:**
9271
9272| 名称 | 描述 |
9273| -------- | -------- |
9274| color | 表示颜色,是一个32位(ARGB)变量。 |
9275| OH_Drawing_BlendMode | 表示混合模式。支持可选的混合模式具体可见[OH_Drawing_BlendMode](#oh_drawing_blendmode)枚举。 |
9276
9277**返回:**
9278
9279返回创建的颜色滤波器对象的指针。
9280
9281
9282### OH_Drawing_ColorFilterCreateCompose()
9283
9284```
9285OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose (OH_Drawing_ColorFilter* colorFilter1, OH_Drawing_ColorFilter* colorFilter2 )
9286```
9287
9288**描述**
9289
9290将两个颜色滤波器合成一个新的颜色滤波器。
9291
9292本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9293
9294colorFilter1、colorFilter2任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9295
9296**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9297
9298**起始版本:** 11
9299
9300**参数:**
9301
9302| 名称 | 描述 |
9303| -------- | -------- |
9304| colorFilter1 | 指向颜色滤波器对象一的指针。 |
9305| colorFilter2 | 指向颜色滤波器对象二的指针。 |
9306
9307**返回:**
9308
9309返回创建的颜色滤波器对象的指针。
9310
9311
9312### OH_Drawing_ColorFilterCreateLinearToSrgbGamma()
9313
9314```
9315OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma (void )
9316```
9317
9318**描述**
9319
9320创建一个从线性颜色空间转换到SRGB颜色空间的颜色滤波器。
9321
9322**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9323
9324**起始版本:** 11
9325
9326**返回:**
9327
9328返回创建的颜色滤波器对象的指针。
9329
9330
9331### OH_Drawing_ColorFilterCreateLuma()
9332
9333```
9334OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma (void )
9335```
9336
9337**描述**
9338
9339创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。
9340
9341**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9342
9343**起始版本:** 11
9344
9345**返回:**
9346
9347返回创建的颜色滤波器对象的指针。
9348
9349
9350### OH_Drawing_ColorFilterCreateMatrix()
9351
9352```
9353OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix (const float matrix[20])
9354```
9355
9356**描述**
9357
9358创建具有5x4颜色矩阵的颜色滤波器。
9359
9360本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9361
9362matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9363
9364**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9365
9366**起始版本:** 11
9367
9368**参数:**
9369
9370| 名称 | 描述 |
9371| -------- | -------- |
9372| matrix | 表示矩阵,以长度为20的浮点数组表示。 |
9373
9374**返回:**
9375
9376返回创建的颜色滤波器对象的指针。
9377
9378
9379### OH_Drawing_ColorFilterCreateSrgbGammaToLinear()
9380
9381```
9382OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear (void )
9383```
9384
9385**描述**
9386
9387创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。
9388
9389**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9390
9391**起始版本:** 11
9392
9393**返回:**
9394
9395返回创建的颜色滤波器对象的指针。
9396
9397
9398### OH_Drawing_ColorFilterDestroy()
9399
9400```
9401void OH_Drawing_ColorFilterDestroy (OH_Drawing_ColorFilter* )
9402```
9403
9404**描述**
9405
9406销毁颜色滤波器对象,并收回该对象占用的内存。
9407
9408**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9409
9410**起始版本:** 11
9411
9412**参数:**
9413
9414| 名称 | 描述 |
9415| -------- | -------- |
9416| OH_Drawing_ColorFilter | 表示指向颜色滤波器对象的指针。 |
9417
9418
9419### OH_Drawing_ColorSetArgb()
9420
9421```
9422uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue )
9423```
9424
9425**描述**
9426
9427用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。
9428
9429**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9430
9431**起始版本:** 8
9432
9433**参数:**
9434
9435| 名称 | 描述 |
9436| -------- | -------- |
9437| alpha | 描述透明度的变量, 变量范围是0x00~0xFF。 |
9438| red | 描述红色的变量, 变量范围是0x00~0xFF。 |
9439| green | 描述绿色的变量, 变量范围是0x00~0xFF。 |
9440| blue | 描述蓝色的变量, 变量范围是0x00~0xFF。 |
9441
9442**返回:**
9443
9444函数返回一个描述颜色的32位(ARGB)变量。
9445
9446
9447### OH_Drawing_ColorSpaceCreateSrgb()
9448
9449```
9450OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgb (void )
9451```
9452
9453**描述**
9454
9455创建一个标准颜色空间。
9456
9457**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9458
9459**起始版本:** 12
9460
9461**返回:**
9462
9463函数返回一个指针,指针指向创建的颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)。
9464
9465
9466### OH_Drawing_ColorSpaceCreateSrgbLinear()
9467
9468```
9469OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgbLinear (void )
9470```
9471
9472**描述**
9473
9474创建一个Gamma 1.0空间上的颜色空间。
9475
9476**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9477
9478**起始版本:** 12
9479
9480**返回:**
9481
9482函数返回一个指针,指针指向创建的颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)。
9483
9484
9485### OH_Drawing_ColorSpaceDestroy()
9486
9487```
9488void OH_Drawing_ColorSpaceDestroy (OH_Drawing_ColorSpace* )
9489```
9490
9491**描述**
9492
9493销毁颜色空间对象,并回收该对象占有内存。
9494
9495**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9496
9497**起始版本:** 12
9498
9499**参数:**
9500
9501| 名称 | 描述 |
9502| -------- | -------- |
9503| OH_Drawing_ColorSpace | 指向颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)的指针。 |
9504
9505
9506### OH_Drawing_CreateDashPathEffect()
9507
9508```
9509OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect (float* intervals, int count, float phase )
9510```
9511
9512**描述**
9513
9514创建一个虚线效果的路径效果对象。虚线效果由一组虚线开的间隔、虚线关的间隔数据决定。
9515
9516本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
9517
9518intervals为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
9519
9520**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9521
9522**起始版本:** 12
9523
9524**参数:**
9525
9526| 名称 | 描述 |
9527| -------- | -------- |
9528| intervals | 虚线间隔数组首地址,偶数项的值表示虚线开的间隔长度, 奇数项的值表示虚线关的间隔长度,单位为像素。 |
9529| count | 虚线间隔数组元素的个数,必须为大于0的偶数。 |
9530| phase | 虚线间隔数组中偏移量。 |
9531
9532**返回:**
9533
9534函数返回一个指针,指针指向创建的路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)。
9535
9536
9537### OH_Drawing_CreateFontCollection()
9538
9539```
9540OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void )
9541```
9542
9543**描述**
9544
9545创建字体集对象[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)对象。
9546
9547**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9548
9549**起始版本:** 8
9550
9551**返回:**
9552
9553指向创建的字体集对象的指针。
9554
9555
9556### OH_Drawing_CreateFontDescriptor()
9557
9558```
9559OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor (void )
9560```
9561
9562**描述**
9563
9564构造字体描述对象,用于描述系统字体详细信息。
9565
9566**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9567
9568**起始版本:** 12
9569
9570**返回:**
9571
9572返回指向已创建的字体描述对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针。
9573
9574
9575### OH_Drawing_CreateFontParser()
9576
9577```
9578OH_Drawing_FontParser* OH_Drawing_CreateFontParser (void )
9579```
9580
9581**描述**
9582
9583构造字体解析对象,用于解析系统字体。
9584
9585**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9586
9587**起始版本:** 12
9588
9589**返回:**
9590
9591返回指向已创建的字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针。
9592
9593
9594### OH_Drawing_CreateSharedFontCollection()
9595
9596```
9597OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection (void )
9598```
9599
9600**描述**
9601
9602创建可共享的字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。
9603
9604**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9605
9606**起始版本:** 12
9607
9608**返回:**
9609
9610指向创建的字体集对象的指针。
9611
9612### OH_Drawing_ClearFontCaches()
9613
9614```
9615void OH_Drawing_ClearFontCaches (OH_Drawing_FontCollection* )
9616```
9617
9618**描述**
9619
9620清理字体排版缓存(字体排版缓存本身设有内存上限和清理机制,所占内存有限,如无内存要求,不建议清理)。
9621
9622**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9623
9624**起始版本:** 12
9625
9626**参数:**
9627
9628| 名称 | 描述 |
9629| -------- | -------- |
9630| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 |
9631
9632### OH_Drawing_CreateTextShadow()
9633
9634```
9635OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow (void )
9636```
9637
9638**描述**
9639
9640创建指向字体阴影对象的指针。不再需要[OH_Drawing_TextShadow](#oh_drawing_textshadow)时,请使用[OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow)接口释放该对象的指针。
9641
9642**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9643
9644**起始版本:** 12
9645
9646**返回:**
9647
9648指向创建的字体阴影对象。
9649
9650
9651### OH_Drawing_CreateTextStyle()
9652
9653```
9654OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void )
9655```
9656
9657**描述**
9658
9659创建指向OH_Drawing_TextStyle对象的指针。
9660
9661**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9662
9663**起始版本:** 8
9664
9665**返回:**
9666
9667指向创建的OH_Drawing_TextStyle对象的指针。
9668
9669
9670### OH_Drawing_CreateTypography()
9671
9672```
9673OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate* )
9674```
9675
9676**描述**
9677
9678创建指向OH_Drawing_Typography对象的指针。不再需要[OH_Drawing_Typography](#oh_drawing_typography)时,请使用[OH_Drawing_DestroyTypography](#oh_drawing_destroytypography)接口释放该对象的指针。
9679
9680**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9681
9682**起始版本:** 8
9683
9684**参数:**
9685
9686| 名称 | 描述 |
9687| -------- | -------- |
9688| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
9689
9690**返回:**
9691
9692指向OH_Drawing_Typography对象的指针。
9693
9694
9695### OH_Drawing_CreateTypographyHandler()
9696
9697```
9698OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle* , OH_Drawing_FontCollection*  )
9699```
9700
9701**描述**
9702
9703创建指向OH_Drawing_TypographyCreate对象的指针。不再需要[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)时,请使用[OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler)接口释放该对象的指针。
9704
9705**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9706
9707**起始版本:** 8
9708
9709**参数:**
9710
9711| 名称 | 描述 |
9712| -------- | -------- |
9713| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
9714| 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)。 |
9715
9716**返回:**
9717
9718指向新创建的OH_Drawing_TypographyCreate对象的指针。
9719
9720
9721### OH_Drawing_CreateTypographyStyle()
9722
9723```
9724OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void )
9725```
9726
9727**描述**
9728
9729创建指向OH_Drawing_TypographyStyle对象的指针。不再需要[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)时,请使用[OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle)接口释放该对象的指针。
9730
9731**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9732
9733**起始版本:** 8
9734
9735**返回:**
9736
9737指向创建的OH_Drawing_TypographyStyle对象的指针。
9738
9739
9740### OH_Drawing_DestroyFontCollection()
9741
9742```
9743void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection* )
9744```
9745
9746**描述**
9747
9748释放被字体集对象占据的内存。
9749
9750**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9751
9752**起始版本:** 8
9753
9754**参数:**
9755
9756| 名称 | 描述 |
9757| -------- | -------- |
9758| OH_Drawing_FontCollection | 指向字体集对象的指针。 |
9759
9760
9761### OH_Drawing_DestroyFontDescriptor()
9762
9763```
9764void OH_Drawing_DestroyFontDescriptor (OH_Drawing_FontDescriptor* )
9765```
9766
9767**描述**
9768
9769释放字体描述对象占用的内存。
9770
9771**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9772
9773**起始版本:** 12
9774
9775**参数:**
9776
9777| 名称 | 描述 |
9778| -------- | -------- |
9779| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | 指向字体描述对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针,由[OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor)获取。 |
9780
9781
9782### OH_Drawing_DestroyFontParser()
9783
9784```
9785void OH_Drawing_DestroyFontParser (OH_Drawing_FontParser* )
9786```
9787
9788**描述**
9789
9790释放字体解析对象占用的内存。
9791
9792**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9793
9794**起始版本:** 12
9795
9796**参数:**
9797
9798| 名称 | 描述 |
9799| -------- | -------- |
9800| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 |
9801
9802
9803### OH_Drawing_DestroyLineMetrics()
9804
9805```
9806void OH_Drawing_DestroyLineMetrics (OH_Drawing_LineMetrics* )
9807```
9808
9809**描述**
9810
9811释放行位置信息对象占用的内存。
9812
9813**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9814
9815**起始版本:** 12
9816
9817**参数:**
9818
9819| 名称 | 描述 |
9820| -------- | -------- |
9821| OH_Drawing_LineMetrics | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 |
9822
9823
9824### OH_Drawing_DestroySystemFontConfigInfo()
9825
9826```
9827void OH_Drawing_DestroySystemFontConfigInfo (OH_Drawing_FontConfigInfo* )
9828```
9829
9830**描述**
9831
9832释放系统字体配置信息占用的的内存。
9833
9834**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9835
9836**起始版本:** 12
9837
9838**参数:**
9839
9840| 名称 | 描述 |
9841| -------- | -------- |
9842| OH_Drawing_FontConfigInfo | 指向系统字体配置信息[OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md)的指针, 由[OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo)获取。 |
9843
9844
9845### OH_Drawing_DestroySystemFontList()
9846
9847```
9848void OH_Drawing_DestroySystemFontList (char** , size_t  )
9849```
9850
9851**描述**
9852
9853释放系统字体名称列表占用的内存。
9854
9855**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9856
9857**起始版本:** 12
9858
9859**参数:**
9860
9861| 名称 | 描述 |
9862| -------- | -------- |
9863| char\*\* | 指向系统字体名称列表的指针。 |
9864| size_t\* | 系统字体名称列表的数量。 |
9865
9866
9867### OH_Drawing_DestroyTextShadow()
9868
9869```
9870void OH_Drawing_DestroyTextShadow (OH_Drawing_TextShadow* )
9871```
9872
9873**描述**
9874
9875释放被字体阴影对象占据的内存。
9876
9877**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9878
9879**起始版本:** 12
9880
9881**参数:**
9882
9883| 名称 | 描述 |
9884| -------- | -------- |
9885| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 |
9886
9887
9888### OH_Drawing_DestroyTextShadows()
9889
9890```
9891void OH_Drawing_DestroyTextShadows (OH_Drawing_TextShadow* )
9892```
9893
9894**描述**
9895
9896释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。
9897
9898**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9899
9900**起始版本:** 12
9901
9902**参数:**
9903
9904| 名称 | 描述 |
9905| -------- | -------- |
9906| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 |
9907
9908
9909### OH_Drawing_DestroyTextStyle()
9910
9911```
9912void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle* )
9913```
9914
9915**描述**
9916
9917释放被OH_Drawing_TextStyle对象占据的内存。
9918
9919**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9920
9921**起始版本:** 8
9922
9923**参数:**
9924
9925| 名称 | 描述 |
9926| -------- | -------- |
9927| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
9928
9929
9930### OH_Drawing_DestroyTypography()
9931
9932```
9933void OH_Drawing_DestroyTypography (OH_Drawing_Typography* )
9934```
9935
9936**描述**
9937
9938释放OH_Drawing_Typography对象占据的内存。
9939
9940**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9941
9942**起始版本:** 8
9943
9944**参数:**
9945
9946| 名称 | 描述 |
9947| -------- | -------- |
9948| OH_Drawing_Typography | 指向[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
9949
9950
9951### OH_Drawing_DestroyTypographyHandler()
9952
9953```
9954void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate* )
9955```
9956
9957**描述**
9958
9959释放被OH_Drawing_TypographyCreate对象占据的内存。
9960
9961**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9962
9963**起始版本:** 8
9964
9965**参数:**
9966
9967| 名称 | 描述 |
9968| -------- | -------- |
9969| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
9970
9971
9972### OH_Drawing_DestroyTypographyStyle()
9973
9974```
9975void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle* )
9976```
9977
9978**描述**
9979
9980释放被OH_Drawing_TypographyStyle对象占据的内存。
9981
9982**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
9983
9984**起始版本:** 8
9985
9986**参数:**
9987
9988| 名称 | 描述 |
9989| -------- | -------- |
9990| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
9991
9992
9993### OH_Drawing_DisableFontCollectionFallback()
9994
9995```
9996void OH_Drawing_DisableFontCollectionFallback (OH_Drawing_FontCollection* fontCollection)
9997```
9998
9999**描述**
10000
10001禁用系统字体。
10002
10003**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10004
10005**起始版本:** 12
10006
10007**参数:**
10008
10009| 名称 | 描述 |
10010| -------- | -------- |
10011| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 |
10012
10013
10014### OH_Drawing_DisableFontCollectionSystemFont()
10015
10016```
10017void OH_Drawing_DisableFontCollectionSystemFont (OH_Drawing_FontCollection* fontCollection)
10018```
10019
10020**描述**
10021
10022禁用系统字体。
10023
10024**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10025
10026**起始版本:** 12
10027
10028**参数:**
10029
10030| 名称 | 描述 |
10031| -------- | -------- |
10032| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 |
10033
10034
10035### OH_Drawing_FilterCreate()
10036
10037```
10038OH_Drawing_Filter* OH_Drawing_FilterCreate (void )
10039```
10040
10041**描述**
10042
10043创建一个滤波器对象。
10044
10045**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10046
10047**起始版本:** 11
10048
10049**返回:**
10050
10051返回创建的滤波器对象的指针。
10052
10053
10054### OH_Drawing_FilterDestroy()
10055
10056```
10057void OH_Drawing_FilterDestroy (OH_Drawing_Filter* )
10058```
10059
10060**描述**
10061
10062销毁滤波器对象,并收回该对象占用的内存。
10063
10064**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10065
10066**起始版本:** 11
10067
10068**参数:**
10069
10070| 名称 | 描述 |
10071| -------- | -------- |
10072| OH_Drawing_Filter | 指示指向滤波器对象的指针。 |
10073
10074
10075### OH_Drawing_FilterGetColorFilter()
10076
10077```
10078void OH_Drawing_FilterGetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter*  )
10079```
10080
10081**描述**
10082
10083从滤波器对象获取颜色滤波器对象。
10084
10085本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10086
10087OH_Drawing_Filter、OH_Drawing_ColorFilter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10088
10089**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10090
10091**起始版本:** 12
10092
10093**参数:**
10094
10095| 名称 | 描述 |
10096| -------- | -------- |
10097| OH_Drawing_Filter | 指示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 |
10098| OH_Drawing_ColorFilter | 指示指向颜色滤波器对象[OH_Drawing_ColorFilter](#oh_drawing_colorfilter)的指针。 |
10099
10100
10101### OH_Drawing_FilterSetColorFilter()
10102
10103```
10104void OH_Drawing_FilterSetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter*  )
10105```
10106
10107**描述**
10108
10109为滤波器对象设置颜色滤波器对象。
10110
10111本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10112
10113OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10114
10115**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10116
10117**起始版本:** 11
10118
10119**参数:**
10120
10121| 名称 | 描述 |
10122| -------- | -------- |
10123| OH_Drawing_Filter | 指示指向滤波器对象的指针。 |
10124| OH_Drawing_ColorFilter | 指示指向颜色滤波器对象的指针,为NULL表示清空滤波器对象中的颜色滤波器效果。 |
10125
10126
10127### OH_Drawing_FilterSetMaskFilter()
10128
10129```
10130void OH_Drawing_FilterSetMaskFilter (OH_Drawing_Filter* , OH_Drawing_MaskFilter*  )
10131```
10132
10133**描述**
10134
10135为滤波器对象设置蒙版滤波器对象。
10136
10137本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10138
10139OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10140
10141**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10142
10143**起始版本:** 11
10144
10145**参数:**
10146
10147| 名称 | 描述 |
10148| -------- | -------- |
10149| OH_Drawing_Filter | 指示指向滤波器对象的指针。 |
10150| OH_Drawing_MaskFilter | 指示指向蒙版滤波器对象的指针,为NULL表示清空滤波器对象中的蒙版滤波器效果。 |
10151
10152
10153### OH_Drawing_FontCountText()
10154
10155```
10156int OH_Drawing_FontCountText (OH_Drawing_Font* , const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding )
10157```
10158
10159**描述**
10160
10161获取文本所表示的字符数量。
10162
10163本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10164
10165OH_Drawing_Font、text任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10166
10167**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10168
10169**起始版本:** 12
10170
10171**参数:**
10172
10173| 名称 | 描述 |
10174| -------- | -------- |
10175| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
10176| text | 文本存储首地址。 |
10177| byteLength | 文本长度,单位为字节。 |
10178| encoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 |
10179
10180
10181### OH_Drawing_FontCreate()
10182
10183```
10184OH_Drawing_Font* OH_Drawing_FontCreate (void )
10185```
10186
10187**描述**
10188
10189用于创建一个字体对象。
10190
10191**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10192
10193**起始版本:** 11
10194
10195**返回:**
10196
10197函数会返回一个指针,指针指向创建的字体对象。
10198
10199
10200### OH_Drawing_FontDestroy()
10201
10202```
10203void OH_Drawing_FontDestroy (OH_Drawing_Font* )
10204```
10205
10206**描述**
10207
10208用于销毁字体对象并回收该对象占有的内存。
10209
10210**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10211
10212**起始版本:** 11
10213
10214**参数:**
10215
10216| 名称 | 描述 |
10217| -------- | -------- |
10218| OH_Drawing_Font | 指向字体对象的指针。 |
10219
10220
10221### OH_Drawing_FontGetMetrics()
10222
10223```
10224float OH_Drawing_FontGetMetrics (OH_Drawing_Font* , OH_Drawing_Font_Metrics*  )
10225```
10226
10227**描述**
10228
10229获取字体度量信息。
10230
10231本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10232
10233OH_Drawing_Font、OH_Drawing_Font_Metrics任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10234
10235**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10236
10237**起始版本:** 12
10238
10239**参数:**
10240
10241| 名称 | 描述 |
10242| -------- | -------- |
10243| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
10244| OH_Drawing_Font_Metrics | 指向字体度量信息对象[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)的指针。 |
10245
10246**返回:**
10247
10248函数返回一个浮点数变量,表示建议的行间距。
10249
10250
10251### OH_Drawing_FontGetTypeface()
10252
10253```
10254OH_Drawing_Typeface* OH_Drawing_FontGetTypeface (OH_Drawing_Font* )
10255```
10256
10257**描述**
10258
10259获取字体对象。
10260
10261本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10262
10263OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10264
10265**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10266
10267**起始版本:** 12
10268
10269**参数:**
10270
10271| 名称 | 描述 |
10272| -------- | -------- |
10273| OH_Drawing_Font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
10274
10275**返回:**
10276
10277OH_Drawing_Typeface 函数返回一个指针,指字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
10278
10279
10280### OH_Drawing_FontMgrCreate()
10281
10282```
10283OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate (void )
10284```
10285
10286**描述**
10287
10288创建字体管理对象,只支持管理系统字体。
10289
10290**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10291
10292**起始版本:** 12
10293
10294**返回:**
10295
10296返回指向已创建的字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针。
10297
10298
10299### OH_Drawing_FontMgrCreateFontStyleSet()
10300
10301```
10302OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet (OH_Drawing_FontMgr* , int index )
10303```
10304
10305**描述**
10306
10307由字体管理对象构造字体样式集对象。
10308
10309**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10310
10311**起始版本:** 12
10312
10313**参数:**
10314
10315| 名称 | 描述 |
10316| -------- | -------- |
10317| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
10318| index | 用于从字体管理对象获取字体样式集对象的索引值。 |
10319
10320**返回:**
10321
10322返回指向已创建的字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。
10323
10324
10325### OH_Drawing_FontMgrDestroy()
10326
10327```
10328void OH_Drawing_FontMgrDestroy (OH_Drawing_FontMgr* )
10329```
10330
10331**描述**
10332
10333释放字体管理对象占用的内存。
10334
10335**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10336
10337**起始版本:** 12
10338
10339**参数:**
10340
10341| 名称 | 描述 |
10342| -------- | -------- |
10343| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
10344
10345
10346### OH_Drawing_FontMgrDestroyFamilyName()
10347
10348```
10349void OH_Drawing_FontMgrDestroyFamilyName (char* familyName)
10350```
10351
10352**描述**
10353
10354释放指定字体家族名称占用的内存。
10355
10356**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10357
10358**起始版本:** 12
10359
10360**参数:**
10361
10362| 名称 | 描述 |
10363| -------- | -------- |
10364| familyName | 指定字体家族名称数组。 |
10365
10366
10367### OH_Drawing_FontMgrDestroyFontStyleSet()
10368
10369```
10370void OH_Drawing_FontMgrDestroyFontStyleSet (OH_Drawing_FontStyleSet* )
10371```
10372
10373**描述**
10374
10375释放字体样式集对象占用的内存。
10376
10377**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10378
10379**起始版本:** 12
10380
10381**参数:**
10382
10383| 名称 | 描述 |
10384| -------- | -------- |
10385| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
10386
10387
10388### OH_Drawing_FontMgrGetFamilyCount()
10389
10390```
10391int OH_Drawing_FontMgrGetFamilyCount (OH_Drawing_FontMgr* )
10392```
10393
10394**描述**
10395
10396获取字体家族的数量。
10397
10398**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10399
10400**起始版本:** 12
10401
10402**参数:**
10403
10404| 名称 | 描述 |
10405| -------- | -------- |
10406| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
10407
10408**返回:**
10409
10410返回字体家族的数量。
10411
10412
10413### OH_Drawing_FontMgrGetFamilyName()
10414
10415```
10416char* OH_Drawing_FontMgrGetFamilyName (OH_Drawing_FontMgr* , int index )
10417```
10418
10419**描述**
10420
10421由索引值获取字体家族名称。
10422
10423**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10424
10425**起始版本:** 12
10426
10427**参数:**
10428
10429| 名称 | 描述 |
10430| -------- | -------- |
10431| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
10432| index | 用于获取对应字体家族名称的索引值。 |
10433
10434**返回:**
10435
10436返回索引值对应的字体家族名称,不再需要时,请使用[OH_Drawing_FontMgrDestroyFamilyName](#oh_drawing_fontmgrdestroyfamilyname)释放该对象指针。
10437
10438
10439### OH_Drawing_FontMgrMatchFamily()
10440
10441```
10442OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily (OH_Drawing_FontMgr* , const char* familyName )
10443```
10444
10445**描述**
10446
10447由指定的字体家族名称,获取字体样式集对象。
10448
10449**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10450
10451**起始版本:** 12
10452
10453**参数:**
10454
10455| 名称 | 描述 |
10456| -------- | -------- |
10457| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
10458| familyName | 指定的字体家族名称。 |
10459
10460**返回:**
10461
10462返回对应的字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset),不再需要时,请使用[OH_Drawing_FontMgrDestroyFontStyleSet](#oh_drawing_fontmgrdestroyfontstyleset)释放该对象指针。
10463
10464
10465### OH_Drawing_FontMgrMatchFamilyStyle()
10466
10467```
10468OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct  )
10469```
10470
10471**描述**
10472
10473根据指定的字体样式信息和字体家族名称,获取字型对象。
10474
10475**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10476
10477**起始版本:** 12
10478
10479**参数:**
10480
10481| 名称 | 描述 |
10482| -------- | -------- |
10483| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
10484| familyName | 指定的字体家族名称。 |
10485| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 |
10486
10487**返回:**
10488
10489返回对应的字体样式的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface),不再需要时,请使用[OH_Drawing_TypefaceDestroy](#oh_drawing_typefacedestroy)释放该对象指针。
10490
10491
10492### OH_Drawing_FontMgrMatchFamilyStyleCharacter()
10493
10494```
10495OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct , const char* bcp47[], int bcp47Count, int32_t character )
10496```
10497
10498**描述**
10499
10500为指定字符获取字型对象,仅在传入字体管理对象中无法找到传入UTF8字符值对应的字型对象时返回空指针。
10501
10502**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10503
10504**起始版本:** 12
10505
10506**参数:**
10507
10508| 名称 | 描述 |
10509| -------- | -------- |
10510| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 |
10511| familyName | 指定的字体家族名称。 |
10512| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 |
10513| bcp47 | 用来指示character语言编码数组,是ISO 639、15924和3166-1语言编码的组合。 |
10514| bcp47Count | 参数bcp47数组大小。 |
10515| character | 待匹配的UTF8字符值。 |
10516
10517**返回:**
10518
10519返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
10520
10521
10522### OH_Drawing_FontParserGetFontByName()
10523
10524```
10525OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName (OH_Drawing_FontParser* , const char*  )
10526```
10527
10528**描述**
10529
10530根据传入的系统字体名称获取系统字体的相关信息。
10531
10532**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10533
10534**起始版本:** 12
10535
10536**参数:**
10537
10538| 名称 | 描述 |
10539| -------- | -------- |
10540| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 |
10541| char\* | 系统字体名。 |
10542
10543**返回:**
10544
10545返回系统字体描述对象,不再需要时,请使用[OH_Drawing_DestroyFontParser](#oh_drawing_destroyfontparser)释放该对象指针。
10546
10547
10548### OH_Drawing_FontParserGetSystemFontList()
10549
10550```
10551char** OH_Drawing_FontParserGetSystemFontList (OH_Drawing_FontParser* , size_t*  )
10552```
10553
10554**描述**
10555
10556获取系统字体名称列表,此接口仅在2in1、phone设备上可用。
10557
10558**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10559
10560**起始版本:** 12
10561
10562**参数:**
10563
10564| 名称 | 描述 |
10565| -------- | -------- |
10566| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 |
10567| size_t | 返回获取到的系统字体名称数量。 |
10568
10569**返回:**
10570
10571返回获取到的系统字体列表。
10572
10573
10574### OH_Drawing_FontSetFakeBoldText()
10575
10576```
10577void OH_Drawing_FontSetFakeBoldText (OH_Drawing_Font* , bool isFakeBoldText )
10578```
10579
10580**描述**
10581
10582用于设置增加描边宽度以近似粗体字体效果。
10583
10584本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10585
10586OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10587
10588**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10589
10590**起始版本:** 11
10591
10592**参数:**
10593
10594| 名称 | 描述 |
10595| -------- | -------- |
10596| OH_Drawing_Font | 指向字体对象的指针。 |
10597| isFakeBoldText | 真为使能增加描边宽度,假为不使能。 |
10598
10599
10600### OH_Drawing_FontSetLinearText()
10601
10602```
10603void OH_Drawing_FontSetLinearText (OH_Drawing_Font* , bool isLinearText )
10604```
10605
10606**描述**
10607
10608用于设置线性可缩放字体。
10609
10610本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10611
10612OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10613
10614**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10615
10616**起始版本:** 11
10617
10618**参数:**
10619
10620| 名称 | 描述 |
10621| -------- | -------- |
10622| OH_Drawing_Font | 指向字体对象的指针。 |
10623| isLinearText | 真为使能线性可缩放字体,假为不使能。 |
10624
10625
10626### OH_Drawing_FontSetTextSize()
10627
10628```
10629void OH_Drawing_FontSetTextSize (OH_Drawing_Font* , float textSize )
10630```
10631
10632**描述**
10633
10634用于给字体设置文字大小。
10635
10636本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10637
10638OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10639
10640**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10641
10642**起始版本:** 11
10643
10644**参数:**
10645
10646| 名称 | 描述 |
10647| -------- | -------- |
10648| OH_Drawing_Font | 指向字体对象的指针。 |
10649| textSize | 字体大小,该参数为浮点数,为负数时字体大小会被置为0。字体大小为0时,绘制的文字不会显示。 |
10650
10651
10652### OH_Drawing_FontSetTextSkewX()
10653
10654```
10655void OH_Drawing_FontSetTextSkewX (OH_Drawing_Font* , float skewX )
10656```
10657
10658**描述**
10659
10660用于给字体设置文本倾斜。
10661
10662本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10663
10664OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10665
10666**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10667
10668**起始版本:** 11
10669
10670**参数:**
10671
10672| 名称 | 描述 |
10673| -------- | -------- |
10674| OH_Drawing_Font | 指向字体对象的指针。 |
10675| skewX | X轴相对于Y轴的倾斜度。 |
10676
10677
10678### OH_Drawing_FontSetTypeface()
10679
10680```
10681void OH_Drawing_FontSetTypeface (OH_Drawing_Font* , OH_Drawing_Typeface*  )
10682```
10683
10684**描述**
10685
10686用于给字型设置字体。
10687
10688本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
10689
10690OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
10691
10692**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10693
10694**起始版本:** 11
10695
10696**参数:**
10697
10698| 名称 | 描述 |
10699| -------- | -------- |
10700| OH_Drawing_Font | 指向字型对象的指针。 |
10701| OH_Drawing_Typeface | 指向字体对象的指针,为NULL会使用系统默认字体对象。 |
10702
10703
10704### OH_Drawing_FontStyleSetCount()
10705
10706```
10707int OH_Drawing_FontStyleSetCount (OH_Drawing_FontStyleSet* )
10708```
10709
10710**描述**
10711
10712获取字体样式集中字体的个数。
10713
10714**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10715
10716**起始版本:** 12
10717
10718**参数:**
10719
10720| 名称 | 描述 |
10721| -------- | -------- |
10722| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
10723
10724**返回:**
10725
10726返回此字体样式集中字体的个数。
10727
10728
10729### OH_Drawing_FontStyleSetCreateTypeface()
10730
10731```
10732OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface (OH_Drawing_FontStyleSet* , int index )
10733```
10734
10735**描述**
10736
10737为指定索引获取字型对象。
10738
10739**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10740
10741**起始版本:** 12
10742
10743**参数:**
10744
10745| 名称 | 描述 |
10746| -------- | -------- |
10747| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
10748| index | 指定的字型对象的索引。 |
10749
10750**返回:**
10751
10752如果成功,返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface); 如果失败,返回nullptr。
10753
10754
10755### OH_Drawing_FontStyleSetFreeStyleName()
10756
10757```
10758void OH_Drawing_FontStyleSetFreeStyleName (char** styleName)
10759```
10760
10761**描述**
10762
10763释放指定字体样式的内存。
10764
10765**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10766
10767**起始版本:** 12
10768
10769**参数:**
10770
10771| 名称 | 描述 |
10772| -------- | -------- |
10773| styleName | 指定字体样式名称的字符串。 |
10774
10775
10776### OH_Drawing_FontStyleSetGetStyle()
10777
10778```
10779OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle (OH_Drawing_FontStyleSet* , int32_t index, char** styleName )
10780```
10781
10782**描述**
10783
10784获取字体样式。
10785
10786**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10787
10788**起始版本:** 12
10789
10790**参数:**
10791
10792| 名称 | 描述 |
10793| -------- | -------- |
10794| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
10795| index | 指定的字体样式的索引。 |
10796| styleName | 指定字体样式名称的字符串。 |
10797
10798**返回:**
10799
10800返回对应的字体样式。
10801
10802
10803### OH_Drawing_FontStyleSetMatchStyle()
10804
10805```
10806OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle (OH_Drawing_FontStyleSet* , OH_Drawing_FontStyleStruct fontStyleStruct )
10807```
10808
10809**描述**
10810
10811获取最接近字体样式的字型对象。
10812
10813**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10814
10815**起始版本:** 12
10816
10817**参数:**
10818
10819| 名称 | 描述 |
10820| -------- | -------- |
10821| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 |
10822| fontStyleStruct | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 |
10823
10824**返回:**
10825
10826返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
10827
10828
10829### OH_Drawing_GetAffinityFromPositionAndAffinity()
10830
10831```
10832int OH_Drawing_GetAffinityFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* )
10833```
10834
10835**描述**
10836
10837获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本。
10838
10839**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10840
10841**起始版本:** 11
10842
10843**参数:**
10844
10845| 名称 | 描述 |
10846| -------- | -------- |
10847| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针, 由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或 [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。 |
10848
10849**返回:**
10850
10851返回OH_Drawing_PositionAndAffinity对象的亲和性。
10852
10853
10854### OH_Drawing_GetBottomFromTextBox()
10855
10856```
10857float OH_Drawing_GetBottomFromTextBox (OH_Drawing_TextBox* , int  )
10858```
10859
10860**描述**
10861
10862获取文本框底部位置。
10863
10864**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10865
10866**起始版本:** 11
10867
10868**参数:**
10869
10870| 名称 | 描述 |
10871| -------- | -------- |
10872| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
10873| int | 文本框的索引。 |
10874
10875**返回:**
10876
10877返回文本框底部位置。
10878
10879
10880### OH_Drawing_GetEndFromRange()
10881
10882```
10883size_t OH_Drawing_GetEndFromRange (OH_Drawing_Range* )
10884```
10885
10886**描述**
10887
10888获取OH_Drawing_Range对象结束位置。
10889
10890**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10891
10892**起始版本:** 11
10893
10894**参数:**
10895
10896| 名称 | 描述 |
10897| -------- | -------- |
10898| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 |
10899
10900**返回:**
10901
10902返回OH_Drawing_Range对象结束位置。
10903
10904
10905### OH_Drawing_GetLeftFromTextBox()
10906
10907```
10908float OH_Drawing_GetLeftFromTextBox (OH_Drawing_TextBox* , int  )
10909```
10910
10911**描述**
10912
10913获取文本框左侧位置。
10914
10915**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10916
10917**起始版本:** 11
10918
10919**参数:**
10920
10921| 名称 | 描述 |
10922| -------- | -------- |
10923| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
10924| int | 文本框的索引。 |
10925
10926**返回:**
10927
10928返回文本框左侧位置。
10929
10930
10931### OH_Drawing_GetPositionFromPositionAndAffinity()
10932
10933```
10934size_t OH_Drawing_GetPositionFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* )
10935```
10936
10937**描述**
10938
10939获取OH_Drawing_PositionAndAffinity对象的位置属性。
10940
10941**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10942
10943**起始版本:** 11
10944
10945**参数:**
10946
10947| 名称 | 描述 |
10948| -------- | -------- |
10949| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针, 由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或 [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。 |
10950
10951**返回:**
10952
10953返回OH_Drawing_PositionAndAffinity对象的位置属性。
10954
10955
10956### OH_Drawing_GetRightFromTextBox()
10957
10958```
10959float OH_Drawing_GetRightFromTextBox (OH_Drawing_TextBox* , int  )
10960```
10961
10962**描述**
10963
10964获取文本框右侧位置。
10965
10966**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10967
10968**起始版本:** 11
10969
10970**参数:**
10971
10972| 名称 | 描述 |
10973| -------- | -------- |
10974| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
10975| int | 文本框的索引。 |
10976
10977**返回:**
10978
10979返回文本框右侧位置。
10980
10981
10982### OH_Drawing_GetSizeOfTextBox()
10983
10984```
10985size_t OH_Drawing_GetSizeOfTextBox (OH_Drawing_TextBox* )
10986```
10987
10988**描述**
10989
10990获取文本框数量大小。
10991
10992**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
10993
10994**起始版本:** 11
10995
10996**参数:**
10997
10998| 名称 | 描述 |
10999| -------- | -------- |
11000| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
11001
11002**返回:**
11003
11004返回文本框数量大小。
11005
11006
11007### OH_Drawing_GetStartFromRange()
11008
11009```
11010size_t OH_Drawing_GetStartFromRange (OH_Drawing_Range* )
11011```
11012
11013**描述**
11014
11015获取OH_Drawing_Range对象开始位置。
11016
11017**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11018
11019**起始版本:** 11
11020
11021**参数:**
11022
11023| 名称 | 描述 |
11024| -------- | -------- |
11025| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 |
11026
11027**返回:**
11028
11029返回OH_Drawing_Range对象开始位置。
11030
11031
11032### OH_Drawing_GetSystemFontConfigInfo()
11033
11034```
11035OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo (OH_Drawing_FontConfigInfoErrorCode* )
11036```
11037
11038**描述**
11039
11040获取系统字体配置信息。
11041
11042**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11043
11044**起始版本:** 12
11045
11046**参数:**
11047
11048| 名称 | 描述 |
11049| -------- | -------- |
11050| OH_Drawing_FontConfigJsonInfoCode | 错误码,具体可见[OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode)枚举。 |
11051
11052**返回:**
11053
11054返回系统字体配置信息的指针,不再需要时,请使用[OH_Drawing_DestroySystemFontConfigInfo](#oh_drawing_destroysystemfontconfiginfo)释放该对象指针。
11055
11056
11057### OH_Drawing_GetTextDirectionFromTextBox()
11058
11059```
11060int OH_Drawing_GetTextDirectionFromTextBox (OH_Drawing_TextBox* , int  )
11061```
11062
11063**描述**
11064
11065获取文本框方向。
11066
11067**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11068
11069**起始版本:** 11
11070
11071**参数:**
11072
11073| 名称 | 描述 |
11074| -------- | -------- |
11075| OH_Drawing_TextBox | 指向[OH_Drawing_TextBox](#oh_drawing_textbox)对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
11076| int | 文本框的索引。 |
11077
11078**返回:**
11079
11080返回文本框方向。
11081
11082
11083### OH_Drawing_GetTopFromTextBox()
11084
11085```
11086float OH_Drawing_GetTopFromTextBox (OH_Drawing_TextBox* , int  )
11087```
11088
11089**描述**
11090
11091获取文本框顶部位置。
11092
11093**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11094
11095**起始版本:** 11
11096
11097**参数:**
11098
11099| 名称 | 描述 |
11100| -------- | -------- |
11101| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
11102| int | 文本框的索引。 |
11103
11104**返回:**
11105
11106返回文本框顶部位置。
11107
11108
11109### OH_Drawing_GpuContextCreateFromGL()
11110
11111```
11112OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL (OH_Drawing_GpuContextOptions )
11113```
11114
11115**描述**
11116
11117用于创建一个使用OpenGL作为后端接口的图形处理器上下文对象。
11118
11119**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11120
11121**起始版本:** 12
11122
11123**废弃:** 从API version 18开始废弃,请使用[OH_Drawing_GpuContextCreate](#oh_drawing_gpucontextcreate)替代。
11124
11125**参数:**
11126
11127| 名称 | 描述 |
11128| -------- | -------- |
11129| OH_Drawing_GpuContextOptions | 图形处理器上下文选项[OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)。 |
11130
11131**返回:**
11132
11133返回一个指针,指针指向创建的图形处理器上下文对象[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。
11134
11135
11136### OH_Drawing_GpuContextDestroy()
11137
11138```
11139void OH_Drawing_GpuContextDestroy (OH_Drawing_GpuContext* )
11140```
11141
11142**描述**
11143
11144用于销毁图形处理器上下文对象并回收该对象占用的内存。
11145
11146**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11147
11148**起始版本:** 12
11149
11150**参数:**
11151
11152| 名称 | 描述 |
11153| -------- | -------- |
11154| OH_Drawing_GpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 |
11155
11156
11157### OH_Drawing_ImageBuildFromBitmap()
11158
11159```
11160bool OH_Drawing_ImageBuildFromBitmap (OH_Drawing_Image* , OH_Drawing_Bitmap*  )
11161```
11162
11163**描述**
11164
11165从位图构造图片对象内容,共享或复制位图像素。如果位图被标记为不可变状态, 像素内存是共享的,不是复制。
11166
11167本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11168
11169OH_Drawing_Image、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11170
11171**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11172
11173**起始版本:** 12
11174
11175**参数:**
11176
11177| 名称 | 描述 |
11178| -------- | -------- |
11179| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
11180| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 |
11181
11182**返回:**
11183
11184函数返回true表示构造图片内容成功,函数返回false表示构建图片内容失败。
11185
11186
11187### OH_Drawing_ImageCreate()
11188
11189```
11190OH_Drawing_Image* OH_Drawing_ImageCreate (void )
11191```
11192
11193**描述**
11194
11195创建一个图片对象,描述了要绘制的二维像素数组。
11196
11197**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11198
11199**起始版本:** 12
11200
11201**返回:**
11202
11203函数返回一个指针,指针指向创建的图片对象[OH_Drawing_Image](#oh_drawing_image)。
11204
11205
11206### OH_Drawing_ImageDestroy()
11207
11208```
11209void OH_Drawing_ImageDestroy (OH_Drawing_Image* )
11210```
11211
11212**描述**
11213
11214销毁图片对象并回收该对象占有内存。
11215
11216**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11217
11218**起始版本:** 12
11219
11220**参数:**
11221
11222| 名称 | 描述 |
11223| -------- | -------- |
11224| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
11225
11226
11227### OH_Drawing_ImageGetHeight()
11228
11229```
11230int32_t OH_Drawing_ImageGetHeight (OH_Drawing_Image* )
11231```
11232
11233**描述**
11234
11235获取图片高度,即像素行数。
11236
11237本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11238
11239OH_Drawing_Image为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11240
11241**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11242
11243**起始版本:** 12
11244
11245**参数:**
11246
11247| 名称 | 描述 |
11248| -------- | -------- |
11249| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
11250
11251**返回:**
11252
11253函数返回图片高度。
11254
11255
11256### OH_Drawing_ImageGetImageInfo()
11257
11258```
11259void OH_Drawing_ImageGetImageInfo (OH_Drawing_Image* , OH_Drawing_Image_Info*  )
11260```
11261
11262**描述**
11263
11264获取图片信息。调用该接口后,传入的图片信息对象被填充。
11265
11266本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11267
11268OH_Drawing_Image、OH_Drawing_Image_Info任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11269
11270**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11271
11272**起始版本:** 12
11273
11274**参数:**
11275
11276| 名称 | 描述 |
11277| -------- | -------- |
11278| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
11279| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针, 开发者可调用[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)创建。 |
11280
11281
11282### OH_Drawing_ImageGetWidth()
11283
11284```
11285int32_t OH_Drawing_ImageGetWidth (OH_Drawing_Image* )
11286```
11287
11288**描述**
11289
11290获取图片宽度,即每行的像素个数。
11291
11292本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11293
11294OH_Drawing_Image为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11295
11296**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11297
11298**起始版本:** 12
11299
11300**参数:**
11301
11302| 名称 | 描述 |
11303| -------- | -------- |
11304| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
11305
11306**返回:**
11307
11308函数返回图片宽度。
11309
11310
11311### OH_Drawing_LineMetricsGetSize()
11312
11313```
11314size_t OH_Drawing_LineMetricsGetSize (OH_Drawing_LineMetrics* )
11315```
11316
11317**描述**
11318
11319获取行数量。
11320
11321**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11322
11323**起始版本:** 12
11324
11325**参数:**
11326
11327| 名称 | 描述 |
11328| -------- | -------- |
11329| [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)获取。 |
11330
11331**返回:**
11332
11333返回行数量。
11334
11335
11336### OH_Drawing_MaskFilterCreateBlur()
11337
11338```
11339OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur (OH_Drawing_BlurType blurType, float sigma, bool respectCTM )
11340```
11341
11342**描述**
11343
11344创建具有模糊效果的蒙版滤波器。
11345
11346**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11347
11348**起始版本:** 11
11349
11350**参数:**
11351
11352| 名称 | 描述 |
11353| -------- | -------- |
11354| blurType | 表示模糊类型。 |
11355| sigma | 表示要应用的高斯模糊的标准偏差。必须大于0。 |
11356| respectCTM | 表示模糊标准差值被CTM修改,默认为真。 |
11357
11358**返回:**
11359
11360返回创建的蒙版滤波器对象的指针。
11361
11362
11363### OH_Drawing_MaskFilterDestroy()
11364
11365```
11366void OH_Drawing_MaskFilterDestroy (OH_Drawing_MaskFilter* )
11367```
11368
11369**描述**
11370
11371销毁蒙版滤波器对象,并收回该对象占用的内存。
11372
11373**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11374
11375**起始版本:** 11
11376
11377**参数:**
11378
11379| 名称 | 描述 |
11380| -------- | -------- |
11381| OH_Drawing_MaskFilter | 表示指向蒙版滤波器对象的指针。 |
11382
11383
11384### OH_Drawing_MatrixConcat()
11385
11386```
11387void OH_Drawing_MatrixConcat (OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, const OH_Drawing_Matrix* b )
11388```
11389
11390**描述**
11391
11392将矩阵total设置为矩阵a乘以矩阵b。
11393
11394本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11395
11396total、a、b任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11397
11398**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11399
11400**起始版本:** 12
11401
11402**参数:**
11403
11404| 名称 | 描述 |
11405| -------- | -------- |
11406| total | 指向最终的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11407| a | 指向矩阵对象a[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11408| b | 指向矩阵对象b[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11409
11410
11411### OH_Drawing_MatrixCreate()
11412
11413```
11414OH_Drawing_Matrix* OH_Drawing_MatrixCreate (void )
11415```
11416
11417**描述**
11418
11419用于创建一个矩阵对象。
11420
11421**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11422
11423**起始版本:** 11
11424
11425**返回:**
11426
11427函数会返回一个指针,指针指向创建的矩阵对象。
11428
11429
11430### OH_Drawing_MatrixCreateRotation()
11431
11432```
11433OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation (float deg, float x, float y )
11434```
11435
11436**描述**
11437
11438创建一个带旋转属性的矩阵对象。 该矩阵对象为:单位矩阵在(x, y)旋转点以度为单位进行旋转后得到的矩阵。
11439
11440**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11441
11442**起始版本:** 12
11443
11444**参数:**
11445
11446| 名称 | 描述 |
11447| -------- | -------- |
11448| deg | 旋转的角度,单位为度。正数表示按顺时针旋转,负数表示按逆时针旋转。 |
11449| x | x轴上坐标点。 |
11450| y | y轴上坐标点。 |
11451
11452**返回:**
11453
11454函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。
11455
11456
11457### OH_Drawing_MatrixCreateScale()
11458
11459```
11460OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale (float sx, float sy, float px, float py )
11461```
11462
11463**描述**
11464
11465创建一个带缩放属性的矩阵对象。 该矩阵对象为:单位矩阵在(px, py)旋转点以sx和sy为缩放因子进行缩放后得到的矩阵。
11466
11467**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11468
11469**起始版本:** 12
11470
11471**参数:**
11472
11473| 名称 | 描述 |
11474| -------- | -------- |
11475| sx | x轴方向缩放系数,为负数时可看作是先关于y = px作镜像翻转后再进行缩放,该参数为浮点数。 |
11476| sy | y轴方向缩放系数,为负数时可看作是先关于x = py作镜像翻转后再进行缩放,该参数为浮点数。 |
11477| px | x轴上坐标点。 |
11478| py | y轴上坐标点。 |
11479
11480**返回:**
11481
11482函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。
11483
11484
11485### OH_Drawing_MatrixCreateTranslation()
11486
11487```
11488OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation (float dx, float dy )
11489```
11490
11491**描述**
11492
11493创建一个带平移属性的矩阵对象。 该矩阵对象为:单位矩阵平移(dx, dy)后得到的矩阵。
11494
11495**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11496
11497**起始版本:** 12
11498
11499**参数:**
11500
11501| 名称 | 描述 |
11502| -------- | -------- |
11503| dx | 水平方向平移距离,正数表示往x轴正方向平移,负数表示往x轴负方向平移,该参数为浮点数。 |
11504| dy | 垂直方向平移距离,正数表示往y轴正方向平移,负数表示往y轴负方向平移,该参数为浮点数。 |
11505
11506**返回:**
11507
11508函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。
11509
11510
11511### OH_Drawing_MatrixDestroy()
11512
11513```
11514void OH_Drawing_MatrixDestroy (OH_Drawing_Matrix* )
11515```
11516
11517**描述**
11518
11519用于销毁矩阵对象并回收该对象占有的内存。
11520
11521**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11522
11523**起始版本:** 11
11524
11525**参数:**
11526
11527| 名称 | 描述 |
11528| -------- | -------- |
11529| OH_Drawing_Matrix | 指向字体对象的指针。 |
11530
11531
11532### OH_Drawing_MatrixGetValue()
11533
11534```
11535float OH_Drawing_MatrixGetValue (OH_Drawing_Matrix* , int index )
11536```
11537
11538**描述**
11539
11540获取矩阵给定索引位的值。索引范围0-8。
11541
11542本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11543
11544OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
11545
11546index小于0或者大于8时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
11547
11548**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11549
11550**起始版本:** 12
11551
11552**参数:**
11553
11554| 名称 | 描述 |
11555| -------- | -------- |
11556| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11557| index | 索引位置,范围0-8。 |
11558
11559**返回:**
11560
11561函数返回矩阵给定索引位对应的值。
11562
11563
11564### OH_Drawing_MatrixInvert()
11565
11566```
11567bool OH_Drawing_MatrixInvert (OH_Drawing_Matrix* , OH_Drawing_Matrix* inverse )
11568```
11569
11570**描述**
11571
11572将矩阵inverse设置为矩阵的倒数,并返回结果。
11573
11574本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11575
11576OH_Drawing_Matrix、inverse任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11577
11578**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11579
11580**起始版本:** 12
11581
11582**参数:**
11583
11584| 名称 | 描述 |
11585| -------- | -------- |
11586| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11587| inverse | 指向逆矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 |
11588
11589**返回:**
11590
11591函数返回true表示矩阵可逆,inverse被填充为逆矩阵;函数返回false表示矩阵不可逆,inverse不被改变。
11592
11593
11594### OH_Drawing_MatrixIsEqual()
11595
11596```
11597bool OH_Drawing_MatrixIsEqual (OH_Drawing_Matrix* , OH_Drawing_Matrix* other )
11598```
11599
11600**描述**
11601
11602判断两个矩阵是否相等。
11603
11604本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11605
11606OH_Drawing_Matrix、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11607
11608**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11609
11610**起始版本:** 12
11611
11612**参数:**
11613
11614| 名称 | 描述 |
11615| -------- | -------- |
11616| OH_Drawing_Matrix | 指向用于判断的其中一个矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11617| other | 指向用于判断的另一个矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11618
11619**返回:**
11620
11621函数返回两个矩阵的比较结果,返回true表示两个矩阵相等,返回false表示两个矩阵不相等。
11622
11623
11624### OH_Drawing_MatrixIsIdentity()
11625
11626```
11627bool OH_Drawing_MatrixIsIdentity (OH_Drawing_Matrix* )
11628```
11629
11630**描述**
11631
11632判断矩阵是否是单位矩阵。
11633
11634本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11635
11636OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11637
11638**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11639
11640**起始版本:** 12
11641
11642**参数:**
11643
11644| 名称 | 描述 |
11645| -------- | -------- |
11646| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11647
11648**返回:**
11649
11650函数返回true表示矩阵是单位矩阵,函数返回false表示矩阵不是单位矩阵。
11651
11652
11653### OH_Drawing_MatrixPostRotate()
11654
11655```
11656void OH_Drawing_MatrixPostRotate (OH_Drawing_Matrix* , float degree, float px, float py )
11657```
11658
11659**描述**
11660
11661将矩阵设置为矩阵右乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。
11662
11663本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11664
11665OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11666
11667**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11668
11669**起始版本:** 12
11670
11671**参数:**
11672
11673| 名称 | 描述 |
11674| -------- | -------- |
11675| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11676| degree | 旋转角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 |
11677| px | 旋转中心点的横坐标。 |
11678| py | 旋转中心点的纵坐标。 |
11679
11680
11681### OH_Drawing_MatrixPostScale()
11682
11683```
11684void OH_Drawing_MatrixPostScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
11685```
11686
11687**描述**
11688
11689将矩阵设置为矩阵右乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。
11690
11691本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11692
11693OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11694
11695
11696**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11697
11698**起始版本:** 12
11699
11700**参数:**
11701
11702| 名称 | 描述 |
11703| -------- | -------- |
11704| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11705| sx | x轴方向的缩放比例因子,为负数时可看作是先关于y = px作镜像翻转后再进行缩放,该参数为浮点数。 |
11706| sy | y轴方向的缩放比例因子,为负数时可看作是先关于x = py作镜像翻转后再进行缩放,该参数为浮点数。 |
11707| px | 缩放中心点的横坐标。 |
11708| py | 缩放中心点的纵坐标。 |
11709
11710
11711### OH_Drawing_MatrixPostTranslate()
11712
11713```
11714void OH_Drawing_MatrixPostTranslate (OH_Drawing_Matrix* , float dx, float dy )
11715```
11716
11717**描述**
11718
11719将矩阵设置为矩阵右乘平移一定距离后的单位矩阵后得到的矩阵。
11720
11721本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11722
11723OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11724
11725
11726**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11727
11728**起始版本:** 12
11729
11730**参数:**
11731
11732| 名称 | 描述 |
11733| -------- | -------- |
11734| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11735| dx | 表示在x轴方向上的平移距离。 |
11736| dy | 表示在y轴方向上的平移距离。 |
11737
11738
11739### OH_Drawing_MatrixPreRotate()
11740
11741```
11742void OH_Drawing_MatrixPreRotate (OH_Drawing_Matrix* , float degree, float px, float py )
11743```
11744
11745**描述**
11746
11747将矩阵设置为矩阵左乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。
11748
11749本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11750
11751OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11752
11753
11754**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11755
11756**起始版本:** 12
11757
11758**参数:**
11759
11760| 名称 | 描述 |
11761| -------- | -------- |
11762| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11763| degree | 旋转角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 |
11764| px | 旋转中心点的横坐标。 |
11765| py | 旋转中心点的纵坐标。 |
11766
11767
11768### OH_Drawing_MatrixPreScale()
11769
11770```
11771void OH_Drawing_MatrixPreScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
11772```
11773
11774**描述**
11775
11776将矩阵设置为矩阵左乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。
11777
11778本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11779
11780OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11781
11782
11783**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11784
11785**起始版本:** 12
11786
11787**参数:**
11788
11789| 名称 | 描述 |
11790| -------- | -------- |
11791| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11792| sx | x轴方向的缩放比例因子,为负数时可看作是先关于y = px作镜像翻转后再进行缩放,该参数为浮点数。 |
11793| sy | y轴方向的缩放比例因子,为负数时可看作是先关于x = py作镜像翻转后再进行缩放,该参数为浮点数。 |
11794| px | 缩放中心点的横坐标。 |
11795| py | 缩放中心点的纵坐标。 |
11796
11797
11798### OH_Drawing_MatrixPreTranslate()
11799
11800```
11801void OH_Drawing_MatrixPreTranslate (OH_Drawing_Matrix* , float dx, float dy )
11802```
11803
11804**描述**
11805
11806将矩阵设置为矩阵左乘平移一定距离后的单位矩阵后得到的矩阵。
11807
11808本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11809
11810OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11811
11812**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11813
11814**起始版本:** 12
11815
11816**参数:**
11817
11818| 名称 | 描述 |
11819| -------- | -------- |
11820| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11821| dx | 表示在x轴方向上的平移距离。 |
11822| dy | 表示在y轴方向上的平移距离。 |
11823
11824
11825### OH_Drawing_MatrixReset()
11826
11827```
11828void OH_Drawing_MatrixReset (OH_Drawing_Matrix* )
11829```
11830
11831**描述**
11832
11833重置当前矩阵为单位矩阵: | 1 0 0 | | 0 1 0 | | 0 0 1 |。
11834
11835本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11836
11837OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11838
11839**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11840
11841**起始版本:** 12
11842
11843**参数:**
11844
11845| 名称 | 描述 |
11846| -------- | -------- |
11847| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11848
11849
11850### OH_Drawing_MatrixRotate()
11851
11852```
11853void OH_Drawing_MatrixRotate (OH_Drawing_Matrix* , float degree, float px, float py )
11854```
11855
11856**描述**
11857
11858设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点进行旋转。
11859
11860本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11861
11862OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11863
11864**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11865
11866**起始版本:** 12
11867
11868**参数:**
11869
11870| 名称 | 描述 |
11871| -------- | -------- |
11872| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11873| degree | 角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 |
11874| px | x轴上坐标点。 |
11875| py | y轴上坐标点。 |
11876
11877
11878### OH_Drawing_MatrixScale()
11879
11880```
11881void OH_Drawing_MatrixScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
11882```
11883
11884**描述**
11885
11886设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点,以sx和sy进行缩放。
11887
11888本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11889
11890OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11891
11892**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11893
11894**起始版本:** 12
11895
11896**参数:**
11897
11898| 名称 | 描述 |
11899| -------- | -------- |
11900| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11901| sx | 水平缩放因子,为负数时可看作是先关于y = px作镜像翻转后再进行缩放,该参数为浮点数。 |
11902| sy | 垂直缩放因子,为负数时可看作是先关于x = py作镜像翻转后再进行缩放,该参数为浮点数。 |
11903| px | x轴上坐标点。 |
11904| py | y轴上坐标点。 |
11905
11906
11907### OH_Drawing_MatrixSetMatrix()
11908
11909```
11910void OH_Drawing_MatrixSetMatrix (OH_Drawing_Matrix* , float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2 )
11911```
11912
11913**描述**
11914
11915用于给矩阵对象设置参数。
11916
11917本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11918
11919OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11920
11921**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11922
11923**起始版本:** 11
11924
11925**参数:**
11926
11927| 名称 | 描述 |
11928| -------- | -------- |
11929| OH_Drawing_Matrix | 指向矩阵对象的指针。 |
11930| scaleX | 水平缩放系数。 |
11931| skewX | 水平倾斜系数。 |
11932| transX | 水平位移系数。 |
11933| skewY | 垂直倾斜系数。 |
11934| scaleY | 垂直缩放系数。 |
11935| transY | 垂直位移系数。 |
11936| persp0 | X轴透视系数。 |
11937| persp1 | Y轴透视系数。 |
11938| persp2 | 透视缩放系数。 |
11939
11940
11941### OH_Drawing_MatrixSetPolyToPoly()
11942
11943```
11944bool OH_Drawing_MatrixSetPolyToPoly (OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, const OH_Drawing_Point2D* dst, uint32_t count )
11945```
11946
11947**描述**
11948
11949通过设置源点以及目标点,生成对应的变换矩阵。 源点以及目标点的个数要大于等于0,小于等于4。
11950
11951本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11952
11953OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
11954
11955count小于0或者大于4时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
11956
11957**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11958
11959**起始版本:** 12
11960
11961**参数:**
11962
11963| 名称 | 描述 |
11964| -------- | -------- |
11965| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11966| src | 源点数组,为NULL时count应当为0。 |
11967| dst | 目标点数组,个数要与源点相等,为NULL时count应当为0。 |
11968| count | 源点数组以及目标点数组的个数,为0时将矩阵对象设为单位矩阵。 |
11969
11970**返回:**
11971
11972函数返回是否可以生成对应矩阵以用来完成变换。true表示矩阵生成成功,false表示无法生成对应矩阵。
11973
11974
11975### OH_Drawing_MatrixSetRectToRect()
11976
11977```
11978bool OH_Drawing_MatrixSetRectToRect (OH_Drawing_Matrix* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, OH_Drawing_ScaleToFit stf )
11979```
11980
11981**描述**
11982
11983将矩阵以缩放方式适配目标矩阵。
11984
11985本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
11986
11987OH_Drawing_Matrix、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
11988
11989**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11990
11991**起始版本:** 12
11992
11993**参数:**
11994
11995| 名称 | 描述 |
11996| -------- | -------- |
11997| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
11998| src | 指向映射源的[OH_Drawing_Rect](#oh_drawing_rect)对象Rect的指针。 |
11999| dst | 指向要映射到的[OH_Drawing_Rect](#oh_drawing_rect)对象Rect的指针。 |
12000| stf | 缩放方式,支持方式[OH_Drawing_ScaleToFit](#oh_drawing_scaletofit)。 |
12001
12002**返回:**
12003
12004如果设置失败,则返回false;如果设置成功,则返回true;特别地,如果源矩形src的宽高任意一个小于等于0,则返回false,并将矩阵设置为单位矩阵;如果目标矩形dst的宽高任意一个小于等于0,则返回true,并将矩阵设置为除透视缩放系数为1外其余值皆为0的矩阵。
12005
12006### OH_Drawing_MatrixTranslate()
12007
12008```
12009void OH_Drawing_MatrixTranslate (OH_Drawing_Matrix* , float dx, float dy )
12010```
12011
12012**描述**
12013
12014设置矩阵为单位矩阵,并平移(dx, dy)。
12015
12016本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12017
12018OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12019
12020**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12021
12022**起始版本:** 12
12023
12024**参数:**
12025
12026| 名称 | 描述 |
12027| -------- | -------- |
12028| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
12029| dx | 水平方向平移距离,正数表示往x轴正方向平移,负数表示往x轴负方向平移,该参数为浮点数。 |
12030| dy | 垂直方向平移距离,正数表示往y轴正方向平移,负数表示往y轴负方向平移,该参数为浮点数。 |
12031
12032
12033### OH_Drawing_MemoryStreamCreate()
12034
12035```
12036OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate (const void* data, size_t length, bool copyData )
12037```
12038
12039**描述**
12040
12041创建一个内存流对象。
12042
12043本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12044
12045data为NULL或者length等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12046
12047**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12048
12049**起始版本:** 12
12050
12051**参数:**
12052
12053| 名称 | 描述 |
12054| -------- | -------- |
12055| data | 数据段。 |
12056| length | 数据段长度。 |
12057| copyData | 是否拷贝数据。true表示内存流对象会拷贝一份数据段数据, false表示内存流对象直接使用数据段数据,不拷贝。 |
12058
12059**返回:**
12060
12061函数会返回一个指针,指针指向创建的内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)。
12062
12063
12064### OH_Drawing_MemoryStreamDestroy()
12065
12066```
12067void OH_Drawing_MemoryStreamDestroy (OH_Drawing_MemoryStream* )
12068```
12069
12070**描述**
12071
12072销毁内存流对象并回收该对象占有内存。
12073
12074**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12075
12076**起始版本:** 12
12077
12078**参数:**
12079
12080| 名称 | 描述 |
12081| -------- | -------- |
12082| OH_Drawing_MemoryStream | 指向内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)的指针。 |
12083
12084
12085### OH_Drawing_PathAddArc()
12086
12087```
12088void OH_Drawing_PathAddArc (OH_Drawing_Path* , const OH_Drawing_Rect* , float startAngle, float sweepAngle )
12089```
12090
12091**描述**
12092
12093将圆弧添加到路径中,作为新轮廓的起点。从起始角度到扫掠角度添加弧, 添加的弧是椭圆边界椭圆的一部分,单位为度。正扫掠表示按顺时针方向延长弧, 负扫掠表示按逆时针方向延长弧。如果扫掠角度&lt;= -360°,或扫掠角度&gt;= 360°, 并且起始角度对90取模接近于0,则添加椭圆而不是弧。
12094
12095本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12096
12097OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12098
12099**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12100
12101**起始版本:** 12
12102
12103**参数:**
12104
12105| 名称 | 描述 |
12106| -------- | -------- |
12107| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12108| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
12109| startAngle | 弧的起始角度,单位为度。 |
12110| sweepAngle | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 |
12111
12112### OH_Drawing_PathAddOval()
12113
12114```
12115void OH_Drawing_PathAddOval (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection  )
12116```
12117
12118**描述**
12119
12120按指定方向,向路径添加椭圆。
12121
12122本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12123
12124OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
12125
12126OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12127
12128**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12129
12130**起始版本:** 12
12131
12132**参数:**
12133
12134| 名称 | 描述 |
12135| -------- | -------- |
12136| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12137| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
12138| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
12139
12140### OH_Drawing_PathAddOvalWithInitialPoint()
12141
12142```
12143void OH_Drawing_PathAddOvalWithInitialPoint (OH_Drawing_Path* , const OH_Drawing_Rect* , uint32_t start, OH_Drawing_PathDirection  )
12144```
12145
12146**描述**
12147
12148将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。
12149
12150本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12151
12152OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
12153
12154OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12155
12156**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12157
12158**起始版本:** 12
12159
12160**参数:**
12161
12162| 名称 | 描述 |
12163| -------- | -------- |
12164| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12165| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
12166| start | 表示椭圆初始点的索引。 |
12167| OH_Drawing_PathDirection | 表示绘制方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
12168
12169
12170### OH_Drawing_PathAddPath()
12171
12172```
12173void OH_Drawing_PathAddPath (OH_Drawing_Path* , const OH_Drawing_Path* src, const OH_Drawing_Matrix*  )
12174```
12175
12176**描述**
12177
12178将源路径矩阵变换后,添加到当前路径中。
12179
12180本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12181
12182OH_Drawing_Path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12183
12184**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12185
12186**起始版本:** 12
12187
12188**参数:**
12189
12190| 名称 | 描述 |
12191| -------- | -------- |
12192| OH_Drawing_Path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12193| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12194| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,为NULL表示单位矩阵。 |
12195
12196
12197### OH_Drawing_PathAddPathWithMatrixAndMode()
12198
12199```
12200void OH_Drawing_PathAddPathWithMatrixAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_PathAddMode  )
12201```
12202
12203**描述**
12204
12205将源路径矩阵变换后,以规定模式添加到当前路径中。
12206
12207本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12208
12209path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
12210
12211OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12212
12213**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12214
12215**起始版本:** 12
12216
12217**参数:**
12218
12219| 名称 | 描述 |
12220| -------- | -------- |
12221| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12222| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12223| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,为NULL表示单位矩阵。 |
12224| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 |
12225
12226
12227### OH_Drawing_PathAddPathWithMode()
12228
12229```
12230void OH_Drawing_PathAddPathWithMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode  )
12231```
12232
12233**描述**
12234
12235将源路径以规定模式添加到当前路径中。
12236
12237本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12238
12239path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
12240
12241OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12242
12243**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12244
12245**起始版本:** 12
12246
12247**参数:**
12248
12249| 名称 | 描述 |
12250| -------- | -------- |
12251| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12252| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12253| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 |
12254
12255
12256### OH_Drawing_PathAddPathWithOffsetAndMode()
12257
12258```
12259void OH_Drawing_PathAddPathWithOffsetAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy, OH_Drawing_PathAddMode  )
12260```
12261
12262**描述**
12263
12264将源路径偏移后,以规定模式添加到当前路径中。
12265
12266本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12267
12268path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12269
12270OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12271
12272**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12273
12274**起始版本:** 12
12275
12276**参数:**
12277
12278| 名称 | 描述 |
12279| -------- | -------- |
12280| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12281| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12282| dx | 添加到目标路径横坐标的偏移量。 |
12283| dy | 添加到目标路径纵坐标的偏移量。 |
12284| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 |
12285
12286
12287### OH_Drawing_PathAddRect()
12288
12289```
12290void OH_Drawing_PathAddRect (OH_Drawing_Path* , float left, float top, float right, float bottom, OH_Drawing_PathDirection  )
12291```
12292
12293**描述**
12294
12295按指定方向,将矩形添加到路径中,添加的路径的起始点为矩形左上角。
12296
12297本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12298
12299OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
12300
12301OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12302
12303**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12304
12305**起始版本:** 12
12306
12307**参数:**
12308
12309| 名称 | 描述 |
12310| -------- | -------- |
12311| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12312| left | 矩形左上角的x轴坐标。 |
12313| top | 矩形左上角的y轴坐标。 |
12314| right | 矩形右下角的x轴坐标。 |
12315| bottom | 矩形右下角的y轴坐标。 |
12316| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
12317
12318
12319### OH_Drawing_PathAddRectWithInitialCorner()
12320
12321```
12322void OH_Drawing_PathAddRectWithInitialCorner (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection , uint32_t start )
12323```
12324
12325**描述**
12326
12327按指定方向,向路径添加矩形轮廓。
12328
12329本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12330
12331OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
12332
12333OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12334
12335**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12336
12337**起始版本:** 12
12338
12339**参数:**
12340
12341| 名称 | 描述 |
12342| -------- | -------- |
12343| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12344| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 |
12345| OH_Drawing_PathDirection | 表示绘制方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
12346| start | 起始点的位置,表示从矩形的哪个角开始绘制路径。0:左上角,1:右上角,2:右下角,3:左下角。 |
12347
12348
12349### OH_Drawing_PathAddRoundRect()
12350
12351```
12352void OH_Drawing_PathAddRoundRect (OH_Drawing_Path* , const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection  )
12353```
12354
12355**描述**
12356
12357按指定方向,向路径添加圆角矩形轮廓。路径添加方向为顺时针时,起始点位于圆角矩形左下方圆角与左边界的交点;路径添加方向为逆时针时,起始点位于圆角矩形左上方圆角与左边界的交点。
12358
12359本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12360
12361OH_Drawing_Path、roundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
12362
12363OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12364
12365**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12366
12367**起始版本:** 12
12368
12369**参数:**
12370
12371| 名称 | 描述 |
12372| -------- | -------- |
12373| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12374| roundRect | 指向圆角矩形对象[OH_Drawing_RoundRect](#oh_drawing_roundrect)的指针。 |
12375| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 |
12376
12377
12378### OH_Drawing_PathArcTo()
12379
12380```
12381void OH_Drawing_PathArcTo (OH_Drawing_Path* , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg )
12382```
12383
12384**描述**
12385
12386用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。
12387
12388本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12389
12390OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12391
12392**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12393
12394**起始版本:** 8
12395
12396**参数:**
12397
12398| 名称 | 描述 |
12399| -------- | -------- |
12400| OH_Drawing_Path | 指向路径对象的指针。 |
12401| x1 | 包围椭圆的矩形左上角点位置的横坐标。 |
12402| y1 | 包围椭圆的矩形左上角点位置的纵坐标。 |
12403| x2 | 包围椭圆的矩形右下角点位置的横坐标。 |
12404| y2 | 包围椭圆的矩形右下角点位置的纵坐标。 |
12405| startDeg | 起始的角度。角度的起始方向(0°)为x轴正方向。 |
12406| sweepDeg | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 |
12407
12408
12409### OH_Drawing_PathClose()
12410
12411```
12412void OH_Drawing_PathClose (OH_Drawing_Path* )
12413```
12414
12415**描述**
12416
12417用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。
12418
12419本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12420
12421OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12422
12423**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12424
12425**起始版本:** 8
12426
12427**参数:**
12428
12429| 名称 | 描述 |
12430| -------- | -------- |
12431| OH_Drawing_Path | 指向路径对象的指针。 |
12432
12433
12434### OH_Drawing_PathConicTo()
12435
12436```
12437void OH_Drawing_PathConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight )
12438```
12439
12440**描述**
12441
12442在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线,其控制点为 (ctrlX, ctrlY),结束点为 (endX, endY)。
12443
12444本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12445
12446OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12447
12448**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12449
12450**起始版本:** 12
12451
12452**参数:**
12453
12454| 名称 | 描述 |
12455| -------- | -------- |
12456| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12457| ctrlX | 控制点位置的横坐标。 |
12458| ctrlY | 控制点位置的纵坐标。 |
12459| endX | 结束点位置的横坐标。 |
12460| endY | 结束点位置的纵坐标。 |
12461| weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。若小于等于0则等同于使用[OH_Drawing_PathLineTo](#oh_drawing_pathlineto)添加一条到结束点的线段,若为1则等同于[OH_Drawing_PathQuadTo](#oh_drawing_pathquadto)。 |
12462
12463
12464### OH_Drawing_PathContains()
12465
12466```
12467bool OH_Drawing_PathContains (OH_Drawing_Path* , float x, float y )
12468```
12469
12470**描述**
12471
12472判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1)。
12473
12474本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12475
12476OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12477
12478**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12479
12480**起始版本:** 12
12481
12482**参数:**
12483
12484| 名称 | 描述 |
12485| -------- | -------- |
12486| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12487| x | x轴上坐标点。 |
12488| y | y轴上坐标点。 |
12489
12490**返回:**
12491
12492函数返回true表示点在路径内,函数返回false表示点在路径外。
12493
12494
12495### OH_Drawing_PathCopy()
12496
12497```
12498OH_Drawing_Path* OH_Drawing_PathCopy (OH_Drawing_Path* )
12499```
12500
12501**描述**
12502
12503创建一个路径对象副本[OH_Drawing_Path](#oh_drawing_path),用于拷贝一个已有路径对象。
12504
12505本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12506
12507OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12508
12509**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12510
12511**起始版本:** 12
12512
12513**参数:**
12514
12515| 名称 | 描述 |
12516| -------- | -------- |
12517| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12518
12519**返回:**
12520
12521函数返回一个指针,指针指向创建的路径对象副本[OH_Drawing_Path](#oh_drawing_path)。
12522
12523
12524### OH_Drawing_PathCreate()
12525
12526```
12527OH_Drawing_Path* OH_Drawing_PathCreate (void )
12528```
12529
12530**描述**
12531
12532用于创建一个路径对象。
12533
12534**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12535
12536**起始版本:** 8
12537
12538**返回:**
12539
12540函数会返回一个指针,指针指向创建的路径对象。
12541
12542
12543### OH_Drawing_PathCubicTo()
12544
12545```
12546void OH_Drawing_PathCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
12547```
12548
12549**描述**
12550
12551用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。
12552
12553本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12554
12555OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12556
12557**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12558
12559**起始版本:** 8
12560
12561**参数:**
12562
12563| 名称 | 描述 |
12564| -------- | -------- |
12565| OH_Drawing_Path | 指向路径对象的指针。 |
12566| ctrlX1 | 第一个控制点位置的横坐标。 |
12567| ctrlY1 | 第一个控制点位置的纵坐标。 |
12568| ctrlX2 | 第二个控制点位置的横坐标。 |
12569| ctrlY2 | 第二个控制点位置的纵坐标。 |
12570| endX | 目标点位置的横坐标。 |
12571| endY | 目标点位置的纵坐标。 |
12572
12573
12574### OH_Drawing_PathDestroy()
12575
12576```
12577void OH_Drawing_PathDestroy (OH_Drawing_Path* )
12578```
12579
12580**描述**
12581
12582用于销毁路径对象并回收该对象占有的内存。
12583
12584**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12585
12586**起始版本:** 8
12587
12588**参数:**
12589
12590| 名称 | 描述 |
12591| -------- | -------- |
12592| OH_Drawing_Path | 指向路径对象的指针。 |
12593
12594
12595### OH_Drawing_PathEffectDestroy()
12596
12597```
12598void OH_Drawing_PathEffectDestroy (OH_Drawing_PathEffect* )
12599```
12600
12601**描述**
12602
12603销毁路径效果对象并回收该对象占有内存。
12604
12605**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12606
12607**起始版本:** 12
12608
12609**参数:**
12610
12611| 名称 | 描述 |
12612| -------- | -------- |
12613| OH_Drawing_PathEffect | 指向路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针。 |
12614
12615
12616### OH_Drawing_PathGetLength()
12617
12618```
12619float OH_Drawing_PathGetLength (OH_Drawing_Path* , bool forceClosed )
12620```
12621
12622**描述**
12623
12624获取当前路径的长度。
12625
12626本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12627
12628OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12629
12630**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12631
12632**起始版本:** 12
12633
12634**参数:**
12635
12636| 名称 | 描述 |
12637| -------- | -------- |
12638| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12639| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
12640
12641**返回:**
12642
12643函数返回当前路径的长度。
12644
12645
12646### OH_Drawing_PathLineTo()
12647
12648```
12649void OH_Drawing_PathLineTo (OH_Drawing_Path* , float x, float y )
12650```
12651
12652**描述**
12653
12654用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。
12655
12656本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12657
12658OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12659
12660**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12661
12662**起始版本:** 8
12663
12664**参数:**
12665
12666| 名称 | 描述 |
12667| -------- | -------- |
12668| OH_Drawing_Path | 指向路径对象的指针。 |
12669| x | 目标点的横坐标。 |
12670| y | 目标点的纵坐标。 |
12671
12672
12673### OH_Drawing_PathMoveTo()
12674
12675```
12676void OH_Drawing_PathMoveTo (OH_Drawing_Path* , float x, float y )
12677```
12678
12679**描述**
12680
12681用于设置自定义路径的起始点位置。
12682
12683本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12684
12685OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12686
12687**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12688
12689**起始版本:** 8
12690
12691**参数:**
12692
12693| 名称 | 描述 |
12694| -------- | -------- |
12695| OH_Drawing_Path | 指向路径对象的指针。 |
12696| x | 起始点的横坐标。 |
12697| y | 起始点的纵坐标。 |
12698
12699
12700### OH_Drawing_PathOffset()
12701
12702```
12703void OH_Drawing_PathOffset (OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy )
12704```
12705
12706**描述**
12707
12708将路径中的所有点沿着x轴和y轴方向偏移一定距离,并将结果存储到目标路径对象中。
12709
12710本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12711
12712path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12713
12714**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12715
12716**起始版本:** 12
12717
12718**参数:**
12719
12720| 名称 | 描述 |
12721| -------- | -------- |
12722| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12723| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,为NULL时会将结果存储到当前路径对象中。 |
12724| dx | x轴方向的偏移量。 |
12725| dy | y轴方向的偏移量。 |
12726
12727
12728### OH_Drawing_PathQuadTo()
12729
12730```
12731void OH_Drawing_PathQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY )
12732```
12733
12734**描述**
12735
12736用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。
12737
12738本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12739
12740OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12741
12742**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12743
12744**起始版本:** 8
12745
12746**参数:**
12747
12748| 名称 | 描述 |
12749| -------- | -------- |
12750| OH_Drawing_Path | 指向路径对象的指针。 |
12751| ctrlX | 控制点位置的横坐标。 |
12752| ctrlY | 控制点位置的纵坐标。 |
12753| endX | 目标点位置的横坐标。 |
12754| endY | 目标点位置的纵坐标。 |
12755
12756
12757### OH_Drawing_PathRConicTo()
12758
12759```
12760void OH_Drawing_PathRConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight )
12761```
12762
12763**描述**
12764
12765使用相对位置在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线。
12766
12767本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12768
12769OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12770
12771**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12772
12773**起始版本:** 12
12774
12775**参数:**
12776
12777| 名称 | 描述 |
12778| -------- | -------- |
12779| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12780| ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 |
12781| ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 |
12782| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 |
12783| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
12784| weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。若小于等于0则等同于使用[OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto)添加一条到结束点的线段,若为1则等同于[OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto)。 |
12785
12786
12787### OH_Drawing_PathRCubicTo()
12788
12789```
12790void OH_Drawing_PathRCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
12791```
12792
12793**描述**
12794
12795使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。
12796
12797本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12798
12799OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12800
12801**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12802
12803**起始版本:** 12
12804
12805**参数:**
12806
12807| 名称 | 描述 |
12808| -------- | -------- |
12809| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12810| ctrlX1 | 相对于路径终点的x轴偏移量,用于指定第一个控制点的横坐标。 |
12811| ctrlY1 | 相对于路径终点的y轴偏移量,用于指定第一个控制点的纵坐标。 |
12812| ctrlX2 | 相对于路径终点的x轴偏移量,用于指定第二个控制点的横坐标。 |
12813| ctrlY2 | 相对于路径终点的y轴偏移量,用于指定第二个控制点的纵坐标。 |
12814| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 |
12815| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
12816
12817
12818### OH_Drawing_PathReset()
12819
12820```
12821void OH_Drawing_PathReset (OH_Drawing_Path* )
12822```
12823
12824**描述**
12825
12826用于重置自定义路径数据。
12827
12828本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12829
12830OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12831
12832**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12833
12834**起始版本:** 8
12835
12836**参数:**
12837
12838| 名称 | 描述 |
12839| -------- | -------- |
12840| OH_Drawing_Path | 指向路径对象的指针。 |
12841
12842
12843### OH_Drawing_PathRLineTo()
12844
12845```
12846void OH_Drawing_PathRLineTo (OH_Drawing_Path* , float x, float y )
12847```
12848
12849**描述**
12850
12851使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。
12852
12853本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12854
12855OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12856
12857**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12858
12859**起始版本:** 12
12860
12861**参数:**
12862
12863| 名称 | 描述 |
12864| -------- | -------- |
12865| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12866| x | 相对于当前路径终点的x轴偏移量,用于指定目标点的横坐标。 |
12867| y | 相对于当前路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
12868
12869
12870### OH_Drawing_PathRMoveTo()
12871
12872```
12873void OH_Drawing_PathRMoveTo (OH_Drawing_Path* , float x, float y )
12874```
12875
12876**描述**
12877
12878用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。
12879
12880本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12881
12882OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12883
12884**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12885
12886**起始版本:** 12
12887
12888**参数:**
12889
12890| 名称 | 描述 |
12891| -------- | -------- |
12892| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12893| x | 目标点相对于当前路径终点的x轴偏移量,正数往x轴正方向偏移,负数往x轴负方向偏移,该参数为浮点数。 |
12894| y | 目标点相对于当前路径终点的y轴偏移量,正数往y轴正方向偏移,负数往y轴负方向偏移,该参数为浮点数。 |
12895
12896
12897### OH_Drawing_PathRQuadTo()
12898
12899```
12900void OH_Drawing_PathRQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY )
12901```
12902
12903**描述**
12904
12905使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。
12906
12907本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12908
12909OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12910
12911**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12912
12913**起始版本:** 12
12914
12915**参数:**
12916
12917| 名称 | 描述 |
12918| -------- | -------- |
12919| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12920| ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 |
12921| ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 |
12922| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 |
12923| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
12924
12925
12926### OH_Drawing_PathSetFillType()
12927
12928```
12929void OH_Drawing_PathSetFillType (OH_Drawing_Path* , OH_Drawing_PathFillType  )
12930```
12931
12932**描述**
12933
12934设置路径的填充类型,这个决定了路径内部区域的定义方式。例如,使用 Winding 填充类型时,路径内部区域由路径环绕的次数决定,而使用 EvenOdd 填充类型时,路径内部区域由路径环绕的次数是否为奇数决定。
12935
12936本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12937
12938OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
12939
12940OH_Drawing_PathFillType不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
12941
12942**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12943
12944**起始版本:** 12
12945
12946**参数:**
12947
12948| 名称 | 描述 |
12949| -------- | -------- |
12950| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12951| OH_Drawing_PathFillType | 路径填充规则[OH_Drawing_PathFillType](#oh_drawing_pathfilltype)。 |
12952
12953
12954### OH_Drawing_PathTransform()
12955
12956```
12957void OH_Drawing_PathTransform (OH_Drawing_Path* , const OH_Drawing_Matrix*  )
12958```
12959
12960**描述**
12961
12962对路径进行矩阵变换。
12963
12964本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12965
12966OH_Drawing_Path、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12967
12968**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12969
12970**起始版本:** 12
12971
12972**参数:**
12973
12974| 名称 | 描述 |
12975| -------- | -------- |
12976| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
12977| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
12978
12979
12980### OH_Drawing_PathTransformWithPerspectiveClip()
12981
12982```
12983void OH_Drawing_PathTransformWithPerspectiveClip (OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_Path* dst, bool applyPerspectiveClip )
12984```
12985
12986**描述**
12987
12988对路径进行矩阵变换。用转换后的路径替换目标路径,如果目标路径为空,则替换源路径。
12989
12990本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
12991
12992src、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
12993
12994**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
12995
12996**起始版本:** 12
12997
12998**参数:**
12999
13000| 名称 | 描述 |
13001| -------- | -------- |
13002| src | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
13003| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 |
13004| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 |
13005| applyPerspectiveClip | 表示变换路径是否应用透视裁剪。true表示应用透视裁剪,false表示不用透视裁剪。 |
13006
13007
13008### OH_Drawing_PenCreate()
13009
13010```
13011OH_Drawing_Pen* OH_Drawing_PenCreate (void )
13012```
13013
13014**描述**
13015
13016用于创建一个画笔对象。
13017
13018**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13019
13020**起始版本:** 8
13021
13022**返回:**
13023
13024函数会返回一个指针,指针指向创建的画笔对象。
13025
13026
13027### OH_Drawing_PenDestroy()
13028
13029```
13030void OH_Drawing_PenDestroy (OH_Drawing_Pen* )
13031```
13032
13033**描述**
13034
13035用于销毁画笔对象并回收该对象占有的内存。
13036
13037**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13038
13039**起始版本:** 8
13040
13041**参数:**
13042
13043| 名称 | 描述 |
13044| -------- | -------- |
13045| OH_Drawing_Pen | 指向画笔对象的指针。 |
13046
13047
13048### OH_Drawing_PenGetAlpha()
13049
13050```
13051uint8_t OH_Drawing_PenGetAlpha (const OH_Drawing_Pen* )
13052```
13053
13054**描述**
13055
13056获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。
13057
13058本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13059
13060OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13061
13062**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13063
13064**起始版本:** 11
13065
13066**参数:**
13067
13068| 名称 | 描述 |
13069| -------- | -------- |
13070| OH_Drawing_Pen | 表示指向画笔对象的指针。 |
13071
13072**返回:**
13073
13074返回一个8比特的值表示透明度。
13075
13076
13077### OH_Drawing_PenGetCap()
13078
13079```
13080OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen* )
13081```
13082
13083**描述**
13084
13085用于获取画笔笔帽的样式。
13086
13087本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13088
13089OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13090
13091**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13092
13093**起始版本:** 8
13094
13095**参数:**
13096
13097| 名称 | 描述 |
13098| -------- | -------- |
13099| OH_Drawing_Pen | 指向画笔对象的指针。 |
13100
13101**返回:**
13102
13103函数返回画笔笔帽样式。
13104
13105
13106### OH_Drawing_PenGetColor()
13107
13108```
13109uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen* )
13110```
13111
13112**描述**
13113
13114用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。
13115
13116本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13117
13118OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13119
13120**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13121
13122**起始版本:** 8
13123
13124**参数:**
13125
13126| 名称 | 描述 |
13127| -------- | -------- |
13128| OH_Drawing_Pen | 指向画笔对象的指针。 |
13129
13130**返回:**
13131
13132函数返回一个描述颜色的32位(ARGB)变量。
13133
13134
13135### OH_Drawing_PenGetFilter()
13136
13137```
13138void OH_Drawing_PenGetFilter (OH_Drawing_Pen* , OH_Drawing_Filter*  )
13139```
13140
13141**描述**
13142
13143从画笔获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。
13144
13145本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13146
13147OH_Drawing_Pen、OH_Drawing_Filter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13148
13149**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13150
13151**起始版本:** 12
13152
13153**参数:**
13154
13155| 名称 | 描述 |
13156| -------- | -------- |
13157| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
13158| OH_Drawing_Filter | 指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 |
13159
13160
13161### OH_Drawing_PenGetJoin()
13162
13163```
13164OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen* )
13165```
13166
13167**描述**
13168
13169用于获取画笔绘制折线转角的样式。
13170
13171本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13172
13173OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13174
13175**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13176
13177**起始版本:** 8
13178
13179**参数:**
13180
13181| 名称 | 描述 |
13182| -------- | -------- |
13183| OH_Drawing_Pen | 指向画笔对象的指针。 |
13184
13185**返回:**
13186
13187函数返回折线转角的样式。
13188
13189### OH_Drawing_PenGetMiterLimit()
13190
13191```
13192float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen* )
13193```
13194
13195**描述**
13196
13197用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。
13198
13199本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13200
13201OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13202
13203**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13204
13205**起始版本:** 8
13206
13207**参数:**
13208
13209| 名称 | 描述 |
13210| -------- | -------- |
13211| OH_Drawing_Pen | 指向画笔对象的指针。 |
13212
13213**返回:**
13214
13215函数返回尖角的限制值。
13216
13217
13218### OH_Drawing_PenGetWidth()
13219
13220```
13221float OH_Drawing_PenGetWidth (const OH_Drawing_Pen* )
13222```
13223
13224**描述**
13225
13226获取画笔的线宽,线宽描述了画笔绘制图形轮廓的宽度。
13227
13228本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13229
13230OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13231
13232**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13233
13234**起始版本:** 8
13235
13236**参数:**
13237
13238| 名称 | 描述 |
13239| -------- | -------- |
13240| OH_Drawing_Pen | 指向画笔对象的指针。 |
13241
13242**返回:**
13243
13244函数返回画笔的线宽。
13245
13246
13247### OH_Drawing_PenIsAntiAlias()
13248
13249```
13250bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen* )
13251```
13252
13253**描述**
13254
13255用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
13256
13257本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13258
13259OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13260
13261**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13262
13263**起始版本:** 8
13264
13265**参数:**
13266
13267| 名称 | 描述 |
13268| -------- | -------- |
13269| OH_Drawing_Pen | 指向画笔对象的指针。 |
13270
13271**返回:**
13272
13273函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。
13274
13275
13276### OH_Drawing_PenReset()
13277
13278```
13279void OH_Drawing_PenReset (OH_Drawing_Pen* )
13280```
13281
13282**描述**
13283
13284将画笔重置至初始值。
13285
13286本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13287
13288OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13289
13290**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13291
13292**起始版本:** 12
13293
13294**参数:**
13295
13296| 名称 | 描述 |
13297| -------- | -------- |
13298| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
13299
13300
13301### OH_Drawing_PenSetAlpha()
13302
13303```
13304void OH_Drawing_PenSetAlpha (OH_Drawing_Pen* , uint8_t alpha )
13305```
13306
13307**描述**
13308
13309为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。
13310
13311本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13312
13313OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13314
13315**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13316
13317**起始版本:** 11
13318
13319**参数:**
13320
13321| 名称 | 描述 |
13322| -------- | -------- |
13323| OH_Drawing_Pen | 表示指向画笔对象的指针。 |
13324| alpha | 表示要设置的透明度值,是一个8比特的变量。 |
13325
13326
13327### OH_Drawing_PenSetAntiAlias()
13328
13329```
13330void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen* , bool  )
13331```
13332
13333**描述**
13334
13335用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
13336
13337本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13338
13339OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13340
13341**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13342
13343**起始版本:** 8
13344
13345**参数:**
13346
13347| 名称 | 描述 |
13348| -------- | -------- |
13349| OH_Drawing_Pen | 指向画笔对象的指针。 |
13350| bool | 真为抗锯齿,假则不做抗锯齿处理。 |
13351
13352
13353### OH_Drawing_PenSetBlendMode()
13354
13355```
13356void OH_Drawing_PenSetBlendMode (OH_Drawing_Pen* , OH_Drawing_BlendMode  )
13357```
13358
13359**描述**
13360
13361为画笔设置一个混合器,该混合器实现了指定的混合模式枚举。
13362
13363本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13364
13365OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
13366
13367OH_Drawing_BlendMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
13368
13369**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13370
13371**起始版本:** 12
13372
13373**参数:**
13374
13375| 名称 | 描述 |
13376| -------- | -------- |
13377| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
13378| OH_Drawing_BlendMode | 混合模式枚举类型[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 |
13379
13380
13381### OH_Drawing_PenSetCap()
13382
13383```
13384void OH_Drawing_PenSetCap (OH_Drawing_Pen* , OH_Drawing_PenLineCapStyle  )
13385```
13386
13387**描述**
13388
13389用于设置画笔笔帽样式。
13390
13391本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13392
13393OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
13394
13395OH_Drawing_PenLineCapStyle不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
13396
13397**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13398
13399**起始版本:** 8
13400
13401**参数:**
13402
13403| 名称 | 描述 |
13404| -------- | -------- |
13405| OH_Drawing_Pen | 指向画笔对象的指针。 |
13406| OH_Drawing_PenLineCapStyle | 描述画笔笔帽样式的变量。 |
13407
13408
13409### OH_Drawing_PenSetColor()
13410
13411```
13412void OH_Drawing_PenSetColor (OH_Drawing_Pen* , uint32_t color )
13413```
13414
13415**描述**
13416
13417用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。
13418
13419本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13420
13421OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13422
13423**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13424
13425**起始版本:** 8
13426
13427**参数:**
13428
13429| 名称 | 描述 |
13430| -------- | -------- |
13431| OH_Drawing_Pen | 指向画笔对象的指针。 |
13432| color | 描述颜色的32位(ARGB)变量。 |
13433
13434
13435### OH_Drawing_PenSetFilter()
13436
13437```
13438void OH_Drawing_PenSetFilter (OH_Drawing_Pen* , OH_Drawing_Filter*  )
13439```
13440
13441**描述**
13442
13443设置画笔滤波器。
13444
13445本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13446
13447OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13448
13449**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13450
13451**起始版本:** 11
13452
13453**参数:**
13454
13455| 名称 | 描述 |
13456| -------- | -------- |
13457| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
13458| OH_Drawing_Filter | 指向滤波器[OH_Drawing_Filter](#oh_drawing_filter)的指针,为NULL表示清空画笔滤波器。 |
13459
13460
13461### OH_Drawing_PenSetJoin()
13462
13463```
13464void OH_Drawing_PenSetJoin (OH_Drawing_Pen* , OH_Drawing_PenLineJoinStyle  )
13465```
13466
13467**描述**
13468
13469用于设置画笔绘制转角的样式。
13470
13471本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13472
13473OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
13474
13475OH_Drawing_PenLineJoinStyle不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
13476
13477**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13478
13479**起始版本:** 8
13480
13481**参数:**
13482
13483| 名称 | 描述 |
13484| -------- | -------- |
13485| OH_Drawing_Pen | 指向画笔对象的指针。 |
13486| OH_Drawing_PenLineJoinStyle | 折线转角样式。 |
13487
13488
13489### OH_Drawing_PenSetMiterLimit()
13490
13491```
13492void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen* , float miter )
13493```
13494
13495**描述**
13496
13497用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。
13498
13499本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13500
13501OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13502
13503**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13504
13505**起始版本:** 8
13506
13507**参数:**
13508
13509| 名称 | 描述 |
13510| -------- | -------- |
13511| OH_Drawing_Pen | 指向画笔对象的指针。 |
13512| miter | 描述尖角限制值的变量。 |
13513
13514
13515### OH_Drawing_PenSetPathEffect()
13516
13517```
13518void OH_Drawing_PenSetPathEffect (OH_Drawing_Pen* , OH_Drawing_PathEffect*  )
13519```
13520
13521**描述**
13522
13523设置画笔路径效果。
13524
13525本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13526
13527OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13528
13529**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13530
13531**起始版本:** 12
13532
13533**参数:**
13534
13535| 名称 | 描述 |
13536| -------- | -------- |
13537| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
13538| OH_Drawing_PathEffect | 指向路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针,为NULL表示清空路径效果。 |
13539
13540
13541### OH_Drawing_PenSetShaderEffect()
13542
13543```
13544void OH_Drawing_PenSetShaderEffect (OH_Drawing_Pen* , OH_Drawing_ShaderEffect*  )
13545```
13546
13547**描述**
13548
13549设置画笔着色器效果。
13550
13551本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13552
13553OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13554
13555**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13556
13557**起始版本:** 11
13558
13559**参数:**
13560
13561| 名称 | 描述 |
13562| -------- | -------- |
13563| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
13564| OH_Drawing_ShaderEffect | 指向着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)的指针,为NULL表示清空着色器效果。 |
13565
13566
13567### OH_Drawing_PenSetWidth()
13568
13569```
13570void OH_Drawing_PenSetWidth (OH_Drawing_Pen* , float width )
13571```
13572
13573**描述**
13574
13575用于设置画笔的线宽。0线宽被视作特殊的极细线宽,在绘制时始终会被绘制为1像素,不随画布的缩放而改变;负数线宽在实际绘制时会被视作0线宽。
13576
13577本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13578
13579OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13580
13581**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13582
13583**起始版本:** 8
13584
13585**参数:**
13586
13587| 名称 | 描述 |
13588| -------- | -------- |
13589| OH_Drawing_Pen | 指向画笔对象的指针。 |
13590| width | 描述画笔线宽的变量。 |
13591
13592
13593### OH_Drawing_PointCreate()
13594
13595```
13596OH_Drawing_Point* OH_Drawing_PointCreate (float x, float y )
13597```
13598
13599**描述**
13600
13601用于创建一个坐标点对象。
13602
13603**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13604
13605**起始版本:** 11
13606
13607**参数:**
13608
13609| 名称 | 描述 |
13610| -------- | -------- |
13611| x | X轴坐标。 |
13612| y | Y轴坐标。 |
13613
13614**返回:**
13615
13616函数会返回一个指针,指针指向创建的坐标点对象。
13617
13618
13619### OH_Drawing_PointDestroy()
13620
13621```
13622void OH_Drawing_PointDestroy (OH_Drawing_Point* )
13623```
13624
13625**描述**
13626
13627用于销毁坐标点对象并回收该对象占有的内存。
13628
13629**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13630
13631**起始版本:** 11
13632
13633**参数:**
13634
13635| 名称 | 描述 |
13636| -------- | -------- |
13637| OH_Drawing_Point | 指向坐标点对象的指针。 |
13638
13639
13640### OH_Drawing_RectCopy()
13641
13642```
13643void OH_Drawing_RectCopy (OH_Drawing_Rect* sRect, OH_Drawing_Rect* dRect )
13644```
13645
13646**描述**
13647
13648用于将源矩形对象复制到目标矩形对象。
13649
13650本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13651
13652sRect、dRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13653
13654**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13655
13656**起始版本:** 12
13657
13658**参数:**
13659
13660| 名称 | 描述 |
13661| -------- | -------- |
13662| sRect | 指向源矩形对象的指针。 |
13663| dRect | 指向目标矩形对象的指针。 |
13664
13665
13666### OH_Drawing_RectCreate()
13667
13668```
13669OH_Drawing_Rect* OH_Drawing_RectCreate (float left, float top, float right, float bottom )
13670```
13671
13672**描述**
13673
13674用于创建一个矩形对象,不会对设置的坐标排序,即允许矩形设置的左上角坐标大于对应的矩形右下角坐标。
13675
13676**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13677
13678**起始版本:** 11
13679
13680**参数:**
13681
13682| 名称 | 描述 |
13683| -------- | -------- |
13684| left | 矩形左上角的横坐标。 |
13685| top | 矩形左上角的纵坐标。 |
13686| right | 矩形右下角的横坐标。 |
13687| bottom | 矩形右下角的纵坐标。 |
13688
13689**返回:**
13690
13691函数会返回一个指针,指针指向创建的矩形对象。
13692
13693
13694### OH_Drawing_RectDestroy()
13695
13696```
13697void OH_Drawing_RectDestroy (OH_Drawing_Rect* )
13698```
13699
13700**描述**
13701
13702用于销毁矩形对象并回收该对象占有的内存。
13703
13704**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13705
13706**起始版本:** 11
13707
13708**参数:**
13709
13710| 名称 | 描述 |
13711| -------- | -------- |
13712| OH_Drawing_Rect | 指向矩形对象的指针。 |
13713
13714
13715### OH_Drawing_RectGetBottom()
13716
13717```
13718float OH_Drawing_RectGetBottom (OH_Drawing_Rect* )
13719```
13720
13721**描述**
13722
13723用于获取给矩形设置的右下角的纵坐标。
13724
13725本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13726
13727OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13728
13729**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13730
13731**起始版本:** 12
13732
13733**参数:**
13734
13735| 名称 | 描述 |
13736| -------- | -------- |
13737| OH_Drawing_Rect | 指向矩形对象的指针。 |
13738
13739**返回:**
13740
13741矩形右下角的纵坐标。
13742
13743
13744### OH_Drawing_RectGetHeight()
13745
13746```
13747float OH_Drawing_RectGetHeight (OH_Drawing_Rect* )
13748```
13749
13750**描述**
13751
13752用于获取矩形对象高度,计算方式为设置的矩形的右下角纵坐标减去左上角纵坐标。
13753
13754本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13755
13756OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13757
13758**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13759
13760**起始版本:** 12
13761
13762**参数:**
13763
13764| 名称 | 描述 |
13765| -------- | -------- |
13766| OH_Drawing_Rect | 指向矩形对象的指针。 |
13767
13768**返回:**
13769
13770返回矩形对象的高度,单位为像素。
13771
13772
13773### OH_Drawing_RectGetLeft()
13774
13775```
13776float OH_Drawing_RectGetLeft (OH_Drawing_Rect* )
13777```
13778
13779**描述**
13780
13781用于获取给矩形设置的左上角的横坐标。
13782
13783本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13784
13785OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13786
13787**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13788
13789**起始版本:** 12
13790
13791**参数:**
13792
13793| 名称 | 描述 |
13794| -------- | -------- |
13795| OH_Drawing_Rect | 指向矩形对象的指针。 |
13796
13797**返回:**
13798
13799矩形左上角的横坐标。
13800
13801
13802### OH_Drawing_RectGetRight()
13803
13804```
13805float OH_Drawing_RectGetRight (OH_Drawing_Rect* )
13806```
13807
13808**描述**
13809
13810用于获取给矩形设置的右下角的横坐标。
13811
13812本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13813
13814OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13815
13816**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13817
13818**起始版本:** 12
13819
13820**参数:**
13821
13822| 名称 | 描述 |
13823| -------- | -------- |
13824| OH_Drawing_Rect | 指向矩形对象的指针。 |
13825
13826**返回:**
13827
13828矩形右下角的横坐标。
13829
13830
13831### OH_Drawing_RectGetTop()
13832
13833```
13834float OH_Drawing_RectGetTop (OH_Drawing_Rect* )
13835```
13836
13837**描述**
13838
13839用于获取给矩形设置的左上角的纵坐标。
13840
13841本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13842
13843OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13844
13845**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13846
13847**起始版本:** 12
13848
13849**参数:**
13850
13851| 名称 | 描述 |
13852| -------- | -------- |
13853| OH_Drawing_Rect | 指向矩形对象的指针。 |
13854
13855**返回:**
13856
13857矩形左上角的纵坐标。
13858
13859
13860### OH_Drawing_RectGetWidth()
13861
13862```
13863float OH_Drawing_RectGetWidth (OH_Drawing_Rect* )
13864```
13865
13866**描述**
13867
13868用于获取矩形对象的宽度,计算方式为设置的矩形的右下角横坐标减去左上角横坐标。
13869
13870本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13871
13872OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13873
13874**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13875
13876**起始版本:** 12
13877
13878**参数:**
13879
13880| 名称 | 描述 |
13881| -------- | -------- |
13882| OH_Drawing_Rect | 指向矩形对象的指针。 |
13883
13884**返回:**
13885
13886返回矩形对象的宽度,单位为像素。
13887
13888
13889### OH_Drawing_RectIntersect()
13890
13891```
13892bool OH_Drawing_RectIntersect (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other )
13893```
13894
13895**描述**
13896
13897用于判断两个矩形是否相交,若相交,将rect设置为两个矩形的交集。
13898
13899本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13900
13901rect、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13902
13903**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13904
13905**起始版本:** 12
13906
13907**参数:**
13908
13909| 名称 | 描述 |
13910| -------- | -------- |
13911| rect | 指向矩形对象的指针。 |
13912| other | 指向矩形对象的指针。 |
13913
13914**返回:**
13915
13916返回两个矩形是否相交的结果。true表示这两个矩形相交,rect被设置为两个矩形的交集;false表示不相交,rect保持不变。
13917
13918
13919### OH_Drawing_RectSetBottom()
13920
13921```
13922void OH_Drawing_RectSetBottom (OH_Drawing_Rect* rect, float bottom )
13923```
13924
13925**描述**
13926
13927用于设置矩形右下角的纵坐标。
13928
13929本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13930
13931rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13932
13933**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13934
13935**起始版本:** 12
13936
13937**参数:**
13938
13939| 名称 | 描述 |
13940| -------- | -------- |
13941| rect | 指向矩形对象的指针。 |
13942| bottom | 矩形右下角的纵坐标。 |
13943
13944
13945### OH_Drawing_RectSetLeft()
13946
13947```
13948void OH_Drawing_RectSetLeft (OH_Drawing_Rect* rect, float left )
13949```
13950
13951**描述**
13952
13953用于设置矩形左上角的横坐标。
13954
13955本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13956
13957rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13958
13959**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13960
13961**起始版本:** 12
13962
13963**参数:**
13964
13965| 名称 | 描述 |
13966| -------- | -------- |
13967| rect | 指向矩形对象的指针。 |
13968| left | 矩形左上角的横坐标。 |
13969
13970
13971### OH_Drawing_RectSetRight()
13972
13973```
13974void OH_Drawing_RectSetRight (OH_Drawing_Rect* rect, float right )
13975```
13976
13977**描述**
13978
13979用于设置矩形右下角的横坐标。
13980
13981本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
13982
13983rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
13984
13985**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
13986
13987**起始版本:** 12
13988
13989**参数:**
13990
13991| 名称 | 描述 |
13992| -------- | -------- |
13993| rect | 指向矩形对象的指针。 |
13994| right | 矩形右下角的横坐标。 |
13995
13996
13997### OH_Drawing_RectSetTop()
13998
13999```
14000void OH_Drawing_RectSetTop (OH_Drawing_Rect* rect, float top )
14001```
14002
14003**描述**
14004
14005用于设置矩形左上角的纵坐标。
14006
14007本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
14008
14009rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
14010
14011**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14012
14013**起始版本:** 12
14014
14015**参数:**
14016
14017| 名称 | 描述 |
14018| -------- | -------- |
14019| rect | 指向矩形对象的指针。 |
14020| top | 矩形左上角的纵坐标。 |
14021
14022
14023### OH_Drawing_RegionCreate()
14024
14025```
14026OH_Drawing_Region* OH_Drawing_RegionCreate (void )
14027```
14028
14029**描述**
14030
14031用于创建一个区域对象,实现更精确的图形控制。
14032
14033**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14034
14035**起始版本:** 12
14036
14037**返回:**
14038
14039函数会返回一个指针,指针指向创建的区域对象。
14040
14041
14042### OH_Drawing_RegionDestroy()
14043
14044```
14045void OH_Drawing_RegionDestroy (OH_Drawing_Region* )
14046```
14047
14048**描述**
14049
14050用于销毁区域对象并回收该对象占有的内存。
14051
14052**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14053
14054**起始版本:** 12
14055
14056**参数:**
14057
14058| 名称 | 描述 |
14059| -------- | -------- |
14060| OH_Drawing_Region | 指向区域对象的指针。 |
14061
14062
14063### OH_Drawing_RegionSetRect()
14064
14065```
14066bool OH_Drawing_RegionSetRect (OH_Drawing_Region* region, const OH_Drawing_Rect* rect )
14067```
14068
14069**描述**
14070
14071用于尝试给区域对象设置矩形边界。
14072
14073本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
14074
14075region、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
14076
14077**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14078
14079**起始版本:** 12
14080
14081**参数:**
14082
14083| 名称 | 描述 |
14084| -------- | -------- |
14085| region | 指向区域对象的指针。 |
14086| rect | 指向矩形对象的指针。 |
14087
14088**返回:**
14089
14090返回区域对象设置矩形边界是否成功的结果。true表示设置矩形边界成功,false表示设置矩形边界失败。
14091
14092
14093### OH_Drawing_RegisterFont()
14094
14095```
14096uint32_t OH_Drawing_RegisterFont (OH_Drawing_FontCollection* , const char* fontFamily, const char* familySrc )
14097```
14098
14099**描述**
14100
14101用于在字体管理器中注册自定义字体,支持的字体文件格式包含:ttf、otf。
14102
14103**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14104
14105**起始版本:** 11
14106
14107**参数:**
14108
14109| 名称 | 描述 |
14110| -------- | -------- |
14111| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针。 |
14112| fontFamily | 指需要注册的字体的字体名称。 |
14113| familySrc | 指需要注册的字体文件的路径。 |
14114
14115**返回:**
14116
14117返回错误代码,0为成功,1为文件不存在,2为打开文件失败,3为读取文件失败,4为寻找文件失败,5为获取大小失败,9文件损坏。
14118
14119
14120### OH_Drawing_RegisterFontBuffer()
14121
14122```
14123uint32_t OH_Drawing_RegisterFontBuffer (OH_Drawing_FontCollection* , const char* fontFamily, uint8_t* fontBuffer, size_t length )
14124```
14125
14126**描述**
14127
14128用于在字体管理器中注册字体缓冲区。
14129
14130**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14131
14132**起始版本:** 11
14133
14134**参数:**
14135
14136| 名称 | 描述 |
14137| -------- | -------- |
14138| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针。 |
14139| fontFamily | 指需要注册的字体的字体名称。 |
14140| fontBuffer | 指需要注册的字体文件的缓冲区。 |
14141| length | 指需要注册的字体文件的长度。 |
14142
14143**返回:**
14144
14145返回错误代码,0为成功,6为缓冲区大小为零,7为字体集合为空,9文件损坏。
14146
14147
14148### OH_Drawing_RoundRectCreate()
14149
14150```
14151OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate (const OH_Drawing_Rect* , float xRad, float yRad )
14152```
14153
14154**描述**
14155
14156用于创建一个圆角矩形对象。
14157
14158本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
14159
14160OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
14161
14162**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14163
14164**起始版本:** 11
14165
14166**参数:**
14167
14168| 名称 | 描述 |
14169| -------- | -------- |
14170| OH_Drawing_Rect | 指向矩形对象的指针。 |
14171| xRad | X轴上的圆角半径,小于或等于0时无效。 |
14172| yRad | Y轴上的圆角半径,小于或等于0时无效。 |
14173
14174**返回:**
14175
14176函数会返回一个指针,指针指向创建的圆角矩形对象。
14177
14178
14179### OH_Drawing_RoundRectDestroy()
14180
14181```
14182void OH_Drawing_RoundRectDestroy (OH_Drawing_RoundRect* )
14183```
14184
14185**描述**
14186
14187用于销毁圆角矩形对象并回收该对象占有的内存。
14188
14189**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14190
14191**起始版本:** 11
14192
14193**参数:**
14194
14195| 名称 | 描述 |
14196| -------- | -------- |
14197| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
14198
14199
14200### OH_Drawing_RoundRectGetCorner()
14201
14202```
14203OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos )
14204```
14205
14206**描述**
14207
14208用于获取圆角矩形中指定圆角位置的圆角半径。
14209
14210本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
14211
14212OH_Drawing_RoundRect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
14213
14214**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14215
14216**起始版本:** 12
14217
14218**参数:**
14219
14220| 名称 | 描述 |
14221| -------- | -------- |
14222| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
14223| pos | 圆角位置的枚举,支持类型可见[OH_Drawing_CornerPos](#oh_drawing_cornerpos)。 |
14224
14225**返回:**
14226
14227返回指定圆角位置的圆角半径结构体[OH_Drawing_Corner_Radii](#oh_drawing_corner_radii),其中包含x轴方向和y轴方向上的半径。
14228
14229
14230### OH_Drawing_RoundRectSetCorner()
14231
14232```
14233void OH_Drawing_RoundRectSetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii  )
14234```
14235
14236**描述**
14237
14238用于设置圆角矩形中指定圆角位置的圆角半径。
14239
14240本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
14241
14242OH_Drawing_RoundRect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
14243
14244**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14245
14246**起始版本:** 12
14247
14248**参数:**
14249
14250| 名称 | 描述 |
14251| -------- | -------- |
14252| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
14253| pos | 圆角位置的枚举,支持类型可见[OH_Drawing_CornerPos](#oh_drawing_cornerpos)。 |
14254| OH_Drawing_Corner_Radii | 圆角半径结构体[OH_Drawing_Corner_Radii](#oh_drawing_corner_radii),其中包含x轴方向和y轴方向上的半径,半径需大于或等于0。 |
14255
14256
14257### OH_Drawing_SamplingOptionsCreate()
14258
14259```
14260OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate (OH_Drawing_FilterMode , OH_Drawing_MipmapMode  )
14261```
14262
14263**描述**
14264
14265创建一个采样选项对象。
14266
14267本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
14268
14269OH_Drawing_MipmapMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
14270
14271**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14272
14273**起始版本:** 12
14274
14275**参数:**
14276
14277| 名称 | 描述 |
14278| -------- | -------- |
14279| OH_Drawing_FilterMode | 过滤采样模式[OH_Drawing_FilterMode](#oh_drawing_filtermode)。 |
14280| OH_Drawing_MipmapMode | 多级渐远纹理采样模式[OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)。 |
14281
14282**返回:**
14283
14284函数会返回一个指针,指针指向创建的采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)。
14285
14286
14287### OH_Drawing_SamplingOptionsDestroy()
14288
14289```
14290void OH_Drawing_SamplingOptionsDestroy (OH_Drawing_SamplingOptions* )
14291```
14292
14293**描述**
14294
14295销毁采样选项对象并回收该对象占有内存。
14296
14297**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14298
14299**起始版本:** 12
14300
14301**参数:**
14302
14303| 名称 | 描述 |
14304| -------- | -------- |
14305| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针。 |
14306
14307
14308### OH_Drawing_SetTextStyleBackgroundBrush()
14309
14310```
14311void OH_Drawing_SetTextStyleBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
14312```
14313
14314**描述**
14315
14316设置指定文本样式中的背景色画刷。
14317
14318**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14319
14320**起始版本:** 12
14321
14322**参数:**
14323
14324| 名称 | 描述 |
14325| -------- | -------- |
14326| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14327| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 |
14328
14329
14330### OH_Drawing_SetTextStyleBackgroundPen()
14331
14332```
14333void OH_Drawing_SetTextStyleBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
14334```
14335
14336**描述**
14337
14338设置指定文本样式中的背景色画笔。
14339
14340**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14341
14342**起始版本:** 12
14343
14344**参数:**
14345
14346| 名称 | 描述 |
14347| -------- | -------- |
14348| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14349| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 |
14350
14351
14352### OH_Drawing_SetTextStyleBaseLine()
14353
14354```
14355void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle* , int  )
14356```
14357
14358**描述**
14359
14360设置文本样式的字体基线位置。
14361
14362**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14363
14364**起始版本:** 8
14365
14366**参数:**
14367
14368| 名称 | 描述 |
14369| -------- | -------- |
14370| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14371| int | 设置字体基线位置,设置1基线位于底部,设置0或其它基线在中间偏下的位置,具体可见[OH_Drawing_TextBaseline](#oh_drawing_textbaseline)枚举。 |
14372
14373
14374### OH_Drawing_SetTextStyleColor()
14375
14376```
14377void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle* , uint32_t  )
14378```
14379
14380**描述**
14381
14382设置文本颜色。
14383
14384**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14385
14386**起始版本:** 8
14387
14388**参数:**
14389
14390| 名称 | 描述 |
14391| -------- | -------- |
14392| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14393| uint32_t | 颜色。 |
14394
14395
14396### OH_Drawing_SetTextStyleDecoration()
14397
14398```
14399void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle* , int  )
14400```
14401
14402**描述**
14403
14404设置指定文本样式中的装饰线类型,只能设置一个装饰线类型,添加多个需要使用[OH_Drawing_AddTextStyleDecoration](#oh_drawing_addtextstyledecoration)。
14405
14406**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14407
14408**起始版本:** 8
14409
14410**参数:**
14411
14412| 名称 | 描述 |
14413| -------- | -------- |
14414| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14415| int | 设置装饰,设置1为下划线,设置2为上划线,设置4为删除线,设置0或其它为无装饰,具体可见[OH_Drawing_TextDecoration](#oh_drawing_textdecoration)枚举。 |
14416
14417
14418### OH_Drawing_SetTextStyleDecorationColor()
14419
14420```
14421void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle* , uint32_t  )
14422```
14423
14424**描述**
14425
14426设置指定文本样式中的装饰线颜色。
14427
14428**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14429
14430**起始版本:** 8
14431
14432**参数:**
14433
14434| 名称 | 描述 |
14435| -------- | -------- |
14436| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14437| uint32_t | 颜色。 |
14438
14439
14440### OH_Drawing_SetTextStyleDecorationStyle()
14441
14442```
14443void OH_Drawing_SetTextStyleDecorationStyle (OH_Drawing_TextStyle* , int  )
14444```
14445
14446**描述**
14447
14448设置指定文本样式中的装饰线样式。
14449
14450**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14451
14452**起始版本:** 11
14453
14454**参数:**
14455
14456| 名称 | 描述 |
14457| -------- | -------- |
14458| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14459| int | 设置的文本装饰样式,支持可选的装饰样式具体可见[OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)枚举。 |
14460
14461
14462### OH_Drawing_SetTextStyleDecorationThicknessScale()
14463
14464```
14465void OH_Drawing_SetTextStyleDecorationThicknessScale (OH_Drawing_TextStyle* , double  )
14466```
14467
14468**描述**
14469
14470设置文本装饰线的厚度缩放比例。
14471
14472**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14473
14474**起始版本:** 11
14475
14476**参数:**
14477
14478| 名称 | 描述 |
14479| -------- | -------- |
14480| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14481| double | 缩放比例。 |
14482
14483
14484### OH_Drawing_SetTextStyleEllipsis()
14485
14486```
14487void OH_Drawing_SetTextStyleEllipsis (OH_Drawing_TextStyle* , const char*  )
14488```
14489
14490**描述**
14491
14492设置文本的省略号内容。
14493
14494**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14495
14496**起始版本:** 11
14497
14498**参数:**
14499
14500| 名称 | 描述 |
14501| -------- | -------- |
14502| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14503| char\* | 设置省略号内容,数据类型为指向char的指针。 |
14504
14505
14506### OH_Drawing_SetTextStyleEllipsisModal()
14507
14508```
14509void OH_Drawing_SetTextStyleEllipsisModal (OH_Drawing_TextStyle* , int  )
14510```
14511
14512**描述**
14513
14514设置文本的省略号样式。
14515
14516**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14517
14518**起始版本:** 11
14519
14520**参数:**
14521
14522| 名称 | 描述 |
14523| -------- | -------- |
14524| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14525| int | 设置省略号样式,支持可选的省略号样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 |
14526
14527
14528### OH_Drawing_SetTextStyleFontFamilies()
14529
14530```
14531void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle* , int , const char* fontFamilies[] )
14532```
14533
14534**描述**
14535
14536设置指定文本样式的字体家族类型。
14537
14538**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14539
14540**起始版本:** 8
14541
14542**参数:**
14543
14544| 名称 | 描述 |
14545| -------- | -------- |
14546| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14547| int | 字体名称数量,禁止填入负数。 |
14548| char* | 指向字体家族类型的指针。 |
14549
14550
14551### OH_Drawing_SetTextStyleFontHeight()
14552
14553```
14554void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle* , double  )
14555```
14556
14557**描述**
14558
14559设置行高,按当前字体大小的倍数进行设置。
14560
14561**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14562
14563**起始版本:** 8
14564
14565**参数:**
14566
14567| 名称 | 描述 |
14568| -------- | -------- |
14569| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14570| double | 当前字体大小的倍数。 |
14571
14572
14573### OH_Drawing_SetTextStyleFontSize()
14574
14575```
14576void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle* , double  )
14577```
14578
14579**描述**
14580
14581设置字号。
14582
14583**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14584
14585**起始版本:** 8
14586
14587**参数:**
14588
14589| 名称 | 描述 |
14590| -------- | -------- |
14591| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14592| double | 字号。 |
14593
14594
14595### OH_Drawing_SetTextStyleFontStyle()
14596
14597```
14598void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle* , int)
14599```
14600
14601**描述**
14602
14603为指定文本样式设置字体样式。
14604
14605**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14606
14607**起始版本:** 8
14608
14609**参数:**
14610
14611| 名称 | 描述 |
14612| -------- | -------- |
14613| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14614| int | 设置字体样式,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 |
14615
14616
14617### OH_Drawing_SetTextStyleFontStyleStruct()
14618
14619```
14620void OH_Drawing_SetTextStyleFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle, OH_Drawing_FontStyleStruct fontStyle )
14621```
14622
14623**描述**
14624
14625设置文本样式中的字体样式,包括字体字重、字体宽度和字体斜度。
14626
14627**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14628
14629**起始版本:** 12
14630
14631**参数:**
14632
14633| 名称 | 描述 |
14634| -------- | -------- |
14635| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14636| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 |
14637
14638
14639### OH_Drawing_SetTextStyleFontWeight()
14640
14641```
14642void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle* , int)
14643```
14644
14645**描述**
14646
14647为指定文本样式设置字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。
14648
14649**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14650
14651**起始版本:** 8
14652
14653**参数:**
14654
14655| 名称 | 描述 |
14656| -------- | -------- |
14657| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14658| 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)枚举。 |
14659
14660
14661### OH_Drawing_SetTextStyleForegroundBrush()
14662
14663```
14664void OH_Drawing_SetTextStyleForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
14665```
14666
14667**描述**
14668
14669设置指定文本样式中的前景色画刷。
14670
14671**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14672
14673**起始版本:** 12
14674
14675**参数:**
14676
14677| 名称 | 描述 |
14678| -------- | -------- |
14679| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14680| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 |
14681
14682
14683### OH_Drawing_SetTextStyleForegroundPen()
14684
14685```
14686void OH_Drawing_SetTextStyleForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
14687```
14688
14689**描述**
14690
14691设置指定文本样式中的前景色画笔。
14692
14693**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14694
14695**起始版本:** 12
14696
14697**参数:**
14698
14699| 名称 | 描述 |
14700| -------- | -------- |
14701| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14702| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 |
14703
14704
14705### OH_Drawing_SetTextStyleHalfLeading()
14706
14707```
14708void OH_Drawing_SetTextStyleHalfLeading (OH_Drawing_TextStyle* , bool  )
14709```
14710
14711**描述**
14712
14713设置文本为一半行间距。
14714
14715**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14716
14717**起始版本:** 11
14718
14719**参数:**
14720
14721| 名称 | 描述 |
14722| -------- | -------- |
14723| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14724| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 |
14725
14726
14727### OH_Drawing_SetTextStyleLetterSpacing()
14728
14729```
14730void OH_Drawing_SetTextStyleLetterSpacing (OH_Drawing_TextStyle* , double  )
14731```
14732
14733**描述**
14734
14735设置文本的字符间距。
14736
14737**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14738
14739**起始版本:** 11
14740
14741**参数:**
14742
14743| 名称 | 描述 |
14744| -------- | -------- |
14745| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14746| double | 间距大小。 |
14747
14748
14749### OH_Drawing_SetTextStyleLocale()
14750
14751```
14752void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle* , const char*  )
14753```
14754
14755**描述**
14756
14757设置文本语言环境。
14758
14759**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14760
14761**起始版本:** 8
14762
14763**参数:**
14764
14765| 名称 | 描述 |
14766| -------- | -------- |
14767| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14768| char | 语言类型,数据类型为指向char的指针,如'en'代表英文,'zh-Hans'代表简体中文,'zh-Hant'代表繁体中文。|
14769
14770
14771### OH_Drawing_SetTextStyleWordSpacing()
14772
14773```
14774void OH_Drawing_SetTextStyleWordSpacing (OH_Drawing_TextStyle* , double  )
14775```
14776
14777**描述**
14778
14779设置文本的单词间距。
14780
14781**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14782
14783**起始版本:** 11
14784
14785**参数:**
14786
14787| 名称 | 描述 |
14788| -------- | -------- |
14789| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
14790| double | 间距大小。 |
14791
14792
14793### OH_Drawing_SetTypographyStyleFontStyleStruct()
14794
14795```
14796void OH_Drawing_SetTypographyStyleFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle, OH_Drawing_FontStyleStruct fontStyle )
14797```
14798
14799**描述**
14800
14801设置排版样式中默认文本样式的字体样式,包括字体字重、字体宽度和字体斜度。
14802
14803**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14804
14805**起始版本:** 12
14806
14807**参数:**
14808
14809| 名称 | 描述 |
14810| -------- | -------- |
14811| OH_Drawing_TypographyStyle | 指向排版样式对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
14812| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 设置排版样式中文本样式的支柱样式的字体样式,包括字体字重、字体宽度和字体斜度。 |
14813
14814
14815### OH_Drawing_SetTypographyStyleTextStrutStyle()
14816
14817```
14818void OH_Drawing_SetTypographyStyleTextStrutStyle (OH_Drawing_TypographyStyle* , OH_Drawing_StrutStyle*  )
14819```
14820
14821**描述**
14822
14823设置文本支柱样式。
14824
14825**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14826
14827**起始版本:** 12
14828
14829**参数:**
14830
14831| 名称 | 描述 |
14832| -------- | -------- |
14833| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
14834| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针,由[OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle)获取。 |
14835
14836
14837### OH_Drawing_SetTypographyTextAlign()
14838
14839```
14840void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle* , int  )
14841```
14842
14843**描述**
14844
14845设置文本对齐方式。
14846
14847**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14848
14849**起始版本:** 8
14850
14851**参数:**
14852
14853| 名称 | 描述 |
14854| -------- | -------- |
14855| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
14856| int | 设置文本对齐方式,设置1为右对齐,设置2为居中对齐,设置3为两端对齐,设置4为与文字方向相同,设置5为文字方向相反,设置0或其它为左对齐,具体可见[OH_Drawing_TextAlign](#oh_drawing_textalign)枚举。 |
14857
14858
14859### OH_Drawing_SetTypographyTextBreakStrategy()
14860
14861```
14862void OH_Drawing_SetTypographyTextBreakStrategy (OH_Drawing_TypographyStyle* , int  )
14863```
14864
14865**描述**
14866
14867设置文本的中断策略。
14868
14869**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14870
14871**起始版本:** 11
14872
14873**参数:**
14874
14875| 名称 | 描述 |
14876| -------- | -------- |
14877| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
14878| int | 设置中断策略,支持可选的中断策略具体可见[OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy)枚举。 |
14879
14880
14881### OH_Drawing_SetTypographyTextDirection()
14882
14883```
14884void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle* , int  )
14885```
14886
14887**描述**
14888
14889设置指定排版样式中的文本方向。
14890
14891**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14892
14893**起始版本:** 8
14894
14895**参数:**
14896
14897| 名称 | 描述 |
14898| -------- | -------- |
14899| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
14900| int | 设置文本方向,设置0为从右到左,设置1或其他值为从左到右,具体可见[OH_Drawing_TextDirection](#oh_drawing_textdirection)枚举。 |
14901
14902
14903### OH_Drawing_SetTypographyTextEllipsis()
14904
14905```
14906void OH_Drawing_SetTypographyTextEllipsis (OH_Drawing_TypographyStyle* style, const char* ellipsis )
14907```
14908
14909**描述**
14910
14911设置排版样式省略号文本。
14912
14913**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14914
14915**起始版本:** 12
14916
14917**参数:**
14918
14919| 名称 | 描述 |
14920| -------- | -------- |
14921| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
14922| char | 省略号样式。 |
14923
14924
14925### OH_Drawing_SetTypographyTextEllipsisModal()
14926
14927```
14928void OH_Drawing_SetTypographyTextEllipsisModal (OH_Drawing_TypographyStyle* , int)
14929```
14930
14931**描述**
14932
14933设置排版样式省略模式。
14934
14935**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14936
14937**起始版本:** 11
14938
14939**参数:**
14940
14941| 名称 | 描述 |
14942| -------- | -------- |
14943| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
14944| int | 设置省略号样式,支持可选的省略号样式样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 |
14945
14946
14947### OH_Drawing_SetTypographyTextFontFamily()
14948
14949```
14950void OH_Drawing_SetTypographyTextFontFamily (OH_Drawing_TypographyStyle* , const char*  )
14951```
14952
14953**描述**
14954
14955设置字体家族的名称。
14956
14957**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14958
14959**起始版本:** 12
14960
14961**参数:**
14962
14963| 名称 | 描述 |
14964| -------- | -------- |
14965| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
14966| char | 字体家族的名称,数据类型为指向char的指针。 |
14967
14968
14969### OH_Drawing_SetTypographyTextFontHeight()
14970
14971```
14972void OH_Drawing_SetTypographyTextFontHeight (OH_Drawing_TypographyStyle* , double  )
14973```
14974
14975**描述**
14976
14977设置文本排版字体高度。
14978
14979**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
14980
14981**起始版本:** 12
14982
14983**参数:**
14984
14985| 名称 | 描述 |
14986| -------- | -------- |
14987| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
14988| double | 字体高度。 |
14989
14990
14991### OH_Drawing_SetTypographyTextFontSize()
14992
14993```
14994void OH_Drawing_SetTypographyTextFontSize (OH_Drawing_TypographyStyle* , double  )
14995```
14996
14997**描述**
14998
14999设置文本排版字号。
15000
15001**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15002
15003**起始版本:** 12
15004
15005**参数:**
15006
15007| 名称 | 描述 |
15008| -------- | -------- |
15009| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15010| double | 字号(大于0)。 |
15011
15012
15013### OH_Drawing_SetTypographyTextFontStyle()
15014
15015```
15016void OH_Drawing_SetTypographyTextFontStyle (OH_Drawing_TypographyStyle* , int)
15017```
15018
15019**描述**
15020
15021设置排版样式默认的字体样式。
15022
15023**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15024
15025**起始版本:** 12
15026
15027**参数:**
15028
15029| 名称 | 描述 |
15030| -------- | -------- |
15031| OH_Drawing_TypographyStyle | 指向排版样式对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15032| int | 设置字体样式,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 |
15033
15034
15035### OH_Drawing_SetTypographyTextFontWeight()
15036
15037```
15038void OH_Drawing_SetTypographyTextFontWeight (OH_Drawing_TypographyStyle* , int)
15039```
15040
15041**描述**
15042
15043设置排版样式默认字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。
15044
15045**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15046
15047**起始版本:** 12
15048
15049**参数:**
15050
15051| 名称 | 描述 |
15052| -------- | -------- |
15053| OH_Drawing_TypographyStyle | 指向排版样式对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15054| 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)枚举。 |
15055
15056
15057### OH_Drawing_SetTypographyTextHalfLeading()
15058
15059```
15060void OH_Drawing_SetTypographyTextHalfLeading (OH_Drawing_TypographyStyle* , bool  )
15061```
15062
15063**描述**
15064
15065设置文本排版是否为一半行间距。
15066
15067**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15068
15069**起始版本:** 12
15070
15071**参数:**
15072
15073| 名称 | 描述 |
15074| -------- | -------- |
15075| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15076| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 |
15077
15078
15079### OH_Drawing_SetTypographyTextLineStyleFontFamilies()
15080
15081```
15082void OH_Drawing_SetTypographyTextLineStyleFontFamilies (OH_Drawing_TypographyStyle* , int , const char* fontFamilies[] )
15083```
15084
15085**描述**
15086
15087设置文本排版行样式字体类型。
15088
15089**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15090
15091**起始版本:** 12
15092
15093**参数:**
15094
15095| 名称 | 描述 |
15096| -------- | -------- |
15097| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15098| int | 字体名称数量。 |
15099| char | 指向字体类型的指针。 |
15100
15101
15102### OH_Drawing_SetTypographyTextLineStyleFontHeight()
15103
15104```
15105void OH_Drawing_SetTypographyTextLineStyleFontHeight (OH_Drawing_TypographyStyle* , double  )
15106```
15107
15108**描述**
15109
15110设置文本排版行样式字体高度。
15111
15112**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15113
15114**起始版本:** 12
15115
15116**参数:**
15117
15118| 名称 | 描述 |
15119| -------- | -------- |
15120| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15121| double | 字体高度。 |
15122
15123
15124### OH_Drawing_SetTypographyTextLineStyleFontSize()
15125
15126```
15127void OH_Drawing_SetTypographyTextLineStyleFontSize (OH_Drawing_TypographyStyle* , double  )
15128```
15129
15130**描述**
15131
15132设置文本排版行样式字号。
15133
15134**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15135
15136**起始版本:** 12
15137
15138**参数:**
15139
15140| 名称 | 描述 |
15141| -------- | -------- |
15142| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15143| double | 字号(大于0)。 |
15144
15145
15146### OH_Drawing_SetTypographyTextLineStyleFontStyle()
15147
15148```
15149void OH_Drawing_SetTypographyTextLineStyleFontStyle (OH_Drawing_TypographyStyle* , int  )
15150```
15151
15152**描述**
15153
15154设置文本排版样式中支柱样式的字体样式。
15155
15156**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15157
15158**起始版本:** 12
15159
15160**参数:**
15161
15162| 名称 | 描述 |
15163| -------- | -------- |
15164| OH_Drawing_TypographyStyle | 指向文本风格指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15165| int | 设置字体样式,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 |
15166
15167
15168### OH_Drawing_SetTypographyTextLineStyleFontWeight()
15169
15170```
15171void OH_Drawing_SetTypographyTextLineStyleFontWeight (OH_Drawing_TypographyStyle* , int)
15172```
15173
15174**描述**
15175
15176设置排版样式中支柱样式的文本样式字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。
15177
15178**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15179
15180**起始版本:** 12
15181
15182**参数:**
15183
15184| 名称 | 描述 |
15185| -------- | -------- |
15186| OH_Drawing_TypographyStyle | 指向排版样式对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15187| 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)枚举。 |
15188
15189
15190### OH_Drawing_SetTypographyTextLineStyleHalfLeading()
15191
15192```
15193void OH_Drawing_SetTypographyTextLineStyleHalfLeading (OH_Drawing_TypographyStyle* , bool  )
15194```
15195
15196**描述**
15197
15198设置文本排版行样式中支柱样式是否开启一半行间距。
15199
15200**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15201
15202**起始版本:** 12
15203
15204**参数:**
15205
15206| 名称 | 描述 |
15207| -------- | -------- |
15208| OH_Drawing_TypographyStyle | 指向文本排版样式对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15209| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 |
15210
15211
15212### OH_Drawing_SetTypographyTextLineStyleOnly()
15213
15214```
15215void OH_Drawing_SetTypographyTextLineStyleOnly (OH_Drawing_TypographyStyle* , bool  )
15216```
15217
15218**描述**
15219
15220设置文本排版是否仅启用行样式。
15221
15222**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15223
15224**起始版本:** 12
15225
15226**参数:**
15227
15228| 名称 | 描述 |
15229| -------- | -------- |
15230| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15231| bool | 设置仅启用行样式是否生效,true表示生效,false表示不生效。 |
15232
15233
15234### OH_Drawing_SetTypographyTextLineStyleSpacingScale()
15235
15236```
15237void OH_Drawing_SetTypographyTextLineStyleSpacingScale (OH_Drawing_TypographyStyle* , double  )
15238```
15239
15240**描述**
15241
15242设置文本排版行样式间距比例。
15243
15244**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15245
15246**起始版本:** 12
15247
15248**参数:**
15249
15250| 名称 | 描述 |
15251| -------- | -------- |
15252| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15253| double | 间距比例。 |
15254
15255
15256### OH_Drawing_SetTypographyTextLocale()
15257
15258```
15259void OH_Drawing_SetTypographyTextLocale (OH_Drawing_TypographyStyle* style, const char* locale )
15260```
15261
15262**描述**
15263
15264设置指定排版样式的语言环境。
15265
15266**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15267
15268**起始版本:** 12
15269
15270**参数:**
15271
15272| 名称 | 描述 |
15273| -------- | -------- |
15274| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15275| char |  语言环境,数据类型为指向char的指针,如'en'代表英文,'zh-Hans'代表简体中文,'zh-Hant'代表繁体中文。 |
15276
15277
15278### OH_Drawing_SetTypographyTextMaxLines()
15279
15280```
15281void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle* , int  )
15282```
15283
15284**描述**
15285
15286设置文本最大行数。
15287
15288**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15289
15290**起始版本:** 8
15291
15292**参数:**
15293
15294| 名称 | 描述 |
15295| -------- | -------- |
15296| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15297| int | 最大行数。 |
15298
15299### OH_Drawing_SetTypographyTextSplitRatio()
15300
15301```
15302void OH_Drawing_SetTypographyTextSplitRatio (OH_Drawing_TypographyStyle* style, float textSplitRatio )
15303```
15304
15305**描述**
15306
15307设置文本划分比率。
15308
15309**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15310
15311**起始版本:** 12
15312
15313**参数:**
15314
15315| 名称 | 描述 |
15316| -------- | -------- |
15317| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15318| float | 文本划分比率。 |
15319
15320
15321### OH_Drawing_SetTypographyTextStyle()
15322
15323```
15324void OH_Drawing_SetTypographyTextStyle (OH_Drawing_TypographyStyle* , OH_Drawing_TextStyle*  )
15325```
15326
15327**描述**
15328
15329设置排版样式。
15330
15331**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15332
15333**起始版本:** 12
15334
15335**参数:**
15336
15337| 名称 | 描述 |
15338| -------- | -------- |
15339| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15340| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
15341
15342
15343### OH_Drawing_SetTypographyTextUseLineStyle()
15344
15345```
15346void OH_Drawing_SetTypographyTextUseLineStyle (OH_Drawing_TypographyStyle* , bool  )
15347```
15348
15349**描述**
15350
15351设置文本排版是否启用行样式。
15352
15353**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15354
15355**起始版本:** 12
15356
15357**参数:**
15358
15359| 名称 | 描述 |
15360| -------- | -------- |
15361| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15362| bool | 设置行样式是否启用,true表示启用,false表示不启用。 |
15363
15364
15365### OH_Drawing_SetTypographyTextWordBreakType()
15366
15367```
15368void OH_Drawing_SetTypographyTextWordBreakType (OH_Drawing_TypographyStyle* , int  )
15369```
15370
15371**描述**
15372
15373设置单词的断词方式。
15374
15375**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15376
15377**起始版本:** 11
15378
15379**参数:**
15380
15381| 名称 | 描述 |
15382| -------- | -------- |
15383| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
15384| int | 设置断词方式,支持可选的断词方式样式具体可见[OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype)枚举。 |
15385
15386
15387### OH_Drawing_ShaderEffectCreateImageShader()
15388
15389```
15390OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader (OH_Drawing_Image* , OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions* , const OH_Drawing_Matrix*  )
15391```
15392
15393**描述**
15394
15395创建图像着色器。此接口不建议用于录制类型的画布,会影响性能。
15396
15397本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15398
15399OH_Drawing_Image、OH_Drawing_SamplingOptions任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15400
15401tileX、tileY任意一个不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
15402
15403**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15404
15405**起始版本:** 12
15406
15407**参数:**
15408
15409| 名称 | 描述 |
15410| -------- | -------- |
15411| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 |
15412| tileX | 水平方向着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
15413| tileY | 垂直方向着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
15414| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针。 |
15415| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。如果矩阵指针为空,默认传入单位矩阵。 |
15416
15417**返回:**
15418
15419返回创建的着色器对象的指针。
15420
15421
15422### OH_Drawing_ShaderEffectCreateLinearGradient()
15423
15424```
15425OH_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  )
15426```
15427
15428**描述**
15429
15430创建着色器,在两个指定点之间生成线性渐变。
15431
15432本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15433
15434startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15435
15436OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
15437
15438**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15439
15440**起始版本:** 11
15441
15442**参数:**
15443
15444| 名称 | 描述 |
15445| -------- | -------- |
15446| startPt | 表示渐变的起点。 |
15447| endPt | 表示渐变的终点。 |
15448| colors | 表示在两个点之间分布的颜色。 |
15449| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在起点和终点之间。 |
15450| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
15451| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
15452
15453**返回:**
15454
15455返回创建的着色器对象的指针。
15456
15457
15458### OH_Drawing_ShaderEffectCreateRadialGradient()
15459
15460```
15461OH_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  )
15462```
15463
15464**描述**
15465
15466创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。
15467
15468本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15469
15470centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15471
15472OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
15473
15474**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15475
15476**起始版本:** 11
15477
15478**参数:**
15479
15480| 名称 | 描述 |
15481| -------- | -------- |
15482| centerPt | 表示渐变的圆心。 |
15483| radius | 表示渐变的圆半径,需为非负数。 |
15484| colors | 表示在径向上分布的颜色。 |
15485| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在径向上。 |
15486| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
15487| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
15488
15489**返回:**
15490
15491返回创建的着色器对象的指针。
15492
15493
15494### OH_Drawing_ShaderEffectCreateSweepGradient()
15495
15496```
15497OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient (const OH_Drawing_Point* centerPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode  )
15498```
15499
15500**描述**
15501
15502创建着色器,在给定中心的情况下生成扇形渐变。颜色从0°到360°渐变被称为扇形渐变。
15503
15504本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15505
15506centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15507
15508OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
15509
15510**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15511
15512**起始版本:** 11
15513
15514**参数:**
15515
15516| 名称 | 描述 |
15517| -------- | -------- |
15518| centerPt | 表示渐变的圆心。 |
15519| colors | 表示在两个点之间分布的颜色。 |
15520| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在0°和360°之间。 |
15521| size | 表示颜色和位置的数量(如果pos不为NULL)。 |
15522| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 |
15523
15524**返回:**
15525
15526返回创建的着色器对象的指针。
15527
15528
15529### OH_Drawing_ShaderEffectDestroy()
15530
15531```
15532void OH_Drawing_ShaderEffectDestroy (OH_Drawing_ShaderEffect* )
15533```
15534
15535**描述**
15536
15537销毁着色器对象,并收回该对象占用的内存。
15538
15539**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15540
15541**起始版本:** 11
15542
15543**参数:**
15544
15545| 名称 | 描述 |
15546| -------- | -------- |
15547| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针。 |
15548
15549
15550### OH_Drawing_SurfaceCreateFromGpuContext()
15551
15552```
15553OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext (OH_Drawing_GpuContext* , bool budgeted, OH_Drawing_Image_Info  )
15554```
15555
15556**描述**
15557
15558使用图形处理器上下文创建一个surface对象,用于管理画布绘制的内容。
15559
15560本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15561
15562OH_Drawing_GpuContext为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15563
15564**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15565
15566**起始版本:** 12
15567
15568**参数:**
15569
15570| 名称 | 描述 |
15571| -------- | -------- |
15572| OH_Drawing_GpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 |
15573| budgeted | 用于控制内存分配是否计入缓存预算,true则计入高速缓存预算,false则不计入高速缓存预算。 |
15574| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)结构体。 |
15575
15576**返回:**
15577
15578返回一个指针,指针指向创建的surface对象[OH_Drawing_Surface](#oh_drawing_surface)。
15579
15580
15581### OH_Drawing_SurfaceDestroy()
15582
15583```
15584void OH_Drawing_SurfaceDestroy (OH_Drawing_Surface* )
15585```
15586
15587**描述**
15588
15589销毁surface对象并回收该对象占用的内存。
15590
15591**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15592
15593**起始版本:** 12
15594
15595**参数:**
15596
15597| 名称 | 描述 |
15598| -------- | -------- |
15599| OH_Drawing_Surface | 指向创建的surface对象的指针。 |
15600
15601
15602### OH_Drawing_SurfaceGetCanvas()
15603
15604```
15605OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas (OH_Drawing_Surface* )
15606```
15607
15608**描述**
15609
15610通过surface对象获取画布对象。
15611
15612本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15613
15614OH_Drawing_Surface为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15615
15616**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15617
15618**起始版本:** 12
15619
15620**参数:**
15621
15622| 名称 | 描述 |
15623| -------- | -------- |
15624| OH_Drawing_Surface | 指向创建的surface对象的指针。 |
15625
15626**返回:**
15627
15628返回一个指针,指针指向创建的画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)。返回的指针不需要由调用者管理。
15629
15630
15631### OH_Drawing_TextBlobBuilderAllocRunPos()
15632
15633```
15634const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos (OH_Drawing_TextBlobBuilder* , const OH_Drawing_Font* , int32_t count, const OH_Drawing_Rect*  )
15635```
15636
15637**描述**
15638
15639申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理, 当调用[OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake)后禁止使用。
15640
15641本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15642
15643OH_Drawing_TextBlobBuilder、OH_Drawing_Font任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15644
15645**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15646
15647**起始版本:** 11
15648
15649**参数:**
15650
15651| 名称 | 描述 |
15652| -------- | -------- |
15653| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 |
15654| OH_Drawing_Font | 指向字体对象的指针。 |
15655| count | 文字的数量。 |
15656| OH_Drawing_Rect | 文本的边界框,为NULL表示不设置边界框。 |
15657
15658
15659### OH_Drawing_TextBlobBuilderCreate()
15660
15661```
15662OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate (void )
15663```
15664
15665**描述**
15666
15667用于创建一个文本构造器对象。
15668
15669**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15670
15671**起始版本:** 11
15672
15673**返回:**
15674
15675函数会返回一个指针,指针指向创建的文本构造器对象。
15676
15677
15678### OH_Drawing_TextBlobBuilderDestroy()
15679
15680```
15681void OH_Drawing_TextBlobBuilderDestroy (OH_Drawing_TextBlobBuilder* )
15682```
15683
15684**描述**
15685
15686用于销毁文本构造器对象并回收该对象占有的内存。
15687
15688**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15689
15690**起始版本:** 11
15691
15692**参数:**
15693
15694| 名称 | 描述 |
15695| -------- | -------- |
15696| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 |
15697
15698
15699### OH_Drawing_TextBlobBuilderMake()
15700
15701```
15702OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake (OH_Drawing_TextBlobBuilder* )
15703```
15704
15705**描述**
15706
15707用于从文本构造器中创建文本对象。
15708
15709本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15710
15711OH_Drawing_TextBlobBuilder为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15712
15713**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15714
15715**起始版本:** 11
15716
15717**参数:**
15718
15719| 名称 | 描述 |
15720| -------- | -------- |
15721| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 |
15722
15723**返回:**
15724
15725返回一个指针,指针指向创建的文本对象。
15726
15727
15728### OH_Drawing_TextBlobCreateFromPosText()
15729
15730```
15731OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText (const void * text, size_t byteLength, OH_Drawing_Point2D* , const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
15732```
15733
15734**描述**
15735
15736使用文本创建文本对象,文本对象中每个字符的坐标由OH_Drawing_Point2D数组中对应的坐标信息决定。
15737
15738本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15739
15740text、OH_Drawing_Point2D、OH_Drawing_Font任意一个为NULL或byteLength等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
15741
15742OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
15743
15744**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15745
15746**起始版本:** 12
15747
15748**参数:**
15749
15750| 名称 | 描述 |
15751| -------- | -------- |
15752| text | 指向文本的指针。 |
15753| byteLength | 文本的字节长度。 |
15754| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 二维点[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)数组首地址,数组个数由[OH_Drawing_FontCountText](#oh_drawing_fontcounttext)计算结果决定。 |
15755| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
15756| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 |
15757
15758**返回:**
15759
15760函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。
15761
15762
15763### OH_Drawing_TextBlobCreateFromString()
15764
15765```
15766OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString (const char* str, const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
15767```
15768
15769**描述**
15770
15771使用字符串创建文本对象。
15772
15773本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15774
15775str、OH_Drawing_Font任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
15776
15777OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
15778
15779**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15780
15781**起始版本:** 12
15782
15783**参数:**
15784
15785| 名称 | 描述 |
15786| -------- | -------- |
15787| str | 指向字符串的指针。 |
15788| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
15789| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。当前只有TEXT_ENCODING_UTF8生效,其余编码类型也会被视为TEXT_ENCODING_UTF8。 |
15790
15791**返回:**
15792
15793函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。
15794
15795
15796### OH_Drawing_TextBlobCreateFromText()
15797
15798```
15799OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText (const void * text, size_t byteLength, const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
15800```
15801
15802**描述**
15803
15804使用文本创建一个文本对象。
15805
15806本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15807
15808text、OH_Drawing_Font任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;
15809
15810OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
15811
15812**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15813
15814**起始版本:** 12
15815
15816**参数:**
15817
15818| 名称 | 描述 |
15819| -------- | -------- |
15820| text | 指向文本的指针。 |
15821| byteLength | 文本的字节长度。 |
15822| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 |
15823| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 |
15824
15825**返回:**
15826
15827函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。
15828
15829
15830### OH_Drawing_TextBlobDestroy()
15831
15832```
15833void OH_Drawing_TextBlobDestroy (OH_Drawing_TextBlob* )
15834```
15835
15836**描述**
15837
15838用于销毁文本对象并回收该对象占有的内存。
15839
15840**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15841
15842**起始版本:** 11
15843
15844**参数:**
15845
15846| 名称 | 描述 |
15847| -------- | -------- |
15848| OH_Drawing_TextBlob | 指向文本对象的指针。 |
15849
15850
15851### OH_Drawing_TextBlobGetBounds()
15852
15853```
15854void OH_Drawing_TextBlobGetBounds (OH_Drawing_TextBlob* , OH_Drawing_Rect*  )
15855```
15856
15857**描述**
15858
15859获取文本对象的边界范围。
15860
15861本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
15862
15863OH_Drawing_TextBlob、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
15864
15865**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15866
15867**起始版本:** 12
15868
15869**参数:**
15870
15871| 名称 | 描述 |
15872| -------- | -------- |
15873| OH_Drawing_TextBlob | 指向文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)的指针。 |
15874| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针, 开发者可调用[OH_Drawing_RectCreate](#oh_drawing_rectcreate)接口创建。 |
15875
15876
15877### OH_Drawing_TextStyleAddFontFeature()
15878
15879```
15880void OH_Drawing_TextStyleAddFontFeature (OH_Drawing_TextStyle* , const char* tag, int value )
15881```
15882
15883**描述**
15884
15885设置文本样式中指定字体特征是否启用。
15886
15887**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15888
15889**起始版本:** 12
15890
15891**参数:**
15892
15893| 名称 | 描述 |
15894| -------- | -------- |
15895| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
15896| char | 指向字体特征键值对中关键字所标识的字符串。 |
15897| int | 要设置的字体特征键值对的值。 |
15898
15899
15900### OH_Drawing_TextStyleAddFontVariation()
15901
15902```
15903void OH_Drawing_TextStyleAddFontVariation (OH_Drawing_TextStyle* , const char* , const float  )
15904```
15905
15906**描述**
15907
15908添加可变字体属性。对应的字体文件(.ttf文件)需要支持可变调节,此接口才能生效。当对应的字体不支持可变调节时,此接口调用不生效。
15909
15910**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15911
15912**起始版本:** 12
15913
15914**参数:**
15915
15916| 名称 | 描述 |
15917| -------- | -------- |
15918| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
15919| char\* | 可变字体属性键值对中的键。目前仅支持'wght',表示字重属性。 |
15920| float | 设置的可变字体属性键值对的值。目前默认字体下字重属性支持的取值范围为[0,900]。 |
15921
15922
15923### OH_Drawing_TextStyleAddShadow()
15924
15925```
15926void OH_Drawing_TextStyleAddShadow (OH_Drawing_TextStyle* , const OH_Drawing_TextShadow*  )
15927```
15928
15929**描述**
15930
15931字体阴影容器中添加字体阴影元素。
15932
15933**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15934
15935**起始版本:** 12
15936
15937**参数:**
15938
15939| 名称 | 描述 |
15940| -------- | -------- |
15941| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
15942| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 |
15943
15944
15945### OH_Drawing_TextStyleClearFontFeature()
15946
15947```
15948void OH_Drawing_TextStyleClearFontFeature (OH_Drawing_TextStyle* )
15949```
15950
15951**描述**
15952
15953清除指定文本样式的字体特征map容器中所有内容。
15954
15955**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15956
15957**起始版本:** 12
15958
15959**参数:**
15960
15961| 名称 | 描述 |
15962| -------- | -------- |
15963| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
15964
15965
15966### OH_Drawing_TextStyleClearShadows()
15967
15968```
15969void OH_Drawing_TextStyleClearShadows (OH_Drawing_TextStyle* )
15970```
15971
15972**描述**
15973
15974清除字体阴影容器中的所有元素。
15975
15976**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15977
15978**起始版本:** 12
15979
15980**参数:**
15981
15982| 名称 | 描述 |
15983| -------- | -------- |
15984| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
15985
15986
15987### OH_Drawing_TextStyleDestroyFontFamilies()
15988
15989```
15990void OH_Drawing_TextStyleDestroyFontFamilies (char** fontFamilies, size_t num)
15991```
15992
15993**描述**
15994
15995释放长度为num的字体家族名称列表占用的内存。
15996
15997**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
15998
15999**起始版本:** 12
16000
16001**参数:**
16002
16003| 名称 | 描述 |
16004| -------- | -------- |
16005| fontFamilies | 指向字体家族名称列表的指针。 |
16006| num | 字体家族名称列表的长度。 |
16007
16008
16009### OH_Drawing_TextStyleDestroyFontFeatures()
16010
16011```
16012void OH_Drawing_TextStyleDestroyFontFeatures (OH_Drawing_FontFeature* , size_t fontFeatureSize )
16013```
16014
16015**描述**
16016
16017释放存放字体特征所有内容的结构体数组所占用的空间。
16018
16019**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16020
16021**起始版本:** 12
16022
16023**参数:**
16024
16025| 名称 | 描述 |
16026| -------- | -------- |
16027| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | 指向存放容器所有键值对的结构体数组指针,由[OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures)获取。 |
16028| fontFeatureSize | 存放容器所有键值对的结构体数组的大小。 |
16029
16030
16031### OH_Drawing_TextStyleGetBackgroundBrush()
16032
16033```
16034void OH_Drawing_TextStyleGetBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
16035```
16036
16037**描述**
16038
16039返回设置的背景色画刷。
16040
16041**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16042
16043**起始版本:** 12
16044
16045**参数:**
16046
16047| 名称 | 描述 |
16048| -------- | -------- |
16049| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16050| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 |
16051
16052
16053### OH_Drawing_TextStyleGetBackgroundPen()
16054
16055```
16056void OH_Drawing_TextStyleGetBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
16057```
16058
16059**描述**
16060
16061返回设置的背景色画笔。
16062
16063**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16064
16065**起始版本:** 12
16066
16067**参数:**
16068
16069| 名称 | 描述 |
16070| -------- | -------- |
16071| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16072| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 |
16073
16074
16075### OH_Drawing_TextStyleGetBaseline()
16076
16077```
16078OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline (OH_Drawing_TextStyle* )
16079```
16080
16081**描述**
16082
16083获取指定文本样式的字体基线位置。
16084
16085**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16086
16087**起始版本:** 12
16088
16089**参数:**
16090
16091| 名称 | 描述 |
16092| -------- | -------- |
16093| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16094
16095**返回:**
16096
16097返回字体基线位置,具体可见[OH_Drawing_TextBaseline](#oh_drawing_textbaseline)枚举。
16098
16099
16100### OH_Drawing_TextStyleGetBaselineShift()
16101
16102```
16103double OH_Drawing_TextStyleGetBaselineShift (OH_Drawing_TextStyle*)
16104```
16105
16106**描述**
16107
16108获取指定文本样式的基线偏移。
16109
16110**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16111
16112**起始版本:** 12
16113
16114**参数:**
16115
16116| 名称 | 描述 |
16117| -------- | -------- |
16118| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16119
16120**返回:**
16121
16122double 基线偏移的值。
16123
16124
16125### OH_Drawing_TextStyleGetColor()
16126
16127```
16128uint32_t OH_Drawing_TextStyleGetColor (OH_Drawing_TextStyle* )
16129```
16130
16131**描述**
16132
16133获取文本颜色。
16134
16135**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16136
16137**起始版本:** 12
16138
16139**参数:**
16140
16141| 名称 | 描述 |
16142| -------- | -------- |
16143| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16144
16145**返回:**
16146
16147uint32_t 返回文本颜色。
16148
16149
16150### OH_Drawing_TextStyleGetDecorationStyle()
16151
16152```
16153OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle (OH_Drawing_TextStyle* )
16154```
16155
16156**描述**
16157
16158获取文本装饰样式。
16159
16160**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16161
16162**起始版本:** 12
16163
16164**参数:**
16165
16166| 名称 | 描述 |
16167| -------- | -------- |
16168| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16169
16170**返回:**
16171
16172返回文本装饰样式,具体可见[OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)枚举。
16173
16174
16175### OH_Drawing_TextStyleGetFontFamilies()
16176
16177```
16178char** OH_Drawing_TextStyleGetFontFamilies (OH_Drawing_TextStyle* , size_t* num )
16179```
16180
16181**描述**
16182
16183获取字体类型名称列表。
16184
16185**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16186
16187**起始版本:** 12
16188
16189**参数:**
16190
16191| 名称 | 描述 |
16192| -------- | -------- |
16193| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16194| num | 指向字体名称数量的指针。 |
16195
16196**返回:**
16197
16198返回获取到的字体类型列表。
16199
16200
16201### OH_Drawing_TextStyleGetFontFeatures()
16202
16203```
16204OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures (OH_Drawing_TextStyle* )
16205```
16206
16207**描述**
16208
16209获取指定文本样式的字体特征map容器中所有内容。
16210
16211**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16212
16213**起始版本:** 12
16214
16215**参数:**
16216
16217| 名称 | 描述 |
16218| -------- | -------- |
16219| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16220
16221**返回:**
16222
16223[OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) 要获取的字体特征容器的所有内容,指向存放容器所有键值对的一个结构体数组。
16224
16225
16226### OH_Drawing_TextStyleGetFontFeatureSize()
16227
16228```
16229size_t OH_Drawing_TextStyleGetFontFeatureSize (OH_Drawing_TextStyle* )
16230```
16231
16232**描述**
16233
16234获取指定文本样式中字体特征map容器的大小。
16235
16236**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16237
16238**起始版本:** 12
16239
16240**参数:**
16241
16242| 名称 | 描述 |
16243| -------- | -------- |
16244| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16245
16246**返回:**
16247
16248size_t 字体特征map容器的大小。
16249
16250
16251### OH_Drawing_TextStyleGetFontHeight()
16252
16253```
16254double OH_Drawing_TextStyleGetFontHeight (OH_Drawing_TextStyle* )
16255```
16256
16257**描述**
16258
16259获取指定文本样式行高缩放系数。
16260
16261**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16262
16263**起始版本:** 12
16264
16265**参数:**
16266
16267| 名称 | 描述 |
16268| -------- | -------- |
16269| OH_Drawing_TextStyle | 指向字体样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16270
16271**返回:**
16272
16273double 返回字体高度。
16274
16275
16276### OH_Drawing_TextStyleGetFontMetrics()
16277
16278```
16279bool OH_Drawing_TextStyleGetFontMetrics (OH_Drawing_Typography* , OH_Drawing_TextStyle* , OH_Drawing_Font_Metrics*  )
16280```
16281
16282**描述**
16283
16284获取文本字体属性。
16285
16286**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16287
16288**起始版本:** 12
16289
16290**参数:**
16291
16292| 名称 | 描述 |
16293| -------- | -------- |
16294| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
16295| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16296| OH_Drawing_Font_Metrics | 指向字体属性对象[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)的指针,由[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)获取。 |
16297
16298**返回:**
16299
16300是否获取到字体属性,true表示获取到字体属性,false表示未获取到字体属性。
16301
16302
16303### OH_Drawing_TextStyleGetFontSize()
16304
16305```
16306double OH_Drawing_TextStyleGetFontSize (OH_Drawing_TextStyle*)
16307```
16308
16309**描述**
16310
16311获取指定文本样式字号。
16312
16313**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16314
16315**起始版本:** 12
16316
16317**参数:**
16318
16319| 名称 | 描述 |
16320| -------- | -------- |
16321| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16322
16323**返回:**
16324
16325double 返回字号。
16326
16327
16328### OH_Drawing_TextStyleGetFontStyle()
16329
16330```
16331OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle (OH_Drawing_TextStyle* )
16332```
16333
16334**描述**
16335
16336获取指定文本样式的字体样式。
16337
16338**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16339
16340**起始版本:** 12
16341
16342**参数:**
16343
16344| 名称 | 描述 |
16345| -------- | -------- |
16346| OH_Drawing_TextStyle | 指向字体样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16347
16348**返回:**
16349
16350返回字体样式,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。
16351
16352
16353### OH_Drawing_TextStyleGetFontStyleStruct()
16354
16355```
16356OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle)
16357```
16358
16359**描述**
16360
16361获取文本样式中的字体样式,包括字体字重、字体宽度和字体斜度。
16362
16363**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16364
16365**起始版本:** 12
16366
16367**参数:**
16368
16369| 名称 | 描述 |
16370| -------- | -------- |
16371| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16372
16373**返回:**
16374
16375返回获取到的字体样式对象,包括字体字重、字体宽度和字体斜度信息。
16376
16377
16378### OH_Drawing_TextStyleGetFontWeight()
16379
16380```
16381OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight (OH_Drawing_TextStyle*)
16382```
16383
16384**描述**
16385
16386获取指定文本样式字重。
16387
16388**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16389
16390**起始版本:** 12
16391
16392**参数:**
16393
16394| 名称 | 描述 |
16395| -------- | -------- |
16396| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16397
16398**返回:**
16399
16400返回字重,具体可见[OH_Drawing_FontWeight](#oh_drawing_fontweight)枚举。
16401
16402
16403### OH_Drawing_TextStyleGetForegroundBrush()
16404
16405```
16406void OH_Drawing_TextStyleGetForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
16407```
16408
16409**描述**
16410
16411返回设置的前景色画刷。
16412
16413**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16414
16415**起始版本:** 12
16416
16417**参数:**
16418
16419| 名称 | 描述 |
16420| -------- | -------- |
16421| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16422| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 |
16423
16424
16425### OH_Drawing_TextStyleGetForegroundPen()
16426
16427```
16428void OH_Drawing_TextStyleGetForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
16429```
16430
16431**描述**
16432
16433返回设置的前景色画笔。
16434
16435**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16436
16437**起始版本:** 12
16438
16439**参数:**
16440
16441| 名称 | 描述 |
16442| -------- | -------- |
16443| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16444| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 |
16445
16446
16447### OH_Drawing_TextStyleGetHalfLeading()
16448
16449```
16450bool OH_Drawing_TextStyleGetHalfLeading (OH_Drawing_TextStyle*)
16451```
16452
16453**描述**
16454
16455获取指定文本样式一半行间距开关状态。
16456
16457**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16458
16459**起始版本:** 12
16460
16461**参数:**
16462
16463| 名称 | 描述 |
16464| -------- | -------- |
16465| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16466
16467**返回:**
16468
16469bool 返回当前文本样式一半行间距的开关状态,true表示开启一半行间距,false表示未开启一半行间距。
16470
16471
16472### OH_Drawing_TextStyleGetLetterSpacing()
16473
16474```
16475double OH_Drawing_TextStyleGetLetterSpacing (OH_Drawing_TextStyle*)
16476```
16477
16478**描述**
16479
16480获取指定文本样式的字符间距。
16481
16482**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16483
16484**起始版本:** 12
16485
16486**参数:**
16487
16488| 名称 | 描述 |
16489| -------- | -------- |
16490| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16491
16492**返回:**
16493
16494double 返回字符间距大小。
16495
16496
16497### OH_Drawing_TextStyleGetLocale()
16498
16499```
16500const char* OH_Drawing_TextStyleGetLocale (OH_Drawing_TextStyle*)
16501```
16502
16503**描述**
16504
16505获取语言环境。
16506
16507**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16508
16509**起始版本:** 12
16510
16511**参数:**
16512
16513| 名称 | 描述 |
16514| -------- | -------- |
16515| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16516
16517**返回:**
16518
16519char 返回语言环境,数据类型为指向char的指针。语言环境格式为:语言-国家。如zh-CN表示中文(中国),en-US表示英语(美国)等。具体参考BCP 47语言标签标准。
16520
16521
16522### OH_Drawing_TextStyleGetShadowCount()
16523
16524```
16525int OH_Drawing_TextStyleGetShadowCount (OH_Drawing_TextStyle* )
16526```
16527
16528**描述**
16529
16530获取字体阴影容器的大小。
16531
16532**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16533
16534**起始版本:** 12
16535
16536**参数:**
16537
16538| 名称 | 描述 |
16539| -------- | -------- |
16540| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16541
16542**返回:**
16543
16544int 返回字体阴影容器的大小。
16545
16546
16547### OH_Drawing_TextStyleGetShadows()
16548
16549```
16550OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows (OH_Drawing_TextStyle* )
16551```
16552
16553**描述**
16554
16555获取字体阴影容器。不再需要[OH_Drawing_TextShadow](#oh_drawing_textshadow)时,请使用[OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows)接口释放该对象的指针。
16556
16557**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16558
16559**起始版本:** 12
16560
16561**参数:**
16562
16563| 名称 | 描述 |
16564| -------- | -------- |
16565| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16566
16567**返回:**
16568
16569返回指向字体阴影容器[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针。
16570
16571
16572### OH_Drawing_TextStyleGetShadowWithIndex()
16573
16574```
16575OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex (OH_Drawing_TextStyle* , int  )
16576```
16577
16578**描述**
16579
16580根据下标获取字体阴影容器中的元素。
16581
16582**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16583
16584**起始版本:** 12
16585
16586**参数:**
16587
16588| 名称 | 描述 |
16589| -------- | -------- |
16590| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16591| int | 下标索引。 |
16592
16593**返回:**
16594
16595返回指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针。
16596
16597
16598### OH_Drawing_TextStyleGetWordSpacing()
16599
16600```
16601double OH_Drawing_TextStyleGetWordSpacing (OH_Drawing_TextStyle*)
16602```
16603
16604**描述**
16605
16606获取指定文本样式的单词间距。
16607
16608**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16609
16610**起始版本:** 12
16611
16612**参数:**
16613
16614| 名称 | 描述 |
16615| -------- | -------- |
16616| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16617
16618**返回:**
16619
16620double 返回单词间距大小。
16621
16622
16623### OH_Drawing_TextStyleIsAttributeMatched()
16624
16625```
16626bool OH_Drawing_TextStyleIsAttributeMatched (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType )
16627```
16628
16629**描述**
16630
16631判断两个文本样式对象是否有一样的文本样式类型。
16632
16633**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16634
16635**起始版本:** 12
16636
16637**参数:**
16638
16639| 名称 | 描述 |
16640| -------- | -------- |
16641| style | 比较的文本样式对象。 |
16642| comparedStyle | 比较的文本样式对象。 |
16643| textStyleType | 文本样式类型枚举[OH_Drawing_TextStyleType](#oh_drawing_textstyletype)。 |
16644
16645**返回:**
16646
16647返回两个TextStyle对象是否有对应的文本样式类型一样的结果,true表示其文本样式类型一样,false表示不一样。
16648
16649
16650### OH_Drawing_TextStyleIsEqual()
16651
16652```
16653bool OH_Drawing_TextStyleIsEqual (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle )
16654```
16655
16656**描述**
16657
16658判断两个文本样式对象是否相等,字宽属性不参与对比。
16659
16660**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16661
16662**起始版本:** 12
16663
16664**参数:**
16665
16666| 名称 | 描述 |
16667| -------- | -------- |
16668| style | 比较的文本样式对象。 |
16669| comparedStyle | 比较的文本样式对象。 |
16670
16671**返回:**
16672
16673返回两个文本样式对象是否相等,true表示相等,false表示不相等。
16674
16675
16676### OH_Drawing_TextStyleIsEqualByFont()
16677
16678```
16679bool OH_Drawing_TextStyleIsEqualByFont (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle )
16680```
16681
16682**描述**
16683
16684判断两个文本样式对象的字体样式属性是否相等。
16685
16686**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16687
16688**起始版本:** 12
16689
16690**参数:**
16691
16692| 名称 | 描述 |
16693| -------- | -------- |
16694| style | 比较的文本样式对象。 |
16695| comparedStyle | 比较的文本样式对象。 |
16696
16697**返回:**
16698
16699返回两个文本样式对象的字体样式属性是否相等的结果。
16700
16701
16702### OH_Drawing_TextStyleIsPlaceholder()
16703
16704```
16705bool OH_Drawing_TextStyleIsPlaceholder (OH_Drawing_TextStyle* style)
16706```
16707
16708**描述**
16709
16710返回是否有设置文本占位符。
16711
16712**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16713
16714**起始版本:** 12
16715
16716**参数:**
16717
16718| 名称 | 描述 |
16719| -------- | -------- |
16720| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16721
16722**返回:**
16723
16724返回是否有设置文本占位符,true表示有设置文本占位符,false表示未设置文本占位符。
16725
16726
16727### OH_Drawing_TextStyleSetBackgroundRect()
16728
16729```
16730void OH_Drawing_TextStyleSetBackgroundRect (OH_Drawing_TextStyle* , const OH_Drawing_RectStyle_Info* , int styleId )
16731```
16732
16733**描述**
16734
16735设置文本背景矩形框和样式id。样式id仅当背景框为圆角矩形时有效。
16736
16737**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16738
16739**起始版本:** 12
16740
16741**参数:**
16742
16743| 名称 | 描述 |
16744| -------- | -------- |
16745| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16746| [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | 指向[OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md)对象的指针。 |
16747| int | 要设置的样式id,仅当背景框为圆角矩形时有效。文本处理时会被划分为多个分段,每个分段都有自己的TextStyle,id标识着这个分段将被绘制于第几个背景矩形框中。 若一行中每个分段的id全为0,表示所有分段绘制在同一个圆角矩形背景框中; 若一行中的id为0, 1,则id为0的分段绘制在一个圆角矩形背景框内,id为1的分段绘制在另一个圆角矩形背景框内,以此类推。 |
16748
16749
16750### OH_Drawing_TextStyleSetBaselineShift()
16751
16752```
16753void OH_Drawing_TextStyleSetBaselineShift (OH_Drawing_TextStyle*, double lineShift)
16754```
16755
16756**描述**
16757
16758设置文本样式基线偏移。
16759
16760**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16761
16762**起始版本:** 12
16763
16764**参数:**
16765
16766| 名称 | 描述 |
16767| -------- | -------- |
16768| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16769| double | 文本的基线偏移。 |
16770
16771
16772### OH_Drawing_TextStyleSetPlaceholder()
16773
16774```
16775void OH_Drawing_TextStyleSetPlaceholder (OH_Drawing_TextStyle* style)
16776```
16777
16778**描述**
16779
16780设置占位符。
16781
16782**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16783
16784**起始版本:** 12
16785
16786**参数:**
16787
16788| 名称 | 描述 |
16789| -------- | -------- |
16790| OH_Drawing_TextStyle | 指向文本样式对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
16791
16792
16793### OH_Drawing_TypefaceCreateDefault()
16794
16795```
16796OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault (void )
16797```
16798
16799**描述**
16800
16801用于创建一个默认的字形对象。
16802
16803**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16804
16805**起始版本:** 11
16806
16807**返回:**
16808
16809返回一个指针,指针指向创建的字形对象。
16810
16811
16812### OH_Drawing_TypefaceCreateFromFile()
16813
16814```
16815OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile (const char* path, int index )
16816```
16817
16818**描述**
16819
16820通过文件创建一个字形对象。
16821
16822本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
16823
16824path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
16825
16826**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16827
16828**起始版本:** 12
16829
16830**参数:**
16831
16832| 名称 | 描述 |
16833| -------- | -------- |
16834| path | 指向文件路径的指针。 |
16835| index | 文件索引。 |
16836
16837**返回:**
16838
16839函数返回一个指针,指针指向创建的字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
16840
16841
16842### OH_Drawing_TypefaceCreateFromStream()
16843
16844```
16845OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream (OH_Drawing_MemoryStream* , int32_t index )
16846```
16847
16848**描述**
16849
16850通过内存流创建一个字形对象。如果内存流是无效的字体文件,返回空指针。 内存流传入后,所有权转移,开发者不能再释放它。
16851
16852本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。
16853
16854OH_Drawing_MemoryStream为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
16855
16856**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16857
16858**起始版本:** 12
16859
16860**参数:**
16861
16862| 名称 | 描述 |
16863| -------- | -------- |
16864| OH_Drawing_MemoryStream | 指向内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)的指针。 |
16865| index | 内存流索引。 |
16866
16867**返回:**
16868
16869返回一个指针,指针指向创建的字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。
16870
16871
16872### OH_Drawing_TypefaceDestroy()
16873
16874```
16875void OH_Drawing_TypefaceDestroy (OH_Drawing_Typeface* )
16876```
16877
16878**描述**
16879
16880用于销毁字形对象并回收该对象占有的内存。
16881
16882**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16883
16884**起始版本:** 11
16885
16886**参数:**
16887
16888| 名称 | 描述 |
16889| -------- | -------- |
16890| OH_Drawing_Typeface | 指向字形对象的指针。 |
16891
16892
16893### OH_Drawing_TypographyDestroyEllipsis()
16894
16895```
16896void OH_Drawing_TypographyDestroyEllipsis (char* ellipsis)
16897```
16898
16899**描述**
16900
16901释放省略号名称列表占用的内存。
16902
16903**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16904
16905**起始版本:** 12
16906
16907**参数:**
16908
16909| 名称 | 描述 |
16910| -------- | -------- |
16911| ellipsis | 表示指向省略号名称列表的指针。 |
16912
16913
16914### OH_Drawing_TypographyDestroyLineFontMetrics()
16915
16916```
16917void OH_Drawing_TypographyDestroyLineFontMetrics (OH_Drawing_Font_Metrics* )
16918```
16919
16920**描述**
16921
16922释放指定行所有字体度量结构体集合所占用的所有空间。
16923
16924**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16925
16926**起始版本:** 12
16927
16928**参数:**
16929
16930| 名称 | 描述 |
16931| -------- | -------- |
16932| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | 指示要释放空间的指定行所有字体度量结构体集合的第一个地址。 |
16933
16934
16935### OH_Drawing_TypographyDidExceedMaxLines()
16936
16937```
16938bool OH_Drawing_TypographyDidExceedMaxLines (OH_Drawing_Typography* )
16939```
16940
16941**描述**
16942
16943获取排版对象中文本是否超过最大行,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,如果没有通过[OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines)接口设置最大行,则返回false。
16944
16945**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16946
16947**起始版本:** 11
16948
16949**参数:**
16950
16951| 名称 | 描述 |
16952| -------- | -------- |
16953| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
16954
16955**返回:**
16956
16957返回文本是否超过最大行,true表示超过,false表示未超过。
16958
16959
16960### OH_Drawing_TypographyGetAlphabeticBaseline()
16961
16962```
16963double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography* )
16964```
16965
16966**描述**
16967
16968获取排版样式字母文字基线。
16969
16970**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16971
16972**起始版本:** 9
16973
16974**参数:**
16975
16976| 名称 | 描述 |
16977| -------- | -------- |
16978| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
16979
16980**返回:**
16981
16982返回字母文字基线。
16983
16984
16985### OH_Drawing_TypographyGetEffectiveAlignment()
16986
16987```
16988int OH_Drawing_TypographyGetEffectiveAlignment (OH_Drawing_TypographyStyle* style)
16989```
16990
16991**描述**
16992
16993获取文字对齐方式。
16994
16995**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
16996
16997**起始版本:** 12
16998
16999**参数:**
17000
17001| 名称 | 描述 |
17002| -------- | -------- |
17003| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
17004
17005**返回:**
17006
17007返回文字对齐方式。
17008
17009
17010### OH_Drawing_TypographyGetGlyphPositionAtCoordinate()
17011
17012```
17013OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate (OH_Drawing_Typography* , double , double  )
17014```
17015
17016**描述**
17017
17018获取坐标处文本的索引位置和亲和性。
17019
17020**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17021
17022**起始版本:** 11
17023
17024**参数:**
17025
17026| 名称 | 描述 |
17027| -------- | -------- |
17028| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17029| double | 光标的x坐标。 |
17030| double | 光标的y坐标。 |
17031
17032**返回:**
17033
17034返回坐标处字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。
17035
17036
17037### OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster()
17038
17039```
17040OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster (OH_Drawing_Typography* , double , double  )
17041```
17042
17043**描述**
17044
17045获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。
17046
17047**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17048
17049**起始版本:** 11
17050
17051**参数:**
17052
17053| 名称 | 描述 |
17054| -------- | -------- |
17055| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17056| double | 光标的x坐标。 |
17057| double | 光标的y坐标。 |
17058
17059**返回:**
17060
17061返回坐标处指定类型字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。
17062
17063
17064### OH_Drawing_TypographyGetHeight()
17065
17066```
17067double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography* )
17068```
17069
17070**描述**
17071
17072获取排版对象整体的高度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
17073
17074**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17075
17076**起始版本:** 9
17077
17078**参数:**
17079
17080| 名称 | 描述 |
17081| -------- | -------- |
17082| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17083
17084**返回:**
17085
17086返回高度。
17087
17088
17089### OH_Drawing_TypographyGetIdeographicBaseline()
17090
17091```
17092double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography* )
17093```
17094
17095**描述**
17096
17097获取排版样式表意文字基线。
17098
17099**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17100
17101**起始版本:** 9
17102
17103**参数:**
17104
17105| 名称 | 描述 |
17106| -------- | -------- |
17107| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17108
17109**返回:**
17110
17111返回表意文字基线。
17112
17113
17114### OH_Drawing_TypographyGetIndentsWithIndex()
17115
17116```
17117float OH_Drawing_TypographyGetIndentsWithIndex (OH_Drawing_Typography* , int  )
17118```
17119
17120**描述**
17121
17122根据行索引获取排版对象缩进容器中的元素,行索引从0开始。
17123
17124**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17125
17126**起始版本:** 12
17127
17128**参数:**
17129
17130| 名称 | 描述 |
17131| -------- | -------- |
17132| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17133| int | 下标索引。 |
17134
17135**返回:**
17136
17137float 返回索引对应的元素值。
17138
17139
17140### OH_Drawing_TypographyGetLineCount()
17141
17142```
17143size_t OH_Drawing_TypographyGetLineCount (OH_Drawing_Typography* )
17144```
17145
17146**描述**
17147
17148获取排版对象中文本行数,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
17149
17150**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17151
17152**起始版本:** 11
17153
17154**参数:**
17155
17156| 名称 | 描述 |
17157| -------- | -------- |
17158| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17159
17160**返回:**
17161
17162返回行数。
17163
17164
17165### OH_Drawing_TypographyGetLineFontMetrics()
17166
17167```
17168OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics (OH_Drawing_Typography* , size_t lineNumber, size_t* fontMetricsSize )
17169```
17170
17171**描述**
17172
17173从排版对象中目标行获取所有字体度量信息,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,否则会返回空指针。不再需要[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)时,请使用[OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics)接口释放该对象的指针。
17174
17175**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17176
17177**起始版本:** 12
17178
17179**参数:**
17180
17181| 名称 | 描述 |
17182| -------- | -------- |
17183| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17184| lineNumber | 指定行数,取值为整数,最小有效值为1,最大行取决于文本输入后字体引擎解析出来的行数,若输入值大于最大行会返回错误值并打印错误消息。 |
17185| fontMetricsSize | 指示从当前行返回的字体度量结构的大小。 |
17186
17187**返回:**
17188
17189返回当前行的所有字体度量信息。
17190
17191
17192### OH_Drawing_TypographyGetLineHeight()
17193
17194```
17195double OH_Drawing_TypographyGetLineHeight (OH_Drawing_Typography* , int  )
17196```
17197
17198**描述**
17199
17200获取排版对象中指定行的行高,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
17201
17202**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17203
17204**起始版本:** 11
17205
17206**参数:**
17207
17208| 名称 | 描述 |
17209| -------- | -------- |
17210| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17211| int | 要指定的行数。 |
17212
17213**返回:**
17214
17215返回指定行的行高。
17216
17217
17218### OH_Drawing_TypographyGetLineInfo()
17219
17220```
17221bool OH_Drawing_TypographyGetLineInfo (OH_Drawing_Typography* , int , bool , bool , OH_Drawing_LineMetrics*  )
17222```
17223
17224**描述**
17225
17226获取排版对象中指定行的位置信息或指定行第一个字符的位置信息,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
17227
17228**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17229
17230**起始版本:** 12
17231
17232**参数:**
17233
17234| 名称 | 描述 |
17235| -------- | -------- |
17236| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17237| int | 行号。 |
17238| bool | true为获取整行的位置信息,false为获取第一个字符的位置信息。 |
17239| bool | 文字宽度是否包含空白符,true表示不包含空白符,false表示包含空白符。 |
17240| OH_Drawing_LineMetrics | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 |
17241
17242**返回:**
17243
17244指定行的行位置信息或第一个字符的位置信息是否成功获取,true表示成功获取,false表示未成功获取。
17245
17246
17247### OH_Drawing_TypographyGetLineMetrics()
17248
17249```
17250OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics (OH_Drawing_Typography* )
17251```
17252
17253**描述**
17254
17255获取排版对象的行位置信息,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。不再需要[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)时,请使用[OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics)接口释放该对象的指针。
17256
17257**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17258
17259**起始版本:** 12
17260
17261**参数:**
17262
17263| 名称 | 描述 |
17264| -------- | -------- |
17265| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17266
17267**返回:**
17268
17269返回指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针。
17270
17271
17272### OH_Drawing_TypographyGetLineMetricsAt()
17273
17274```
17275bool OH_Drawing_TypographyGetLineMetricsAt (OH_Drawing_Typography* , int , OH_Drawing_LineMetrics*  )
17276```
17277
17278**描述**
17279
17280获取排版对象的指定行位置信息,具体参见[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)结构体,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
17281
17282**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17283
17284**起始版本:** 12
17285
17286**参数:**
17287
17288| 名称 | 描述 |
17289| -------- | -------- |
17290| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17291| int | 要获取的行数。 |
17292| [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)获取。 |
17293
17294**返回:**
17295
17296行位置信息对象是否成功获取,true表示成功获取,false表示未成功获取。
17297
17298
17299### OH_Drawing_TypographyGetLineTextRange()
17300
17301```
17302OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange (OH_Drawing_Typography* , int , bool  )
17303```
17304
17305**描述**
17306
17307获取排版对象中行的边界,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。该接口只能获取已有行的边界,即输入行索引从0开始,最大行索引为[OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) - 1。
17308
17309**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17310
17311**起始版本:** 12
17312
17313**参数:**
17314
17315| 名称 | 描述 |
17316| -------- | -------- |
17317| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17318| int | 行索引。 |
17319| bool | 设置返回的边界是否包含空格,true为包含空格,false为不包含空格。 |
17320
17321**返回:**
17322
17323返回指向行边界对象的指针[OH_Drawing_Range](#oh_drawing_range)。如果输入的行索引是非法的行索引,则返回的边界范围的start和end都为0。
17324
17325
17326### OH_Drawing_TypographyGetLineWidth()
17327
17328```
17329double OH_Drawing_TypographyGetLineWidth (OH_Drawing_Typography* , int  )
17330```
17331
17332**描述**
17333
17334获取指定行的行宽,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
17335
17336**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17337
17338**起始版本:** 11
17339
17340**参数:**
17341
17342| 名称 | 描述 |
17343| -------- | -------- |
17344| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17345| int | 要指定的行数。 |
17346
17347**返回:**
17348
17349返回指定行的行宽。
17350
17351
17352### OH_Drawing_TypographyGetLongestLine()
17353
17354```
17355double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography* )
17356```
17357
17358**描述**
17359
17360获取排版对象最长行的宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用,建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。
17361
17362**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17363
17364**起始版本:** 9
17365
17366**参数:**
17367
17368| 名称 | 描述 |
17369| -------- | -------- |
17370| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17371
17372**返回:**
17373
17374返回最长行的宽度。
17375
17376
17377### OH_Drawing_TypographyGetMaxIntrinsicWidth()
17378
17379```
17380double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography* )
17381```
17382
17383**描述**
17384
17385获取排版对象的最大固有宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
17386
17387**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17388
17389**起始版本:** 9
17390
17391**参数:**
17392
17393| 名称 | 描述 |
17394| -------- | -------- |
17395| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17396
17397**返回:**
17398
17399返回最大固有宽度。
17400
17401
17402### OH_Drawing_TypographyGetMaxWidth()
17403
17404```
17405double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography* )
17406```
17407
17408**描述**
17409
17410获取用户设置的排版宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
17411
17412**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17413
17414**起始版本:** 9
17415
17416**参数:**
17417
17418| 名称 | 描述 |
17419| -------- | -------- |
17420| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17421
17422**返回:**
17423
17424返回用户设置的排版宽度。
17425
17426
17427### OH_Drawing_TypographyGetMinIntrinsicWidth()
17428
17429```
17430double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography* )
17431```
17432
17433**描述**
17434
17435获取排版对象的最小固有宽度,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。
17436
17437**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17438
17439**起始版本:** 9
17440
17441**参数:**
17442
17443| 名称 | 描述 |
17444| -------- | -------- |
17445| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17446
17447**返回:**
17448
17449返回最小固有宽度。
17450
17451
17452### OH_Drawing_TypographyGetRectsForPlaceholders()
17453
17454```
17455OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders (OH_Drawing_Typography* )
17456```
17457
17458**描述**
17459
17460获取排版对象中占位符的文本框,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。不再需要[OH_Drawing_TextBox](#oh_drawing_textbox)时,请使用[OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox)接口释放该对象的指针。
17461
17462**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17463
17464**起始版本:** 11
17465
17466**参数:**
17467
17468| 名称 | 描述 |
17469| -------- | -------- |
17470| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17471
17472**返回:**
17473
17474返回占位符的文本框,返回类型为[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。
17475
17476### OH_Drawing_TypographyGetRectsForRange()
17477
17478```
17479OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange (OH_Drawing_Typography* , size_t , size_t , OH_Drawing_RectHeightStyle , OH_Drawing_RectWidthStyle  )
17480```
17481
17482**描述**
17483
17484获取排版对象中指定范围内的文本框,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用之后调用。不再需要[OH_Drawing_TextBox](#oh_drawing_textbox)时,请使用[OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox)接口释放该对象的指针。
17485
17486**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17487
17488**起始版本:** 11
17489
17490**参数:**
17491
17492| 名称 | 描述 |
17493| -------- | -------- |
17494| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17495| size_t | 设置开始位置。 |
17496| size_t | 设置结束位置。 |
17497| OH_Drawing_RectHeightStyle | 设置高度样式,支持可选的高度样式具体可见[OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle)枚举。 |
17498| OH_Drawing_RectWidthStyle | 设置宽度样式,支持可选的宽度样式具体可见[OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)枚举。 |
17499
17500**返回:**
17501
17502返回指定范围内的文本框,具体可见[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。
17503
17504
17505### OH_Drawing_TypographyGetTextAlign()
17506
17507```
17508OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign (OH_Drawing_TypographyStyle* )
17509```
17510
17511**描述**
17512
17513获取文本对齐方式。
17514
17515**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17516
17517**起始版本:** 12
17518
17519**参数:**
17520
17521| 名称 | 描述 |
17522| -------- | -------- |
17523| OH_Drawing_TypographyStyle | 表示指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
17524
17525**返回:**
17526
17527返回文本对齐方式。1为右对齐,2为居中对齐,3为两端对齐,4为与文字方向相同,5为文字方向相反,0或其它为左对齐, 具体可见[OH_Drawing_TextAlign](#oh_drawing_textalign)枚举。
17528
17529
17530### OH_Drawing_TypographyGetTextDirection()
17531
17532```
17533OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection (OH_Drawing_TypographyStyle* )
17534```
17535
17536**描述**
17537
17538获取指定排版样式中的文本方向。
17539
17540**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17541
17542**起始版本:** 12
17543
17544**参数:**
17545
17546| 名称 | 描述 |
17547| -------- | -------- |
17548| OH_Drawing_TypographyStyle | 表示指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
17549
17550**返回:**
17551
17552返回文本方向。0为从右到左,1为从左到右,具体可见[OH_Drawing_TextDirection](#oh_drawing_textdirection)枚举。
17553
17554
17555### OH_Drawing_TypographyGetTextEllipsis()
17556
17557```
17558char* OH_Drawing_TypographyGetTextEllipsis (OH_Drawing_TypographyStyle* )
17559```
17560
17561**描述**
17562
17563获取指定排版样式设置的省略号文本。
17564
17565**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17566
17567**起始版本:** 12
17568
17569**参数:**
17570
17571| 名称 | 描述 |
17572| -------- | -------- |
17573| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
17574
17575**返回:**
17576
17577返回设置的省略号内容。
17578
17579
17580### OH_Drawing_TypographyGetTextMaxLines()
17581
17582```
17583size_t OH_Drawing_TypographyGetTextMaxLines (OH_Drawing_TypographyStyle* )
17584```
17585
17586**描述**
17587
17588获取文本的最大行数。
17589
17590**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17591
17592**起始版本:** 12
17593
17594**参数:**
17595
17596| 名称 | 描述 |
17597| -------- | -------- |
17598| OH_Drawing_TypographyStyle | 表示指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
17599
17600**返回:**
17601
17602返回结果为文本最大行数。
17603
17604
17605### OH_Drawing_TypographyGetTextStyle()
17606
17607```
17608OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle (OH_Drawing_TypographyStyle* style)
17609```
17610
17611**描述**
17612
17613获取指定排版样式中设置的默认文本样式。
17614
17615**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17616
17617**起始版本:** 12
17618
17619**参数:**
17620
17621| 名称 | 描述 |
17622| -------- | -------- |
17623| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
17624
17625**返回:**
17626
17627返回指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,不再需要时,请使用[OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle)释放该对象指针。
17628
17629
17630### OH_Drawing_TypographyGetUnresolvedGlyphsCount()
17631
17632```
17633int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount (OH_Drawing_Typography* )
17634```
17635
17636**描述**
17637
17638获取文本中尚未解析的字形的数量,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用并生效之后调用。
17639
17640**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17641
17642**起始版本:** 12
17643
17644**参数:**
17645
17646| 名称 | 描述 |
17647| -------- | -------- |
17648| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17649
17650**返回:**
17651
17652返回文本中尚未解析的字形的数量。
17653
17654
17655### OH_Drawing_TypographyGetWordBoundary()
17656
17657```
17658OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary (OH_Drawing_Typography* , size_t  )
17659```
17660
17661**描述**
17662
17663获取排版对象中单词的边界。
17664
17665**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17666
17667**起始版本:** 11
17668
17669**参数:**
17670
17671| 名称 | 描述 |
17672| -------- | -------- |
17673| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17674| size_t | 单词索引。 |
17675
17676**返回:**
17677
17678返回单词边界,返回类型为[OH_Drawing_Range](#oh_drawing_range)结构体。
17679
17680
17681### OH_Drawing_TypographyHandlerAddPlaceholder()
17682
17683```
17684void OH_Drawing_TypographyHandlerAddPlaceholder (OH_Drawing_TypographyCreate* , OH_Drawing_PlaceholderSpan*  )
17685```
17686
17687**描述**
17688
17689设置占位符。
17690
17691**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17692
17693**起始版本:** 11
17694
17695**参数:**
17696
17697| 名称 | 描述 |
17698| -------- | -------- |
17699| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
17700| OH_Drawing_PlaceholderSpan | 指向[OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md)对象的指针。 |
17701
17702
17703### OH_Drawing_TypographyHandlerAddSymbol()
17704
17705```
17706void OH_Drawing_TypographyHandlerAddSymbol (OH_Drawing_TypographyCreate* , uint32_t symbol )
17707```
17708
17709**描述**
17710
17711设置排版创建过程中的符号。
17712
17713**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17714
17715**起始版本:** 12
17716
17717**参数:**
17718
17719| 名称 | 描述 |
17720| -------- | -------- |
17721| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
17722| uint32_t | 要设置的符号,可支持设置的符号参见下面链接json文件中的value值。可设置的符号(即列表视图下的unicode值)请见[主题图标库](https://developer.huawei.com/consumer/cn/design/harmonyos-symbol/)。 |
17723
17724
17725### OH_Drawing_TypographyHandlerAddText()
17726
17727```
17728void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate* , const char*  )
17729```
17730
17731**描述**
17732
17733设置文本内容。
17734
17735**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17736
17737**起始版本:** 8
17738
17739**参数:**
17740
17741| 名称 | 描述 |
17742| -------- | -------- |
17743| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
17744| char | 指向文本内容的指针。 |
17745
17746
17747### OH_Drawing_TypographyHandlerPopTextStyle()
17748
17749```
17750void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate* )
17751```
17752
17753**描述**
17754
17755从文本样式栈中弹出栈顶文本样式。
17756
17757**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17758
17759**起始版本:** 8
17760
17761**参数:**
17762
17763| 名称 | 描述 |
17764| -------- | -------- |
17765| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
17766
17767
17768### OH_Drawing_TypographyHandlerPushTextStyle()
17769
17770```
17771void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate* , OH_Drawing_TextStyle*  )
17772```
17773
17774**描述**
17775
17776将指定文本样式压入文本样式栈,后续添加的文本总是会使用栈顶的文本样式。
17777
17778**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17779
17780**起始版本:** 8
17781
17782**参数:**
17783
17784| 名称 | 描述 |
17785| -------- | -------- |
17786| OH_Drawing_TypographyCreate | 指向[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
17787| OH_Drawing_TextStyle | 指向文本样式[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
17788
17789
17790### OH_Drawing_TypographyIsEllipsized()
17791
17792```
17793bool OH_Drawing_TypographyIsEllipsized (OH_Drawing_TypographyStyle* style)
17794```
17795
17796**描述**
17797
17798获取指定排版样式是否配置省略号。
17799
17800**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17801
17802**起始版本:** 12
17803
17804**参数:**
17805
17806| 名称 | 描述 |
17807| -------- | -------- |
17808| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
17809
17810**返回:**
17811
17812返回文本是否有省略号,true表示有省略号,false表示无省略号。
17813
17814
17815### OH_Drawing_TypographyIsLineUnlimited()
17816
17817```
17818bool OH_Drawing_TypographyIsLineUnlimited (OH_Drawing_TypographyStyle* style)
17819```
17820
17821**描述**
17822
17823获取文本是否有最大行数限制。
17824
17825**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17826
17827**起始版本:** 12
17828
17829**参数:**
17830
17831| 名称 | 描述 |
17832| -------- | -------- |
17833| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
17834
17835**返回:**
17836
17837返回文本是否有最大行数限制,true表示有最大行数限制,false表示无最大行数限制。
17838
17839
17840### OH_Drawing_TypographyLayout()
17841
17842```
17843void OH_Drawing_TypographyLayout (OH_Drawing_Typography* , double  )
17844```
17845
17846**描述**
17847
17848排版布局。
17849
17850**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17851
17852**起始版本:** 8
17853
17854**参数:**
17855
17856| 名称 | 描述 |
17857| -------- | -------- |
17858| OH_Drawing_Typography | 指向排版对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17859| double | 文本最大宽度。 |
17860
17861
17862### OH_Drawing_TypographyMarkDirty()
17863
17864```
17865void OH_Drawing_TypographyMarkDirty (OH_Drawing_Typography* )
17866```
17867
17868**描述**
17869
17870将排版标记为脏数据,用于初始化排版状态。
17871
17872**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17873
17874**起始版本:** 12
17875
17876**参数:**
17877
17878| 名称 | 描述 |
17879| -------- | -------- |
17880| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17881
17882
17883### OH_Drawing_TypographyPaint()
17884
17885```
17886void OH_Drawing_TypographyPaint (OH_Drawing_Typography* , OH_Drawing_Canvas* , double , double  )
17887```
17888
17889**描述**
17890
17891在指定位置绘制文本,从左上角开始绘制,该接口需要在[OH_Drawing_TypographyLayout](#oh_drawing_typographylayout)接口调用并生效之后调用。
17892
17893**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17894
17895**起始版本:** 8
17896
17897**参数:**
17898
17899| 名称 | 描述 |
17900| -------- | -------- |
17901| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17902| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针,由OH_Drawing_CanvasCreate()获取。 |
17903| double | x坐标。 |
17904| double | y坐标。 |
17905
17906
17907### OH_Drawing_TypographySetIndents()
17908
17909```
17910void OH_Drawing_TypographySetIndents (OH_Drawing_Typography* , int , const float indents[] )
17911```
17912
17913**描述**
17914
17915设置文本的排版缩进,不调用此接口默认文本无缩进。
17916
17917**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17918
17919**起始版本:** 12
17920
17921**参数:**
17922
17923| 名称 | 描述 |
17924| -------- | -------- |
17925| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
17926| int | 为段落设置的缩进数量。该值应小于或等于 indents 数组的长度,以避免访问数组越界导致的显示异常。|
17927| float | 指向浮点类型数组的指针,每个数组元素表示一个缩进宽度,单位为物理像素(px)。在应用[OH_Drawing_Typography](#oh_drawing_typography)接口时,需要先声明并初始化该浮点数组。 |
17928
17929
17930### OH_Drawing_TypographyStyleDestroyStrutStyle()
17931
17932```
17933void OH_Drawing_TypographyStyleDestroyStrutStyle (OH_Drawing_StrutStyle* )
17934```
17935
17936**描述**
17937
17938释放被支柱样式对象占据的内存。
17939
17940**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17941
17942**起始版本:** 12
17943
17944**参数:**
17945
17946| 名称 | 描述 |
17947| -------- | -------- |
17948| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针,由[OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle)获取。 |
17949
17950
17951### OH_Drawing_TypographyStyleEquals()
17952
17953```
17954bool OH_Drawing_TypographyStyleEquals (OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to )
17955```
17956
17957**描述**
17958
17959判断排版样式是否相同,当前文本高度修饰符模式[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)没有被纳入比较。
17960
17961**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17962
17963**起始版本:** 12
17964
17965**参数:**
17966
17967| 名称 | 描述 |
17968| -------- | -------- |
17969| from | 被比较的排版样式。 |
17970| to | 用于比较的排版样式。 |
17971
17972**返回:**
17973
17974返回排版样式是否相同。true表示相同,false表示不相同。
17975
17976
17977### OH_Drawing_TypographyStyleGetEffectiveAlignment()
17978
17979```
17980OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment (OH_Drawing_TypographyStyle* style)
17981```
17982
17983**描述**
17984
17985获取文本对齐模式。
17986
17987**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
17988
17989**起始版本:** 12
17990
17991**参数:**
17992
17993| 名称 | 描述 |
17994| -------- | -------- |
17995| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
17996
17997**返回:**
17998
17999返回文本对齐模式的枚举值[OH_Drawing_TextAlign](#oh_drawing_textalign)。
18000
18001
18002### OH_Drawing_TypographyStyleGetFontStyleStruct()
18003
18004```
18005OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle)
18006```
18007
18008**描述**
18009
18010获取排版样式中默认文本样式的字体样式,包括字体字重、字体宽度和字体斜度。
18011
18012**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18013
18014**起始版本:** 12
18015
18016**参数:**
18017
18018| 名称 | 描述 |
18019| -------- | -------- |
18020| OH_Drawing_TypographyStyle | 指向排版样式对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18021
18022**返回:**
18023
18024返回获取到的字体样式对象,包括字体字重、字体宽度和字体斜度信息。
18025
18026
18027### OH_Drawing_TypographyStyleGetStrutStyle()
18028
18029```
18030OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle (OH_Drawing_TypographyStyle* )
18031```
18032
18033**描述**
18034
18035获取文本支柱样式。
18036
18037**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18038
18039**起始版本:** 12
18040
18041**参数:**
18042
18043| 名称 | 描述 |
18044| -------- | -------- |
18045| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18046
18047**返回:**
18048
18049返回指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针。
18050
18051
18052### OH_Drawing_TypographyStyleIsHintEnabled()
18053
18054```
18055bool OH_Drawing_TypographyStyleIsHintEnabled (OH_Drawing_TypographyStyle* style)
18056```
18057
18058**描述**
18059
18060获取文本是否启用字形轮廓自动调整,字形轮廓自动调整用于在渲染小字号文本时改善其可读性和外观。
18061
18062**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18063
18064**起始版本:** 12
18065
18066**参数:**
18067
18068| 名称 | 描述 |
18069| -------- | -------- |
18070| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18071
18072**返回:**
18073
18074返回文本是否启用字体提示,true表示启用,false表示不启用。
18075
18076
18077### OH_Drawing_TypographyStyleSetHintsEnabled()
18078
18079```
18080void OH_Drawing_TypographyStyleSetHintsEnabled (OH_Drawing_TypographyStyle* style, bool hintsEnabled )
18081```
18082
18083**描述**
18084
18085设置文本是否启用字形轮廓自动调整,字形轮廓自动调整用于在渲染小字号文本时改善其可读性和外观。
18086
18087**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18088
18089**起始版本:** 12
18090
18091**参数:**
18092
18093| 名称 | 描述 |
18094| -------- | -------- |
18095| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18096| hintsEnabled | 是否启用字体提示,true表示启用,false表示不启用。 |
18097
18098
18099### OH_Drawing_TypographyStyleStrutStyleEquals()
18100
18101```
18102bool OH_Drawing_TypographyStyleStrutStyleEquals (OH_Drawing_StrutStyle* from, OH_Drawing_StrutStyle* to )
18103```
18104
18105**描述**
18106
18107判断支柱样式结构体是否相同。
18108
18109**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18110
18111**起始版本:** 12
18112
18113**参数:**
18114
18115| 名称 | 描述 |
18116| -------- | -------- |
18117| from | 被比较的支柱样式结构体。 |
18118| to | 用于比较的支柱样式结构体。 |
18119
18120**返回:**
18121
18122返回支柱样式结构体是否相同,true表示相同,false表示不相同。
18123
18124### OH_Drawing_TypographyTextGetHeightBehavior()
18125
18126```
18127OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior (OH_Drawing_TypographyStyle* )
18128```
18129
18130**描述**
18131
18132获取文本高度修饰符模式。
18133
18134**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18135
18136**起始版本:** 12
18137
18138**参数:**
18139
18140| 名称 | 描述 |
18141| -------- | -------- |
18142| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18143
18144**返回:**
18145
18146返回文本高度修饰符模式,为[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)类型的枚举值。
18147
18148
18149### OH_Drawing_TypographyTextGetLineStyle()
18150
18151```
18152bool OH_Drawing_TypographyTextGetLineStyle (OH_Drawing_TypographyStyle* )
18153```
18154
18155**描述**
18156
18157获取文本排版是否启用行样式。
18158
18159**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18160
18161**起始版本:** 12
18162
18163**参数:**
18164
18165| 名称 | 描述 |
18166| -------- | -------- |
18167| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18168
18169**返回:**
18170
18171返回行样式是否启用的结果,true表示启用,false表示不启用。
18172
18173
18174### OH_Drawing_TypographyTextlineGetStyleOnly()
18175
18176```
18177bool OH_Drawing_TypographyTextlineGetStyleOnly (OH_Drawing_TypographyStyle* )
18178```
18179
18180**描述**
18181
18182获取文本排版是否仅启用行样式。
18183
18184**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18185
18186**起始版本:** 12
18187
18188**参数:**
18189
18190| 名称 | 描述 |
18191| -------- | -------- |
18192| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18193
18194**返回:**
18195
18196返回文本排版是否仅启用行样式,true表示启用,false表示不启用。
18197
18198
18199### OH_Drawing_TypographyTextlineStyleDestroyFontFamilies()
18200
18201```
18202void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies (char** fontFamilies, size_t fontFamiliesNum )
18203```
18204
18205**描述**
18206
18207释放字体类型占用的内存。
18208
18209**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18210
18211**起始版本:** 12
18212
18213**参数:**
18214
18215| 名称 | 描述 |
18216| -------- | -------- |
18217| fontFamilies | 表示指向字体字体类型的指针。 |
18218| fontFamiliesNum | 字体名称的数量。 |
18219
18220
18221### OH_Drawing_TypographyTextlineStyleGetFontFamilies()
18222
18223```
18224char** OH_Drawing_TypographyTextlineStyleGetFontFamilies (OH_Drawing_TypographyStyle* , size_t* num)
18225```
18226
18227**描述**
18228
18229获取文本排版行样式字体家族名。
18230
18231**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18232
18233**起始版本:** 12
18234
18235**参数:**
18236
18237| 名称 | 描述 |
18238| -------- | -------- |
18239| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18240| num | 指向字体名称数量的指针。 |
18241
18242**返回:**
18243
18244返回文本排版行样式字体家族名。
18245
18246
18247### OH_Drawing_TypographyTextlineStyleGetFontSize()
18248
18249```
18250double OH_Drawing_TypographyTextlineStyleGetFontSize (OH_Drawing_TypographyStyle* )
18251```
18252
18253**描述**
18254
18255获取文本排版行样式字号。
18256
18257**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18258
18259**起始版本:** 12
18260
18261**参数:**
18262
18263| 名称 | 描述 |
18264| -------- | -------- |
18265| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18266
18267**返回:**
18268
18269返回文本排版行样式字号。
18270
18271
18272### OH_Drawing_TypographyTextlineStyleGetFontStyle()
18273
18274```
18275OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle (OH_Drawing_TypographyStyle* )
18276```
18277
18278**描述**
18279
18280获取文本排版样式中支柱样式的字体样式。
18281
18282**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18283
18284**起始版本:** 12
18285
18286**参数:**
18287
18288| 名称 | 描述 |
18289| -------- | -------- |
18290| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18291
18292**返回:**
18293
18294获取文本排版样式中支柱样式的字体样式。1为斜体,0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。
18295
18296
18297### OH_Drawing_TypographyTextlineStyleGetFontWeight()
18298
18299```
18300OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight (OH_Drawing_TypographyStyle*)
18301```
18302
18303**描述**
18304
18305获取排版样式中支柱样式字重。
18306
18307**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18308
18309**起始版本:** 12
18310
18311**参数:**
18312
18313| 名称 | 描述 |
18314| -------- | -------- |
18315| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18316
18317**返回:**
18318
18319返回文本排版行样式字重。 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)枚举。
18320
18321
18322### OH_Drawing_TypographyTextlineStyleGetHalfLeading()
18323
18324```
18325bool OH_Drawing_TypographyTextlineStyleGetHalfLeading (OH_Drawing_TypographyStyle* )
18326```
18327
18328**描述**
18329
18330获取文本排版行样式是否为一半行间距。
18331
18332**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18333
18334**起始版本:** 12
18335
18336**参数:**
18337
18338| 名称 | 描述 |
18339| -------- | -------- |
18340| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18341
18342**返回:**
18343
18344文本排版行样式是否为一半行间距,true表示是一半行间距,false表示不是。
18345
18346
18347### OH_Drawing_TypographyTextlineStyleGetHeightOnly()
18348
18349```
18350bool OH_Drawing_TypographyTextlineStyleGetHeightOnly (OH_Drawing_TypographyStyle* )
18351```
18352
18353**描述**
18354
18355获取字体渲染过程中计算字体块高度相关参数的方法。
18356
18357**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18358
18359**起始版本:** 12
18360
18361**参数:**
18362
18363| 名称 | 描述 |
18364| -------- | -------- |
18365| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18366
18367**返回:**
18368
18369返回计算字体块高度相关参数的方法,true表示以字号为准计算,false表示以行距计算。
18370
18371
18372### OH_Drawing_TypographyTextlineStyleGetHeightScale()
18373
18374```
18375double OH_Drawing_TypographyTextlineStyleGetHeightScale (OH_Drawing_TypographyStyle* )
18376```
18377
18378**描述**
18379
18380获取文本排版行样式的行高缩放系数。
18381
18382**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18383
18384**起始版本:** 12
18385
18386**参数:**
18387
18388| 名称 | 描述 |
18389| -------- | -------- |
18390| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18391
18392**返回:**
18393
18394返回文本排版行样式的行高缩放系数。
18395
18396
18397### OH_Drawing_TypographyTextlineStyleGetSpacingScale()
18398
18399```
18400double OH_Drawing_TypographyTextlineStyleGetSpacingScale (OH_Drawing_TypographyStyle* )
18401```
18402
18403**描述**
18404
18405获取文本排版行样式间距比例。
18406
18407**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18408
18409**起始版本:** 12
18410
18411**参数:**
18412
18413| 名称 | 描述 |
18414| -------- | -------- |
18415| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18416
18417**返回:**
18418
18419返回文本排版行样式间距比例。
18420
18421
18422### OH_Drawing_TypographyTextSetHeightBehavior()
18423
18424```
18425void OH_Drawing_TypographyTextSetHeightBehavior (OH_Drawing_TypographyStyle* , OH_Drawing_TextHeightBehavior heightMode )
18426```
18427
18428**描述**
18429
18430设置文本高度修饰符模式。
18431
18432**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18433
18434**起始版本:** 12
18435
18436**参数:**
18437
18438| 名称 | 描述 |
18439| -------- | -------- |
18440| OH_Drawing_TypographyStyle | 指向排版样式[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
18441| heightMode | 文本高度修饰符模式,为[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)类型的枚举值。 |
18442
18443
18444### OH_Drawing_TypographyUpdateFontSize()
18445
18446```
18447void OH_Drawing_TypographyUpdateFontSize (OH_Drawing_Typography* , size_t from, size_t to, float fontSize )
18448```
18449
18450**描述**
18451
18452更新排版对象中的字体大小。
18453
18454**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
18455
18456**起始版本:** 12
18457
18458**参数:**
18459
18460| 名称 | 描述 |
18461| -------- | -------- |
18462| OH_Drawing_Typography | 表示指向排版对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
18463| from | 保留字段,暂未使用。 |
18464| to | 保留字段,暂未使用。 |
18465| fontSize | 表示更新后的字体大小。 |