• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Drawing
2
3
4## 概述
5
6Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。
7
8本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环中,采用框架默认像素单位vp。像素单位请参考[像素单位说明文档](../apis-arkui/arkui-ts/ts-pixel-units.md)。
9
10**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
11
12**起始版本:** 8
13
14
15## 汇总
16
17
18### 文件
19
20| 名称 | 描述 |
21| -------- | -------- |
22| [drawing_bitmap.h](drawing__bitmap_8h.md) | 文件中定义了与位图相关的功能函数。 |
23| [drawing_brush.h](drawing__brush_8h.md) | 文件中定义了与画刷相关的功能函数。 |
24| [drawing_canvas.h](drawing__canvas_8h.md) | 文件中定义了与画布相关的功能函数。 |
25| [drawing_color.h](drawing__color_8h.md) | 文件中定义了与颜色相关的功能函数。 |
26| [drawing_color_filter.h](drawing__color__filter_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_mask_filter.h](drawing__mask__filter_8h.md) | 声明与绘图模块中的对象相关的函数。 |
31| [drawing_matrix.h](drawing__matrix_8h.md) | 文件中定义了与矩阵相关的功能函数。 |
32| [drawing_path.h](drawing__path_8h.md) | 文件中定义了与自定义路径相关的功能函数 |
33| [drawing_pen.h](drawing__pen_8h.md) | 文件中定义了与画笔相关的功能函数。 |
34| [drawing_point.h](drawing__point_8h.md) | 文件中定义了与坐标点相关的功能函数。 |
35| [drawing_rect.h](drawing__rect_8h.md) | 文件中定义了与矩形相关的功能函数。 |
36| [drawing_register_font.h](drawing__register__font_8h.md) | 定义绘制模块中字体管理器相关的函数。 |
37| [drawing_round_rect.h](drawing__round__rect_8h.md) | 文件中定义了与圆角矩形相关的功能函数。 |
38| [drawing_shader_effect.h](drawing__shader__effect_8h.md) | 声明与绘图模块中的着色器对象相关的函数。 |
39| [drawing_text_blob.h](drawing__text__blob_8h.md) | 文件中定义了与文字相关的功能函数。 |
40| [drawing_text_declaration.h](drawing__text__declaration_8h.md) | 提供2D绘制文本相关的数据结构声明。 |
41| [drawing_text_typography.h](drawing__text__typography_8h.md) | 定义绘制模块中排版相关的函数。 |
42| [drawing_typeface.h](drawing__typeface_8h.md) | 文件中定义了与字形相关的功能函数。 不同的平台有自己的默认字形,也可以从ttf文件解析出三方指定字形,如宋体、黑体字形等。 |
43| [drawing_types.h](drawing__types_8h.md) | 文件中定义了用于绘制2D图形的数据类型,包括画布、画笔、画刷、位图和路径。 |
44
45
46### 结构体
47
48| 名称 | 描述 |
49| -------- | -------- |
50| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型。 |
51| [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) | 结构体用于描述一块内存,描述文字和位置信息。 |
52| [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | 用于描述位占位符跨度的结构体。 |
53
54
55### 类型定义
56
57| 名称 | 描述 |
58| -------- | -------- |
59| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | 用于加载字体。 |
60| [OH_Drawing_Typography](#oh_drawing_typography) | 用于管理排版的布局和显示等。 |
61| [OH_Drawing_TextStyle](#oh_drawing_textstyle) | 用于管理字体颜色、装饰等。 |
62| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) | 用于管理排版风格,如文字方向等。 |
63| [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) | 用于创建[OH_Drawing_Typography](#oh_drawing_typography)。 |
64| [OH_Drawing_TextBox](#oh_drawing_textbox) | 用于接收文本框的矩形大小、方向和数量大小 |
65| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) | 用于接收字体的位置和亲和性 |
66| [OH_Drawing_Range](#oh_drawing_range) | 用于接收字体的起始位置和结束位置 |
67| [OH_Drawing_Canvas](#oh_drawing_canvas) | 定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 |
68| [OH_Drawing_Pen](#oh_drawing_pen) | 定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 |
69| [OH_Drawing_Brush](#oh_drawing_brush) | 定义为画刷,画刷用于描述填充图形的样式和颜色。 |
70| [OH_Drawing_Path](#oh_drawing_path) | 定义为路径,路径用于自定义各种形状。 |
71| [OH_Drawing_Bitmap](#oh_drawing_bitmap) | 定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 |
72| [OH_Drawing_Point](#oh_drawing_point) | 定义一个点,用于描述坐标点。 |
73| [OH_Drawing_Rect](#oh_drawing_rect) | 用于描述矩形。 |
74| [OH_Drawing_RoundRect](#oh_drawing_roundrect) | 用于描述圆角矩形。 |
75| [OH_Drawing_Matrix](#oh_drawing_matrix) | 定义一个矩阵,用于描述坐标变换。 |
76| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) | 定义一个着色器,用于描述绘制内容的源颜色。 |
77| [OH_Drawing_Filter](#oh_drawing_filter) | 定义一个滤波器,用于存储颜色滤波器和模板滤波器。 |
78| [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) | 定义模板滤波器,用于在绘制模板前对其进行转换。 |
79| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) | 定义颜色滤波器,传入一个颜色并返回一个新的颜色。 |
80| [OH_Drawing_Font](#oh_drawing_font) | 用于描述字体。 |
81| [OH_Drawing_Typeface](#oh_drawing_typeface) | 用于描述字形。 |
82| [OH_Drawing_TextBlob](#oh_drawing_textblob) | 定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。 |
83| [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) | 定义文本构建器,用于构建文本。 |
84
85### 枚举
86
87| 名称 | 描述 |
88| -------- | -------- |
89| [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) { DIFFERENCE, INTERSECT } | 画布裁剪方式的枚举集合。 |
90| [OH_Drawing_BlurType](#oh_drawing_blurtype) { NORMAL, SOLID, OUTER, INNER } | 枚举模糊类型。 |
91| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 |
92| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 |
93| [OH_Drawing_TileMode](#oh_drawing_tilemode) { CLAMP, REPEAT, MIRROR, DECAL } | 着色器效果平铺模式的枚举。 |
94| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | 文字方向。 |
95| [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/>} | 文字对齐方式。 |
96| [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/>} | 字重。 |
97| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) {<br/>TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC<br/>} | 基线位置。 |
98| [OH_Drawing_TextDecoration](#oh_drawing_textdecoration) {<br/>TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4<br/>} | 文本装饰。 |
99| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) {<br/>FONT_STYLE_NORMAL, FONT_STYLE_ITALIC<br/>} | 区分字体是否为斜体。 |
100| [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) {<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/>} | 占位符垂直对齐枚举。 |
101| [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) {<br/>TEXT_DECORATION_STYLE_SOLID, TEXT_DECORATION_STYLE_DOUBLE, TEXT_DECORATION_STYLE_DOTTED, TEXT_DECORATION_STYLE_DASHED,<br/>TEXT_DECORATION_STYLE_WAVY<br/>} | 文本装饰样式枚举。 |
102| [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) {<br/>ELLIPSIS_MODAL_HEAD = 0, ELLIPSIS_MODAL_MIDDLE = 1, ELLIPSIS_MODAL_TAIL = 2<br/>} | 省略号样式枚举。 |
103| [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) {<br/>BREAK_STRATEGY_GREEDY = 0, BREAK_STRATEGY_HIGH_QUALITY = 1, BREAK_STRATEGY_BALANCED = 2<br/>} | 文本的中断策略枚举。 |
104| [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) {<br/>WORD_BREAK_TYPE_NORMAL = 0, WORD_BREAK_TYPE_BREAK_ALL = 1, WORD_BREAK_TYPE_BREAK_WORD = 2<br/>} | 单词的断词方式枚举。 |
105| [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) {<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/>} | 矩形框高度样式枚举。 |
106| [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) {<br/>RECT_WIDTH_STYLE_TIGHT, RECT_WIDTH_STYLE_MAX<br/>} | 矩形框宽度样式枚举。 |
107| [OH_Drawing_ColorFormat](#oh_drawing_colorformat) {<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/>} | 用于描述位图像素的存储格式。 |
108| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) {<br/>ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL<br/>} | 用于描述位图像素的透明度分量。 |
109| [OH_Drawing_BlendMode](#oh_drawing_blendmode) {<br/>BLEND_MODE_CLEAR, BLEND_MODE_SRC, BLEND_MODE_DST, BLEND_MODE_SRC_OVER,<br/>BLEND_MODE_DST_OVER, BLEND_MODE_SRC_IN, BLEND_MODE_DST_IN, BLEND_MODE_SRC_OUT,<br/>BLEND_MODE_DST_OUT, BLEND_MODE_SRC_ATOP, BLEND_MODE_DST_ATOP, BLEND_MODE_XOR,<br/>BLEND_MODE_PLUS, BLEND_MODE_MODULATE, BLEND_MODE_SCREEN, BLEND_MODE_OVERLAY,<br/>BLEND_MODE_DARKEN, BLEND_MODE_LIGHTEN, BLEND_MODE_COLOR_DODGE, BLEND_MODE_COLOR_BURN,<br/>BLEND_MODE_HARD_LIGHT, BLEND_MODE_SOFT_LIGHT, BLEND_MODE_DIFFERENCE, BLEND_MODE_EXCLUSION,<br/>BLEND_MODE_MULTIPLY, BLEND_MODE_HUE, BLEND_MODE_SATURATION, BLEND_MODE_COLOR,<br/>BLEND_MODE_LUMINOSITY<br/>} | 混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 |
110
111
112### 函数
113
114| 名称 | 描述 |
115| -------- | -------- |
116| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | 用于创建一个位图对象。 |
117| void [OH_Drawing_BitmapDestroy](#oh_drawing_bitmapdestroy) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于销毁位图对象并回收该对象占有内存。 |
118| 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) \*) | 用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 |
119| uint32_t [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的宽度。 |
120| uint32_t [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的高度。 |
121| void \* [OH_Drawing_BitmapGetPixels](#oh_drawing_bitmapgetpixels) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 |
122| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | 用于创建一个画刷对象。 |
123| void [OH_Drawing_BrushDestroy](#oh_drawing_brushdestroy) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于销毁画刷对象并回收该对象占有的内存。 |
124| bool [OH_Drawing_BrushIsAntiAlias](#oh_drawing_brushisantialias) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
125| void [OH_Drawing_BrushSetAntiAlias](#oh_drawing_brushsetantialias) ([OH_Drawing_Brush](#oh_drawing_brush) \*, bool) | 用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
126| uint32_t [OH_Drawing_BrushGetColor](#oh_drawing_brushgetcolor) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 |
127| void [OH_Drawing_BrushSetColor](#oh_drawing_brushsetcolor) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint32_t color) | 用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 |
128| uint8_t [OH_Drawing_BrushGetAlpha](#oh_drawing_brushgetalpha) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。 |
129| void [OH_Drawing_BrushSetAlpha](#oh_drawing_brushsetalpha) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint8_t alpha) | 为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。 |
130| void [OH_Drawing_BrushSetShaderEffect](#oh_drawing_brushsetshadereffect) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 为画刷设置着色器效果。 |
131| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 |
132| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | 用于创建一个画布对象。 |
133| void [OH_Drawing_CanvasDestroy](#oh_drawing_canvasdestroy) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于销毁画布对象并回收该对象占有的内存。 |
134| void [OH_Drawing_CanvasBind](#oh_drawing_canvasbind) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 |
135| void [OH_Drawing_CanvasAttachPen](#oh_drawing_canvasattachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 |
136| void [OH_Drawing_CanvasDetachPen](#oh_drawing_canvasdetachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 |
137| void [OH_Drawing_CanvasAttachBrush](#oh_drawing_canvasattachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 |
138| void [OH_Drawing_CanvasDetachBrush](#oh_drawing_canvasdetachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画刷,使用后画布将不去填充图形形状。 |
139| void [OH_Drawing_CanvasSave](#oh_drawing_canvassave) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于保存当前画布的状态(画布矩阵)到一个栈顶。 |
140| void [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于恢复保存在栈顶的画布状态(画布矩阵)。 |
141| uint32_t [OH_Drawing_CanvasGetSaveCount](#oh_drawing_canvasgetsavecount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于获取栈中保存的画布状态(画布矩阵)的数量。 |
142| void [OH_Drawing_CanvasRestoreToCount](#oh_drawing_canvasrestoretocount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t saveCount) | 用于恢复到指定数量的画布状态(画布矩阵)。 |
143| void [OH_Drawing_CanvasDrawLine](#oh_drawing_canvasdrawline) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float x1, float y1, float x2, float y2) | 用于画一条直线段。 |
144| void [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | 用于画一个自定义路径。 |
145| void [OH_Drawing_CanvasDrawBitmap](#oh_drawing_canvasdrawbitmap) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, float left, float top) | 用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。 |
146| void [OH_Drawing_CanvasDrawRect](#oh_drawing_canvasdrawrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个矩形。 |
147| void [OH_Drawing_CanvasDrawCircle](#oh_drawing_canvasdrawcircle) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Point](#oh_drawing_point) \*, float radius) | 用于画一个圆形。 |
148| void [OH_Drawing_CanvasDrawOval](#oh_drawing_canvasdrawoval) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个椭圆。 |
149| void [OH_Drawing_CanvasDrawArc](#oh_drawing_canvasdrawarc) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | 用于画一个弧。 |
150| void [OH_Drawing_CanvasDrawRoundRect](#oh_drawing_canvasdrawroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于画一个圆角矩形。 |
151| void [OH_Drawing_CanvasDrawTextBlob](#oh_drawing_canvasdrawtextblob) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_TextBlob](#oh_drawing_textblob) \*, float x, float y) | 用于画一段文字。 |
152| uint32_t [OH_Drawing_ColorSetArgb](#oh_drawing_colorsetargb) (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | 用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 |
153| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateBlendMode](#oh_drawing_colorfiltercreateblendmode) (uint32_t color, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 创建具有混合模式的颜色滤波器。 |
154| [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) | 将两个颜色滤波器合成一个新的颜色滤波器。 |
155| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateMatrix](#oh_drawing_colorfiltercreatematrix) (const float matrix[20]) | 创建具有5x4颜色矩阵的颜色滤波器。 |
156| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLinearToSrgbGamma](#oh_drawing_colorfiltercreatelineartosrgbgamma) (void) | 创建一个颜色滤波器将SRGB的伽玛曲线应用到RGB颜色通道。 |
157| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateSrgbGammaToLinear](#oh_drawing_colorfiltercreatesrgbgammatolinear) (void) | 创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。 |
158| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLuma](#oh_drawing_colorfiltercreateluma) (void) | 创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。 |
159| void [OH_Drawing_ColorFilterDestroy](#oh_drawing_colorfilterdestroy) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 销毁颜色滤波器对象,并收回该对象占用的内存。 |
160| [OH_Drawing_Filter](#oh_drawing_filter) \* [OH_Drawing_FilterCreate](#oh_drawing_filtercreate) (void) | 创建一个滤波器对象。 |
161| void [OH_Drawing_FilterSetMaskFilter](#oh_drawing_filtersetmaskfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 为滤波器对象设置蒙板滤波器对象。 |
162| void [OH_Drawing_FilterSetColorFilter](#oh_drawing_filtersetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 为滤波器对象设置颜色滤波器对象。 |
163| void [OH_Drawing_FilterDestroy](#oh_drawing_filterdestroy) ([OH_Drawing_Filter](#oh_drawing_filter) \*) | 销毁滤波器对象,并收回该对象占用的内存。 |
164| [OH_Drawing_Font](#oh_drawing_font) \* [OH_Drawing_FontCreate](#oh_drawing_fontcreate) (void) | 用于创建一个字体对象。 |
165| void [OH_Drawing_FontSetTypeface](#oh_drawing_fontsettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于给字体设置字形。 |
166| void [OH_Drawing_FontSetTextSize](#oh_drawing_fontsettextsize) ([OH_Drawing_Font](#oh_drawing_font) \*, float textSize) | 用于给字体设置文字大小。 |
167| void [OH_Drawing_FontSetLinearText](#oh_drawing_fontsetlineartext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isLinearText) | 用于设置线性可缩放字体。 |
168| void [OH_Drawing_FontSetTextSkewX](#oh_drawing_fontsettextskewx) ([OH_Drawing_Font](#oh_drawing_font) \*, float skewX) | 用于给字体设置文本倾斜。 |
169| void [OH_Drawing_FontSetFakeBoldText](#oh_drawing_fontsetfakeboldtext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isFakeBoldText) | 用于设置增加描边宽度以近似粗体字体效果。 |
170| void [OH_Drawing_FontDestroy](#oh_drawing_fontdestroy) ([OH_Drawing_Font](#oh_drawing_font) \*) | 用于销毁字体对象并回收该对象占有的内存。 |
171| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | 创建字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 |
172| void [OH_Drawing_DestroyFontCollection](#oh_drawing_destroyfontcollection) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 释放被字体集对象占据的内存。 |
173| [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \* [OH_Drawing_MaskFilterCreateBlur](#oh_drawing_maskfiltercreateblur) ([OH_Drawing_BlurType](#oh_drawing_blurtype) blurType, float sigma, bool respectCTM) | 创建具有模糊效果的模板滤波器。 |
174| void [OH_Drawing_MaskFilterDestroy](#oh_drawing_maskfilterdestroy) ([OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 销毁模板滤波器对象,并收回该对象占用的内存。 |
175| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate) (void) | 用于创建一个矩阵对象。 |
176| 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) | 用于给矩阵对象设置参数。 |
177| void [OH_Drawing_MatrixDestroy](#oh_drawing_matrixdestroy) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 用于销毁矩阵对象并回收该对象占有的内存。 |
178| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | 用于创建一个路径对象。 |
179| void [OH_Drawing_PathDestroy](#oh_drawing_pathdestroy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于销毁路径对象并回收该对象占有的内存。 |
180| void [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于设置自定义路径的起始点位置。 |
181| void [OH_Drawing_PathLineTo](#oh_drawing_pathlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于添加一条从路径的最后点位置到目标点位置的线段。 |
182| 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) | 用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 |
183| void [OH_Drawing_PathQuadTo](#oh_drawing_pathquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线。 |
184| 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) | 用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线。 |
185| void [OH_Drawing_PathClose](#oh_drawing_pathclose) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 |
186| void [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于重置自定义路径数据。 |
187| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | 用于创建一个画笔对象。 |
188| void [OH_Drawing_PenDestroy](#oh_drawing_pendestroy) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于销毁画笔对象并回收该对象占有的内存。 |
189| bool [OH_Drawing_PenIsAntiAlias](#oh_drawing_penisantialias) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
190| void [OH_Drawing_PenSetAntiAlias](#oh_drawing_pensetantialias) ([OH_Drawing_Pen](#oh_drawing_pen) \*, bool) | 用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 |
191| uint32_t [OH_Drawing_PenGetColor](#oh_drawing_pengetcolor) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 |
192| void [OH_Drawing_PenSetColor](#oh_drawing_pensetcolor) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint32_t color) | 用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 |
193| uint8_t [OH_Drawing_PenGetAlpha](#oh_drawing_pengetalpha) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。 |
194| void [OH_Drawing_PenSetAlpha](#oh_drawing_pensetalpha) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint8_t alpha) | 为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。 |
195| float [OH_Drawing_PenGetWidth](#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 |
196| void [OH_Drawing_PenSetWidth](#oh_drawing_pensetwidth) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float width) | 用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 |
197| float [OH_Drawing_PenGetMiterLimit](#oh_drawing_pengetmiterlimit) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 |
198| void [OH_Drawing_PenSetMiterLimit](#oh_drawing_pensetmiterlimit) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float miter) | 用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 |
199| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)[OH_Drawing_PenGetCap](#oh_drawing_pengetcap) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔笔帽的样式。 |
200| void [OH_Drawing_PenSetCap](#oh_drawing_pensetcap) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)) | 用于设置画笔笔帽样式。 |
201| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)[OH_Drawing_PenGetJoin](#oh_drawing_pengetjoin) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔绘制折线转角的样式。 |
202| void [OH_Drawing_PenSetJoin](#oh_drawing_pensetjoin) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)) | 用于设置画笔绘制转角的样式。 |
203| void [OH_Drawing_PenSetShaderEffect](#oh_drawing_pensetshadereffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 设置画笔着色器效果。 |
204| void [OH_Drawing_PenSetFilter](#oh_drawing_pensetfilter) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | 设置画笔滤波器。 |
205| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_PointCreate](#oh_drawing_pointcreate) (float x, float y) | 用于创建一个坐标点对象。 |
206| void [OH_Drawing_PointDestroy](#oh_drawing_pointdestroy) ([OH_Drawing_Point](#oh_drawing_point) \*) | 用于销毁坐标点对象并回收该对象占有的内存。 |
207| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_RectCreate](#oh_drawing_rectcreate) (float left, float top, float right, float bottom) | 用于创建一个矩形对象。 |
208| void [OH_Drawing_RectDestroy](#oh_drawing_rectdestroy) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于销毁矩形对象并回收该对象占有的内存。 |
209| [OH_Drawing_RoundRect](#oh_drawing_roundrect) \* [OH_Drawing_RoundRectCreate](#oh_drawing_roundrectcreate) (const [OH_Drawing_Rect](#oh_drawing_rect) \*, float xRad, float yRad) | 用于创建一个圆角矩形对象。 |
210| uint32_t [OH_Drawing_RegisterFont](#oh_drawing_registerfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, const char \*familySrc) | 用于在字体管理器中注册自定义字体。 |
211| uint32_t [OH_Drawing_RegisterFontBuffer](#oh_drawing_registerfontbuffer) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, uint8_t \*fontBuffer, size_t length) | 用于在字体管理器中注册字体缓冲区。 |
212| void [OH_Drawing_RoundRectDestroy](#oh_drawing_roundrectdestroy) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于销毁圆角矩形对象并回收该对象占有的内存。 |
213| [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)) | 创建着色器,在两个指定点之间生成线性渐变。 |
214| [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)) | 创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 |
215| [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)) | 创建着色器,在给定中心的情况下生成扇形渐变。 |
216| void [OH_Drawing_ShaderEffectDestroy](#oh_drawing_shadereffectdestroy) ([OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 销毁着色器对象,并收回该对象占用的内存。 |
217| [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \* [OH_Drawing_TextBlobBuilderCreate](#oh_drawing_textblobbuildercreate) (void) | 用于创建一个文本构造器对象。 |
218| 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)后禁止使用。 |
219| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | 用于从文本构造器中创建文本对象。 |
220| void [OH_Drawing_TextBlobDestroy](#oh_drawing_textblobdestroy) ([OH_Drawing_TextBlob](#oh_drawing_textblob) \*) | 用于销毁文本对象并回收该对象占有的内存。 |
221| void [OH_Drawing_TextBlobBuilderDestroy](#oh_drawing_textblobbuilderdestroy) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | 用于销毁文本构造器对象并回收该对象占有的内存。 |
222| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \* [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | 创建OH_Drawing_TypographyStyle |
223| void [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 释放被OH_Drawing_TypographyStyle对象占据的内存。 |
224| void [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本方向。 |
225| void [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本对齐方式。 |
226| void [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本最大行数。 |
227| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | 创建OH_Drawing_TextStyle。 |
228| void [OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 释放被OH_Drawing_TextStyle对象占据的内存。 |
229| void [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置文本颜色。 |
230| void [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置字号。 |
231| void [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字重。 |
232| void [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体基线位置。 |
233| void [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置装饰。 |
234| void [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置装饰颜色。 |
235| void [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置字体高度。 |
236| void [OH_Drawing_SetTextStyleFontFamilies](#oh_drawing_settextstylefontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int, const char \*fontFamilies[]) | 设置字体类型。 |
237| void [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体风格。 |
238| void [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置语言区域。 |
239| [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对象的指针。 |
240| void [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 释放被OH_Drawing_TypographyCreate对象占据的内存。 |
241| void [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 设置排版风格。 |
242| void [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | 设置文本内容。 |
243| void [OH_Drawing_TypographyHandlerPopTextStyle](#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 排版弹出。 |
244| [OH_Drawing_Typography](#oh_drawing_typography) \* [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 创建OH_Drawing_Typography。 |
245| void [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 释放OH_Drawing_Typography对象占据的内存。 |
246| void [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | 排版布局。 |
247| void [OH_Drawing_TypographyPaint](#oh_drawing_typographypaint) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, double, double) | 显示文本。 |
248| double [OH_Drawing_TypographyGetMaxWidth](#oh_drawing_typographygetmaxwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最大宽度。 |
249| double [OH_Drawing_TypographyGetHeight](#oh_drawing_typographygetheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取高度。 |
250| double [OH_Drawing_TypographyGetLongestLine](#oh_drawing_typographygetlongestline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最长行。 |
251| double [OH_Drawing_TypographyGetMinIntrinsicWidth](#oh_drawing_typographygetminintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最小固有宽度。 |
252| double [OH_Drawing_TypographyGetMaxIntrinsicWidth](#oh_drawing_typographygetmaxintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最大固有宽度。 |
253| double [OH_Drawing_TypographyGetAlphabeticBaseline](#oh_drawing_typographygetalphabeticbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取字母文字基线。 |
254| double [OH_Drawing_TypographyGetIdeographicBaseline](#oh_drawing_typographygetideographicbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取表意文字基线。 |
255| void [OH_Drawing_TypographyHandlerAddPlaceholder](#oh_drawing_typographyhandleraddplaceholder) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) \*) | 设置占位符 |
256| bool [OH_Drawing_TypographyDidExceedMaxLines](#oh_drawing_typographydidexceedmaxlines) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本是否超过最大行 |
257| [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)) | 获取指定范围内的文本框 |
258| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取占位符的文本框 |
259| float [OH_Drawing_GetLeftFromTextBox](#oh_drawing_getleftfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框左侧位置 |
260| float [OH_Drawing_GetRightFromTextBox](#oh_drawing_getrightfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框右侧位置 |
261| float [OH_Drawing_GetTopFromTextBox](#oh_drawing_gettopfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框顶部位置 |
262| float [OH_Drawing_GetBottomFromTextBox](#oh_drawing_getbottomfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框底部位置 |
263| int [OH_Drawing_GetTextDirectionFromTextBox](#oh_drawing_gettextdirectionfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框方向 |
264| size_t [OH_Drawing_GetSizeOfTextBox](#oh_drawing_getsizeoftextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | 获取文本框数量大小 |
265| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本的索引位置和亲和性 |
266| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体 |
267| size_t [OH_Drawing_GetPositionFromPositionAndAffinity](#oh_drawing_getpositionfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的位置属性 |
268| int [OH_Drawing_GetAffinityFromPositionAndAffinity](#oh_drawing_getaffinityfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本 |
269| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t) | 获取单词的边界 |
270| size_t [OH_Drawing_GetStartFromRange](#oh_drawing_getstartfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象开始位置 |
271| size_t [OH_Drawing_GetEndFromRange](#oh_drawing_getendfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象结束位置 |
272| size_t [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本行数 |
273| void [OH_Drawing_SetTextStyleDecorationStyle](#oh_drawing_settextstyledecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置文本装饰样式 |
274| void [OH_Drawing_SetTextStyleDecorationThicknessScale](#oh_drawing_settextstyledecorationthicknessscale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本装饰线的厚度缩放比例 |
275| void [OH_Drawing_SetTextStyleLetterSpacing](#oh_drawing_settextstyleletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的字符间距 |
276| void [OH_Drawing_SetTextStyleWordSpacing](#oh_drawing_settextstylewordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的单词间距 |
277| void [OH_Drawing_SetTextStyleHalfLeading](#oh_drawing_settextstylehalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, bool) | 设置文本为一半行间距 |
278| void [OH_Drawing_SetTextStyleEllipsis](#oh_drawing_settextstyleellipsis) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置文本的省略号内容 |
279| void [OH_Drawing_SetTextStyleEllipsisModal](#oh_drawing_settextstyleellipsismodal) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置文本的省略号样式 |
280| void [OH_Drawing_SetTypographyTextBreakStrategy](#oh_drawing_settypographytextbreakstrategy) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本的中断策略 |
281| void [OH_Drawing_SetTypographyTextWordBreakType](#oh_drawing_settypographytextwordbreaktype) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置单词的断词方式 |
282| void [OH_Drawing_SetTypographyTextEllipsisModal](#oh_drawing_settypographytextellipsismodal) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本的省略号样式 |
283| double [OH_Drawing_TypographyGetLineHeight](#oh_drawing_typographygetlineheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取指定行的行高 |
284| double [OH_Drawing_TypographyGetLineWidth](#oh_drawing_typographygetlinewidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取指定行的行宽 |
285| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateDefault](#oh_drawing_typefacecreatedefault) (void) | 用于创建一个默认的字形对象。 |
286| void [OH_Drawing_TypefaceDestroy](#oh_drawing_typefacedestroy) ([OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于销毁字形对象并回收该对象占有的内存。 |
287| 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) | 用于裁剪一个矩形。 |
288| 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) | 用于裁剪一个自定义路径。 |
289| void [OH_Drawing_CanvasRotate](#oh_drawing_canvasrotate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float degrees, float px, float py) | 用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。 |
290| void [OH_Drawing_CanvasTranslate](#oh_drawing_canvastranslate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float dx, float dy) | 用于平移画布一段距离。 |
291| void [OH_Drawing_CanvasScale](#oh_drawing_canvasscale) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | 用于画布缩放。 |
292| void [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | 用于使用指定颜色去清空画布。 |
293
294## 类型定义说明
295
296
297### OH_Drawing_Bitmap
298
299```
300typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap
301```
302
303**描述**
304
305定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。
306
307**起始版本:** 8
308
309
310### OH_Drawing_Brush
311
312```
313typedef struct OH_Drawing_Brush OH_Drawing_Brush
314```
315
316**描述**
317
318定义为画刷,画刷用于描述填充图形的样式和颜色。
319
320**起始版本:** 8
321
322
323### OH_Drawing_Canvas
324
325```
326typedef struct OH_Drawing_Canvas OH_Drawing_Canvas
327```
328
329**描述**
330
331定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。
332
333**起始版本:** 8
334
335
336### OH_Drawing_ColorFilter
337
338```
339typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter
340```
341
342**描述**
343
344定义颜色滤波器,传入一个颜色并返回一个新的颜色。
345
346**起始版本:** 11
347
348
349### OH_Drawing_Filter
350
351```
352typedef struct OH_Drawing_Filter OH_Drawing_Filter
353```
354
355**描述**
356
357定义一个滤波器,用于存储颜色滤波器和模板滤波器。
358
359**起始版本:** 11
360
361
362### OH_Drawing_Font
363
364```
365typedef struct OH_Drawing_Font OH_Drawing_Font
366```
367
368**描述**
369
370用于描述字体。
371
372**起始版本:** 11
373
374
375### OH_Drawing_FontCollection
376
377```
378typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection
379```
380
381**描述**
382
383用于加载字体。
384
385**起始版本:** 8
386
387
388### OH_Drawing_MaskFilter
389
390```
391typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter
392```
393
394**描述**
395
396定义模板滤波器,用于在绘制模板前对其进行转换。
397
398**起始版本:** 11
399
400
401### OH_Drawing_Matrix
402
403```
404typedef struct OH_Drawing_MatrixOH_Drawing_Matrix
405```
406
407**描述**
408
409定义一个矩阵,用于描述坐标变换。
410
411**起始版本:** 11
412
413
414### OH_Drawing_Path
415
416```
417typedef struct OH_Drawing_PathOH_Drawing_Path
418```
419
420**描述**
421
422定义为路径,路径用于自定义各种形状。
423
424**起始版本:** 8
425
426
427### OH_Drawing_Pen
428
429```
430typedef struct OH_Drawing_Pen OH_Drawing_Pen
431```
432
433**描述**
434
435定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。
436
437**起始版本:** 8
438
439
440### OH_Drawing_Point
441
442```
443typedef struct OH_Drawing_Point OH_Drawing_Point
444```
445
446**描述**
447
448定义一个点,用于描述坐标点。
449
450**起始版本:** 11
451
452
453### OH_Drawing_PositionAndAffinity
454
455```
456typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity
457```
458
459**描述**
460
461用于接收字体的位置和亲和性
462
463**起始版本:** 11
464
465
466### OH_Drawing_Range
467
468```
469typedef struct OH_Drawing_Range OH_Drawing_Range
470```
471
472**描述**
473
474用于接收字体的起始位置和结束位置
475
476**起始版本:** 11
477
478
479### OH_Drawing_Rect
480
481```
482typedef struct OH_Drawing_Rect OH_Drawing_Rect
483```
484
485**描述**
486
487用于描述矩形。
488
489**起始版本:** 11
490
491
492### OH_Drawing_RoundRect
493
494```
495typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect
496```
497
498**描述**
499
500用于描述圆角矩形。
501
502**起始版本:** 11
503
504
505### OH_Drawing_ShaderEffect
506
507```
508typedef struct OH_Drawing_ShaderEffectOH_Drawing_ShaderEffect
509```
510
511**描述**
512
513定义一个着色器,用于描述绘制内容的源颜色。
514
515**起始版本:** 11
516
517
518### OH_Drawing_TextBlob
519
520```
521typedef struct OH_Drawing_TextBlobOH_Drawing_TextBlob
522```
523
524**描述**
525
526定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。
527
528**起始版本:** 11
529
530
531### OH_Drawing_TextBlobBuilder
532
533```
534typedef struct OH_Drawing_TextBlobBuilderOH_Drawing_TextBlobBuilder
535```
536
537**描述**
538
539定义文本构建器,用于构建文本。
540
541**起始版本:** 11
542
543
544### OH_Drawing_TextBox
545
546```
547typedef struct OH_Drawing_TextBoxOH_Drawing_TextBox
548```
549
550**描述**
551
552用于接收文本框的矩形大小、方向和数量大小
553
554**起始版本:** 11
555
556
557### OH_Drawing_TextStyle
558
559```
560typedef struct OH_Drawing_TextStyleOH_Drawing_TextStyle
561```
562
563**描述**
564
565用于管理字体颜色、装饰等。
566
567**起始版本:** 8
568
569
570### OH_Drawing_Typeface
571
572```
573typedef struct OH_Drawing_TypefaceOH_Drawing_Typeface
574```
575
576**描述**
577
578用于描述字形。
579
580**起始版本:** 11
581
582
583### OH_Drawing_Typography
584
585```
586typedef struct OH_Drawing_TypographyOH_Drawing_Typography
587```
588
589**描述**
590
591用于管理排版的布局和显示等。
592
593**起始版本:** 8
594
595
596### OH_Drawing_TypographyCreate
597
598```
599typedef struct OH_Drawing_TypographyCreateOH_Drawing_TypographyCreate
600```
601
602**描述**
603
604用于创建[OH_Drawing_Typography](#oh_drawing_typography)。
605
606**起始版本:** 8
607
608
609### OH_Drawing_TypographyStyle
610
611```
612typedef struct OH_Drawing_TypographyStyleOH_Drawing_TypographyStyle
613```
614
615**描述**
616
617用于管理排版风格,如文字方向等。
618
619**起始版本:** 8
620
621
622## 枚举类型说明
623
624
625### OH_Drawing_AlphaFormat
626
627```
628enum OH_Drawing_AlphaFormat
629```
630
631**描述**
632
633用于描述位图像素的透明度分量。
634
635**起始版本:** 8
636
637| 枚举值 | 描述 |
638| -------- | -------- |
639| ALPHA_FORMAT_UNKNOWN | 未知格式 |
640| ALPHA_FORMAT_OPAQUE | 位图无透明度 |
641| ALPHA_FORMAT_PREMUL | 每个像素的颜色组件由透明度分量预先乘以 |
642| ALPHA_FORMAT_UNPREMUL | 每个像素的颜色组件未由透明度分量预先乘以 |
643
644
645### OH_Drawing_BlendMode
646
647```
648enum OH_Drawing_BlendMode
649```
650
651**描述**
652
653混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。
654
655为简洁起见,我们使用以下缩写:
656
657s : source 源的缩写。 d : destination 目标的缩写。 sa : source alpha 源透明度的缩写。 da : destination alpha 目标透明度的缩写。
658
659计算结果用如下缩写表示:
660
661r : 如果4个通道的计算方式相同,用r表示。 ra : 如果只操作透明度通道,用ra表示。 rc : 如果操作3个颜色通道,用rc表示。
662
663**起始版本:** 11
664
665| 枚举值 | 描述 |
666| -------- | -------- |
667| BLEND_MODE_CLEAR | 清除模式,r = 0。 |
668| BLEND_MODE_SRC | r = s(result的4个通道,都等于source的4个通道,即结果等于源。) |
669| BLEND_MODE_DST | r = d(result的4个通道,都等于destination的4个通道,即结果等于目标。) |
670| BLEND_MODE_SRC_OVER | r = s + (1 - sa) \* d |
671| BLEND_MODE_DST_OVER | r = d + (1 - da) \* s |
672| BLEND_MODE_SRC_IN | r = s \* da |
673| BLEND_MODE_DST_IN | r = d \* sa |
674| BLEND_MODE_SRC_OUT | r = s \* (1 - da) |
675| BLEND_MODE_DST_OUT | r = d \* (1 - sa) |
676| BLEND_MODE_SRC_ATOP | r = s \* da + d \* (1 - sa) |
677| BLEND_MODE_DST_ATOP | r = d \* sa + s \* (1 - da) |
678| BLEND_MODE_XOR | r = s \* (1 - da) + d \* (1 - sa) |
679| BLEND_MODE_PLUS | r = min(s + d, 1) |
680| BLEND_MODE_MODULATE | r = s \* d |
681| BLEND_MODE_SCREEN | 滤色模式,r = s + d - s \* d |
682| BLEND_MODE_OVERLAY | 叠加模式 |
683| BLEND_MODE_DARKEN | 变暗模式,rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d |
684| BLEND_MODE_LIGHTEN | 变亮模式,rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d |
685| BLEND_MODE_COLOR_DODGE | 颜色减淡模式 |
686| BLEND_MODE_COLOR_BURN | 颜色加深模式 |
687| BLEND_MODE_HARD_LIGHT | 强光模式 |
688| BLEND_MODE_SOFT_LIGHT | 柔光模式 |
689| BLEND_MODE_DIFFERENCE | 差值模式,rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d |
690| BLEND_MODE_EXCLUSION | 排除模式,rc = s + d - two(s \* d), ra = s + (1 - sa) \* d |
691| BLEND_MODE_MULTIPLY | 正片叠底,r = s \* (1 - da) + d \* (1 - sa) + s \* d |
692| BLEND_MODE_HUE | 色相模式 |
693| BLEND_MODE_SATURATION | 饱和度模式 |
694| BLEND_MODE_COLOR | 颜色模式 |
695| BLEND_MODE_LUMINOSITY | 亮度模式 |
696
697
698### OH_Drawing_BlurType
699
700```
701enum OH_Drawing_BlurType
702```
703
704**描述**
705
706枚举模糊类型。
707
708**起始版本:** 11
709
710| 枚举值 | 描述 |
711| -------- | -------- |
712| NORMAL | 内外模糊。 |
713| SOLID | 内部实体,外部模糊。 |
714| OUTER | 内部空白,外部模糊。 |
715| INNER | 内部模糊,外部空白。 |
716
717
718### OH_Drawing_BreakStrategy
719
720```
721enum OH_Drawing_BreakStrategy
722```
723
724**描述**
725
726文本的中断策略枚举
727
728**起始版本:** 11
729
730| 枚举值 | 描述 |
731| -------- | -------- |
732| BREAK_STRATEGY_GREEDY | 贪心策略,换行时尽可能填满每一行 |
733| BREAK_STRATEGY_HIGH_QUALITY | 高质量策略,换行时优先考虑文本的连续性 |
734| BREAK_STRATEGY_BALANCED | 平衡策略,换行时在单词边界换行 |
735
736
737### OH_Drawing_CanvasClipOp
738
739```
740enum OH_Drawing_CanvasClipOp
741```
742
743**描述**
744
745画布裁剪方式的枚举集合。
746
747**起始版本:** 11
748
749| 枚举值 | 描述 |
750| -------- | -------- |
751| DIFFERENCE | 将指定区域裁剪(取差集)。 |
752| INTERSECT | 将指定区域保留(取交集)。 |
753
754
755### OH_Drawing_ColorFormat
756
757```
758enum OH_Drawing_ColorFormat
759```
760
761**描述**
762
763用于描述位图像素的存储格式。
764
765**起始版本:** 8
766
767| 枚举值 | 描述 |
768| -------- | -------- |
769| COLOR_FORMAT_UNKNOWN | 未知格式. |
770| COLOR_FORMAT_ALPHA_8 | 每个像素用一个8位的量表示,8个位比特位表示透明度 |
771| COLOR_FORMAT_RGB_565 | 每个像素用一个16位的量表示,高位到低位依次是5个比特位表示红,6个比特位表示绿,5个比特位表示蓝 |
772| COLOR_FORMAT_ARGB_4444 | 每个像素用一个16位的量表示,高位到低位依次是4个比特位表示透明度,4个比特位表示红,4个比特位表示绿,4个比特位表示蓝 |
773| COLOR_FORMAT_RGBA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示透明度,8个比特位表示红,8个比特位表示绿,8个比特位表示蓝 |
774| COLOR_FORMAT_BGRA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示蓝,8个比特位表示绿,8个比特位表示红,8个比特位表示透明度 |
775
776
777### OH_Drawing_EllipsisModal
778
779```
780enum OH_Drawing_EllipsisModal
781```
782
783**描述**
784
785省略号样式枚举
786
787**起始版本:** 11
788
789| 枚举值 | 描述 |
790| -------- | -------- |
791| ELLIPSIS_MODAL_HEAD | 头部模式,即省略号放在文本头部 |
792| ELLIPSIS_MODAL_MIDDLE | 中部模式,即省略号放在文本中部 |
793| ELLIPSIS_MODAL_TAIL | 尾部模式,即省略号放在文本尾部 |
794
795
796### OH_Drawing_FontStyle
797
798```
799enum OH_Drawing_FontStyle
800```
801
802**描述**
803
804区分字体是否为斜体
805
806**起始版本:** 8
807
808| 枚举值 | 描述 |
809| -------- | -------- |
810| FONT_STYLE_NORMAL | 非斜体 |
811| FONT_STYLE_ITALIC | 斜体 |
812
813
814### OH_Drawing_FontWeight
815
816```
817enum OH_Drawing_FontWeight
818```
819
820**描述**
821
822字重
823
824**起始版本:** 8
825
826| 枚举值 | 描述 |
827| -------- | -------- |
828| FONT_WEIGHT_100 | 字重为thin |
829| FONT_WEIGHT_200 | 字重为extra-light |
830| FONT_WEIGHT_300 | 字重为light |
831| FONT_WEIGHT_400 | 字重为normal/regular |
832| FONT_WEIGHT_500 | 字重为medium |
833| FONT_WEIGHT_600 | 字重为semi-bold |
834| FONT_WEIGHT_700 | 字重为bold |
835| FONT_WEIGHT_800 | 字重为extra-bold |
836| FONT_WEIGHT_900 | 字重为black |
837
838
839### OH_Drawing_PenLineCapStyle
840
841```
842enum OH_Drawing_PenLineCapStyle
843```
844
845**描述**
846
847枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。
848
849**起始版本:** 8
850
851| 枚举值 | 描述 |
852| -------- | -------- |
853| LINE_FLAT_CAP | 没有笔帽样式,线条头尾端点处横切 |
854| LINE_SQUARE_CAP | 笔帽的样式为方框,线条的头尾端点处多出一个方框,方框宽度和线段一样宽,高度时线段厚度的一半 |
855| LINE_ROUND_CAP | 笔帽的样式为圆弧,线条的头尾端点处多出一个半圆弧,半圆的直径与线段厚度一致 |
856
857
858### OH_Drawing_PenLineJoinStyle
859
860```
861enum OH_Drawing_PenLineJoinStyle
862```
863
864**描述**
865
866枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。
867
868**起始版本:** 8
869
870| 枚举值 | 描述 |
871| -------- | -------- |
872| LINE_MITER_JOIN | 转角类型为尖角,如果折线角度比较小,则尖角会很长,需要使用限制值(miter limit)进行限制 |
873| LINE_ROUND_JOIN | 转角类型为圆头 |
874| LINE_BEVEL_JOIN | 转角类型为平头 |
875
876
877### OH_Drawing_PlaceholderVerticalAlignment
878
879```
880enum OH_Drawing_PlaceholderVerticalAlignment
881```
882
883**描述**
884
885占位符垂直对齐枚举
886
887**起始版本:** 11
888
889| 枚举值 | 描述 |
890| -------- | -------- |
891| ALIGNMENT_OFFSET_AT_BASELINE | 偏移于基线对齐 |
892| ALIGNMENT_ABOVE_BASELINE | 高于基线对齐 |
893| ALIGNMENT_BELOW_BASELINE | 低于基线对齐 |
894| ALIGNMENT_TOP_OF_ROW_BOX | 行框顶部对齐 |
895| ALIGNMENT_BOTTOM_OF_ROW_BOX | 行框底部对齐 |
896| ALIGNMENT_CENTER_OF_ROW_BOX | 行框中心对齐 |
897
898
899### OH_Drawing_RectHeightStyle
900
901```
902enum OH_Drawing_RectHeightStyle
903```
904
905**描述**
906
907矩形框高度样式枚举
908
909**起始版本:** 11
910
911| 枚举值 | 描述 |
912| -------- | -------- |
913| RECT_HEIGHT_STYLE_TIGHT | 紧密样式 |
914| RECT_HEIGHT_STYLE_MAX | 最大样式 |
915| RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE | 包含行间距中间样式 |
916| RECT_HEIGHT_STYLE_INCLUDELINESPACETOP | 包含行间距顶部样式 |
917| RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM | 包含行间距底部样式 |
918| RECT_HEIGHT_STYLE_STRUCT | 结构样式 |
919
920
921### OH_Drawing_RectWidthStyle
922
923```
924enum OH_Drawing_RectWidthStyle
925```
926
927**描述**
928
929矩形框宽度样式枚举
930
931**起始版本:** 11
932
933| 枚举值 | 描述 |
934| -------- | -------- |
935| RECT_WIDTH_STYLE_TIGHT | 紧密样式 |
936| RECT_WIDTH_STYLE_MAX | 最大样式 |
937
938
939### OH_Drawing_TextAlign
940
941```
942enum OH_Drawing_TextAlign
943```
944
945**描述**
946
947文字对齐方式
948
949**起始版本:**8
950
951| 枚举值 | 描述 |
952| -------- | -------- |
953| TEXT_ALIGN_LEFT | 左对齐 |
954| TEXT_ALIGN_RIGHT | 右对齐 |
955| TEXT_ALIGN_CENTER | 居中对齐 |
956| TEXT_ALIGN_JUSTIFY | 两端对齐,即紧靠左和右边缘,中间单词空隙由空格填充,最后一行除外。 |
957| 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相同。 |
958| 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相同。 |
959
960
961### OH_Drawing_TextBaseline
962
963```
964enum OH_Drawing_TextBaseline
965```
966
967**描述**
968
969基线位置
970
971**起始版本:**8
972
973| 枚举值 | 描述 |
974| -------- | -------- |
975| TEXT_BASELINE_ALPHABETIC | 用于表音文字,基线在中间偏下的位置 |
976| TEXT_BASELINE_IDEOGRAPHIC | 用于表意文字,基线位于底部 |
977
978
979### OH_Drawing_TextDecoration
980
981```
982enum OH_Drawing_TextDecoration
983```
984
985**描述**
986
987文本装饰
988
989**起始版本:**8
990
991| 枚举值 | 描述 |
992| -------- | -------- |
993| TEXT_DECORATION_NONE | 无装饰 |
994| TEXT_DECORATION_UNDERLINE | 下划线 |
995| TEXT_DECORATION_OVERLINE | 上划线 |
996| TEXT_DECORATION_LINE_THROUGH | 删除线 |
997
998
999### OH_Drawing_TextDecorationStyle
1000
1001```
1002enum OH_Drawing_TextDecorationStyle
1003```
1004
1005**描述**
1006
1007文本装饰样式枚举
1008
1009**起始版本:** 11
1010
1011| 枚举值 | 描述 |
1012| -------- | -------- |
1013| TEXT_DECORATION_STYLE_SOLID | 实心样式 |
1014| TEXT_DECORATION_STYLE_DOUBLE | 双重样式 |
1015| TEXT_DECORATION_STYLE_DOTTED | 圆点样式 |
1016| TEXT_DECORATION_STYLE_DASHED | 虚线样式 |
1017| TEXT_DECORATION_STYLE_WAVY | 波浪样式 |
1018
1019
1020### OH_Drawing_TextDirection
1021
1022```
1023enum OH_Drawing_TextDirection
1024```
1025
1026**描述**
1027
1028文字方向
1029
1030**起始版本:**8
1031
1032| 枚举值 | 描述 |
1033| -------- | -------- |
1034| TEXT_DIRECTION_RTL | 方向:从右到左 |
1035| TEXT_DIRECTION_LTR | 方向:从左到右 |
1036
1037
1038### OH_Drawing_TileMode
1039
1040```
1041enum OH_Drawing_TileMode
1042```
1043
1044**描述**
1045
1046着色器效果平铺模式的枚举。
1047
1048**起始版本:** 11
1049
1050| 枚举值 | 描述 |
1051| -------- | -------- |
1052| CLAMP | 如果着色器效果超出其原始边界,则复制边缘颜色。 |
1053| REPEAT | 在水平和垂直方向上重复着色器效果图像。 |
1054| MIRROR | 水平和垂直重复着色器效果图像,交替镜像。 |
1055| DECAL | 只在原始区域内绘制,其他地方返回透明黑色。 |
1056
1057
1058### OH_Drawing_WordBreakType
1059
1060```
1061enum OH_Drawing_WordBreakType
1062```
1063
1064**描述**
1065
1066单词的断词方式枚举
1067
1068**起始版本:** 11
1069
1070| 枚举值 | 描述 |
1071| -------- | -------- |
1072| WORD_BREAK_TYPE_NORMAL | 常规方式 |
1073| WORD_BREAK_TYPE_BREAK_ALL | 全部中断方式 |
1074| WORD_BREAK_TYPE_BREAK_WORD | 单词中断方式 |
1075
1076
1077## 函数说明
1078
1079
1080### OH_Drawing_BitmapBuild()
1081
1082```
1083void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap * , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat *  )
1084```
1085
1086**描述**
1087
1088用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。
1089
1090**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1091
1092**起始版本:** 8
1093
1094**参数:**
1095
1096| 名称 | 描述 |
1097| -------- | -------- |
1098| OH_Drawing_Bitmap | 指向位图对象的指针。 |
1099| width | 参数是位图要初始化设置的宽度。 |
1100| height | 参数是位图要初始化设置的高度。 |
1101| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 参数是位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型。 |
1102
1103
1104### OH_Drawing_BitmapCreate()
1105
1106```
1107OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void )
1108```
1109
1110**描述**
1111
1112用于创建一个位图对象。
1113
1114**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1115
1116**起始版本:** 8
1117
1118**返回:**
1119
1120函数会返回一个指针,指针指向创建的位图对象。
1121
1122
1123### OH_Drawing_BitmapDestroy()
1124
1125```
1126void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap * )
1127```
1128
1129**描述**
1130
1131用于销毁位图对象并回收该对象占有内存。
1132
1133**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1134
1135**起始版本:** 8
1136
1137**参数:**
1138
1139| 名称 | 描述 |
1140| -------- | -------- |
1141| OH_Drawing_Bitmap | 指向位图对象的指针。 |
1142
1143
1144### OH_Drawing_BitmapGetHeight()
1145
1146```
1147uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap * )
1148```
1149
1150**描述**
1151
1152用于获取指定位图的高度。
1153
1154**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1155
1156**起始版本:** 8
1157
1158**参数:**
1159
1160| 名称 | 描述 |
1161| -------- | -------- |
1162| OH_Drawing_Bitmap | 指向位图对象的指针。 |
1163
1164**返回:**
1165
1166函数返回位图的高度。
1167
1168
1169### OH_Drawing_BitmapGetPixels()
1170
1171```
1172void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap * )
1173```
1174
1175**描述**
1176
1177用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。
1178
1179**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1180
1181**起始版本:** 8
1182
1183**参数:**
1184
1185| 名称 | 描述 |
1186| -------- | -------- |
1187| OH_Drawing_Bitmap | 指向位图对象的指针。 |
1188
1189**返回:**
1190
1191函数返回位图的像素地址。
1192
1193
1194### OH_Drawing_BitmapGetWidth()
1195
1196```
1197uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap * )
1198```
1199
1200**描述**
1201
1202用于获取指定位图的宽度。
1203
1204**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1205
1206**起始版本:** 8
1207
1208**参数:**
1209
1210| 名称 | 描述 |
1211| -------- | -------- |
1212| OH_Drawing_Bitmap | 指向位图对象的指针。 |
1213
1214**返回:**
1215
1216函数返回位图的宽度。
1217
1218
1219### OH_Drawing_BrushCreate()
1220
1221```
1222OH_Drawing_Brush* OH_Drawing_BrushCreate (void )
1223```
1224
1225**描述**
1226
1227用于创建一个画刷对象。
1228
1229**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1230
1231**起始版本:** 8
1232
1233**返回:**
1234
1235函数会返回一个指针,指针指向创建的画刷对象。
1236
1237
1238### OH_Drawing_BrushDestroy()
1239
1240```
1241void OH_Drawing_BrushDestroy (OH_Drawing_Brush * )
1242```
1243
1244**描述**
1245
1246用于销毁画刷对象并回收该对象占有的内存。
1247
1248**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1249
1250**起始版本:** 8
1251
1252**参数:**
1253
1254| 名称 | 描述 |
1255| -------- | -------- |
1256| OH_Drawing_Brush | 指向画刷对象的指针。 |
1257
1258
1259### OH_Drawing_BrushGetAlpha()
1260
1261```
1262uint8_t OH_Drawing_BrushGetAlpha (const OH_Drawing_Brush * )
1263```
1264
1265**描述**
1266
1267获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。
1268
1269**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1270
1271**起始版本:** 11
1272
1273**参数:**
1274
1275| 名称 | 描述 |
1276| -------- | -------- |
1277| OH_Drawing_Brush | 表示指向画刷对象的指针。 |
1278
1279**返回:**
1280
1281返回一个8位变量,用于表示透明度值。
1282
1283
1284### OH_Drawing_BrushGetColor()
1285
1286```
1287uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush * )
1288```
1289
1290**描述**
1291
1292用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。
1293
1294**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1295
1296**起始版本:** 8
1297
1298**参数:**
1299
1300| 名称 | 描述 |
1301| -------- | -------- |
1302| OH_Drawing_Brush | 指向画刷对象的指针。 |
1303
1304**返回:**
1305
1306函数返回一个描述颜色的32位(ARGB)变量。
1307
1308
1309### OH_Drawing_BrushIsAntiAlias()
1310
1311```
1312bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush * )
1313```
1314
1315**描述**
1316
1317用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
1318
1319**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1320
1321**起始版本:** 8
1322
1323**参数:**
1324
1325| 名称 | 描述 |
1326| -------- | -------- |
1327| OH_Drawing_Brush | 指向画刷对象的指针。 |
1328
1329**返回:**
1330
1331函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。
1332
1333
1334### OH_Drawing_BrushSetAlpha()
1335
1336```
1337void OH_Drawing_BrushSetAlpha (OH_Drawing_Brush * , uint8_t alpha )
1338```
1339
1340**描述**
1341
1342为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。
1343
1344**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1345
1346**起始版本:** 11
1347
1348**参数:**
1349
1350| 名称 | 描述 |
1351| -------- | -------- |
1352| OH_Drawing_Brush | 指向画刷对象的指针。 |
1353| alpha | 表示要设置的透明度值,是一个8位变量。 |
1354
1355
1356### OH_Drawing_BrushSetAntiAlias()
1357
1358```
1359void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush * , bool  )
1360```
1361
1362**描述**
1363
1364用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
1365
1366**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1367
1368**起始版本:** 8
1369
1370**参数:**
1371
1372| 名称 | 描述 |
1373| -------- | -------- |
1374| OH_Drawing_Brush | 指向画刷对象的指针。 |
1375| bool | 参数真为抗锯齿,参数假则不做抗锯齿处理。 |
1376
1377
1378### OH_Drawing_BrushSetColor()
1379
1380```
1381void OH_Drawing_BrushSetColor (OH_Drawing_Brush * , uint32_t color )
1382```
1383
1384**描述**
1385
1386用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。
1387
1388**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1389
1390**起始版本:** 8
1391
1392**参数:**
1393
1394| 名称 | 描述 |
1395| -------- | -------- |
1396| OH_Drawing_Brush | 指向画刷对象的指针。 |
1397| color | 描述颜色的32位(ARGB)变量。 |
1398
1399
1400### OH_Drawing_BrushSetFilter()
1401
1402```
1403void OH_Drawing_BrushSetFilter (OH_Drawing_Brush * , OH_Drawing_Filter *  )
1404```
1405
1406**描述**
1407
1408为画刷设置滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。
1409
1410**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1411
1412**起始版本:** 11
1413
1414**参数:**
1415
1416| 名称 | 描述 |
1417| -------- | -------- |
1418| OH_Drawing_Brush | 指向画刷对象的指针。 |
1419| OH_Drawing_Filter | 表示指向滤波器对象的指针,为空表示清空画刷滤波器。 |
1420
1421
1422### OH_Drawing_BrushSetShaderEffect()
1423
1424```
1425void OH_Drawing_BrushSetShaderEffect (OH_Drawing_Brush * , OH_Drawing_ShaderEffect *  )
1426```
1427
1428**描述**
1429
1430为画刷设置着色器效果。
1431
1432**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1433
1434**起始版本:** 11
1435
1436**参数:**
1437
1438| 名称 | 描述 |
1439| -------- | -------- |
1440| OH_Drawing_Brush | 指向画刷对象的指针。 |
1441| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针。 |
1442
1443
1444### OH_Drawing_CanvasAttachBrush()
1445
1446```
1447void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas * , const OH_Drawing_Brush *  )
1448```
1449
1450**描述**
1451
1452用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。
1453
1454**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1455
1456**起始版本:** 8
1457
1458**参数:**
1459
1460| 名称 | 描述 |
1461| -------- | -------- |
1462| OH_Drawing_Canvas | 指向画布对象的指针。 |
1463| OH_Drawing_Brush | 指向画刷对象的指针。 |
1464
1465
1466### OH_Drawing_CanvasAttachPen()
1467
1468```
1469void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas * , const OH_Drawing_Pen *  )
1470```
1471
1472**描述**
1473
1474用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。
1475
1476**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1477
1478**起始版本:** 8
1479
1480**参数:**
1481
1482| 名称 | 描述 |
1483| -------- | -------- |
1484| OH_Drawing_Canvas | 指向画布对象的指针。 |
1485| OH_Drawing_Pen | 指向画笔对象的指针。 |
1486
1487
1488### OH_Drawing_CanvasBind()
1489
1490```
1491void OH_Drawing_CanvasBind (OH_Drawing_Canvas * , OH_Drawing_Bitmap *  )
1492```
1493
1494**描述**
1495
1496用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。
1497
1498**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1499
1500**起始版本:** 8
1501
1502**参数:**
1503
1504| 名称 | 描述 |
1505| -------- | -------- |
1506| OH_Drawing_Canvas | 指向画布对象的指针。 |
1507| OH_Drawing_Bitmap | 指向位图对象的指针。 |
1508
1509
1510### OH_Drawing_CanvasClear()
1511
1512```
1513void OH_Drawing_CanvasClear (OH_Drawing_Canvas * , uint32_t color )
1514```
1515
1516**描述**
1517
1518用于使用指定颜色去清空画布。
1519
1520**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1521
1522**起始版本:** 8
1523
1524**参数:**
1525
1526| 名称 | 描述 |
1527| -------- | -------- |
1528| OH_Drawing_Canvas | 指向画布对象的指针。 |
1529| color | 描述颜色的32位(ARGB)变量。 |
1530
1531
1532### OH_Drawing_CanvasClipPath()
1533
1534```
1535void OH_Drawing_CanvasClipPath (OH_Drawing_Canvas * , const OH_Drawing_Path * , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
1536```
1537
1538**描述**
1539
1540用于裁剪一个自定义路径。
1541
1542**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1543
1544**起始版本:** 11
1545
1546**参数:**
1547
1548| 名称 | 描述 |
1549| -------- | -------- |
1550| OH_Drawing_Canvas | 指向画布对象的指针。 |
1551| OH_Drawing_Path | 指向路径对象的指针。 |
1552| clipOp | 裁剪方式。支持可选的具体裁剪方式可见link OH_Drawing_CanvasClipOp}枚举。 |
1553| doAntiAlias | 参数真为抗锯齿,参数假则不做抗锯齿处理。 |
1554
1555
1556### OH_Drawing_CanvasClipRect()
1557
1558```
1559void OH_Drawing_CanvasClipRect (OH_Drawing_Canvas * , const OH_Drawing_Rect * , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
1560```
1561
1562**描述**
1563
1564用于裁剪一个矩形。
1565
1566**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1567
1568**起始版本:** 11
1569
1570**参数:**
1571
1572| 名称 | 描述 |
1573| -------- | -------- |
1574| OH_Drawing_Canvas | 指向画布对象的指针。 |
1575| OH_Drawing_Rect | 指向矩形对象的指针。 |
1576| clipOp | 裁剪方式。支持可选的具体裁剪方式可见link OH_Drawing_CanvasClipOp}枚举。 |
1577| doAntiAlias | 值为true则做抗锯齿处理,反之不做。 |
1578
1579
1580### OH_Drawing_CanvasCreate()
1581
1582```
1583OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void )
1584```
1585
1586**描述**
1587
1588用于创建一个画布对象。
1589
1590**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1591
1592**起始版本:** 8
1593
1594**返回:**
1595
1596函数会返回一个指针,指针指向创建的画布对象。
1597
1598
1599### OH_Drawing_CanvasDestroy()
1600
1601```
1602void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas * )
1603```
1604
1605**描述**
1606
1607用于销毁画布对象并回收该对象占有的内存。
1608
1609**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1610
1611**起始版本:** 8
1612
1613**参数:**
1614
1615| 名称 | 描述 |
1616| -------- | -------- |
1617| OH_Drawing_Canvas | 指向画布对象的指针。 |
1618
1619
1620### OH_Drawing_CanvasDetachBrush()
1621
1622```
1623void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas * )
1624```
1625
1626**描述**
1627
1628用于去除掉画布中的画刷,使用后画布将不去填充图形形状。
1629
1630**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1631
1632**起始版本:** 8
1633
1634**参数:**
1635
1636| 名称 | 描述 |
1637| -------- | -------- |
1638| OH_Drawing_Canvas | 指向画布对象的指针。 |
1639
1640
1641### OH_Drawing_CanvasDetachPen()
1642
1643```
1644void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas * )
1645```
1646
1647**描述**
1648
1649用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。
1650
1651**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1652
1653**起始版本:** 8
1654
1655**参数:**
1656
1657| 名称 | 描述 |
1658| -------- | -------- |
1659| OH_Drawing_Canvas | 指向画布对象的指针。 |
1660
1661
1662### OH_Drawing_CanvasDrawArc()
1663
1664```
1665void OH_Drawing_CanvasDrawArc (OH_Drawing_Canvas * , const OH_Drawing_Rect * , float startAngle, float sweepAngle )
1666```
1667
1668**描述**
1669
1670用于画一个弧。
1671
1672**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1673
1674**起始版本:** 11
1675
1676**参数:**
1677
1678| 名称 | 描述 |
1679| -------- | -------- |
1680| OH_Drawing_Canvas | 指向画布对象的指针。 |
1681| OH_Drawing_Rect | 指向矩形对象的指针。 |
1682| startAngle | 弧的起始角度。 |
1683| sweepAngle | 弧的扫描角度。 |
1684
1685
1686### OH_Drawing_CanvasDrawBitmap()
1687
1688```
1689void OH_Drawing_CanvasDrawBitmap (OH_Drawing_Canvas * , const OH_Drawing_Bitmap * , float left, float top )
1690```
1691
1692**描述**
1693
1694用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。
1695
1696**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1697
1698**起始版本:** 11
1699
1700**参数:**
1701
1702| 名称 | 描述 |
1703| -------- | -------- |
1704| OH_Drawing_Canvas | 指向画布对象的指针。 |
1705| OH_Drawing_Bitmap | 指向位图对象的指针。 |
1706| left | 位图对象左上角的横坐标。 |
1707| top | 位图对象左上角的纵坐标。 |
1708
1709
1710### OH_Drawing_CanvasDrawCircle()
1711
1712```
1713void OH_Drawing_CanvasDrawCircle (OH_Drawing_Canvas * , const OH_Drawing_Point * , float radius )
1714```
1715
1716**描述**
1717
1718用于画一个圆形。
1719
1720**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1721
1722**起始版本:** 11
1723
1724**参数:**
1725
1726| 名称 | 描述 |
1727| -------- | -------- |
1728| OH_Drawing_Canvas | 指向画布对象的指针。 |
1729| OH_Drawing_Point | 指向坐标点对象的指针,表示圆心。 |
1730| radius | 圆形的半径。 |
1731
1732### OH_Drawing_CanvasDrawLine()
1733
1734```
1735void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas * , float x1, float y1, float x2, float y2 )
1736```
1737
1738**描述**
1739
1740用于画一条直线段。
1741
1742**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1743
1744**起始版本:** 8
1745
1746**参数:**
1747
1748| 名称 | 描述 |
1749| -------- | -------- |
1750| OH_Drawing_Canvas | 指向画布对象的指针。 |
1751| x1 | 线段起始点的横坐标。 |
1752| y1 | 线段起始点的纵坐标。 |
1753| x2 | 线段结束点的横坐标。 |
1754| y2 | 线段结束点的纵坐标。 |
1755
1756
1757### OH_Drawing_CanvasDrawOval()
1758
1759```
1760void OH_Drawing_CanvasDrawOval (OH_Drawing_Canvas * , const OH_Drawing_Rect *  )
1761```
1762
1763**描述**
1764
1765用于画一个椭圆。
1766
1767**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1768
1769**起始版本:** 11
1770
1771**参数:**
1772
1773| 名称 | 描述 |
1774| -------- | -------- |
1775| OH_Drawing_Canvas | 指向画布对象的指针。 |
1776| OH_Drawing_Rect | 指向矩形对象的指针。 |
1777
1778
1779### OH_Drawing_CanvasDrawPath()
1780
1781```
1782void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas * , const OH_Drawing_Path *  )
1783```
1784
1785**描述**
1786
1787用于画一个自定义路径。
1788
1789**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1790
1791**起始版本:** 8
1792
1793**参数:**
1794
1795| 名称 | 描述 |
1796| -------- | -------- |
1797| OH_Drawing_Canvas | 指向画布对象的指针。 |
1798| OH_Drawing_Path | 指向路径对象的指针。 |
1799
1800
1801### OH_Drawing_CanvasDrawRect()
1802
1803```
1804void OH_Drawing_CanvasDrawRect (OH_Drawing_Canvas * , const OH_Drawing_Rect *  )
1805```
1806
1807**描述**
1808
1809用于画一个矩形。
1810
1811**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1812
1813**起始版本:** 11
1814
1815**参数:**
1816
1817| 名称 | 描述 |
1818| -------- | -------- |
1819| OH_Drawing_Canvas | 指向画布对象的指针。 |
1820| OH_Drawing_Rect | 指向矩形对象的指针。 |
1821
1822
1823### OH_Drawing_CanvasDrawRoundRect()
1824
1825```
1826void OH_Drawing_CanvasDrawRoundRect (OH_Drawing_Canvas * , const OH_Drawing_RoundRect *  )
1827```
1828
1829**描述**
1830
1831用于画一个圆角矩形。
1832
1833**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1834
1835**起始版本:** 11
1836
1837**参数:**
1838
1839| 名称 | 描述 |
1840| -------- | -------- |
1841| OH_Drawing_Canvas | 指向画布对象的指针。 |
1842| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
1843
1844
1845### OH_Drawing_CanvasDrawTextBlob()
1846
1847```
1848void OH_Drawing_CanvasDrawTextBlob (OH_Drawing_Canvas * , const OH_Drawing_TextBlob * , float x, float y )
1849```
1850
1851**描述**
1852
1853用于画一段文字。
1854
1855**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1856
1857**起始版本:** 11
1858
1859**参数:**
1860
1861| 名称 | 描述 |
1862| -------- | -------- |
1863| OH_Drawing_Canvas | 指向画布对象的指针。 |
1864| OH_Drawing_TextBlob | 指向文本对象的指针。 |
1865| x | 文本对象左下角的横坐标。 |
1866| y | 文本对象左下角的纵坐标。 |
1867
1868
1869### OH_Drawing_CanvasGetSaveCount()
1870
1871```
1872uint32_t OH_Drawing_CanvasGetSaveCount (OH_Drawing_Canvas * )
1873```
1874
1875**描述**
1876
1877用于获取栈中保存的画布状态(画布矩阵)的数量。
1878
1879**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1880
1881**起始版本:** 11
1882
1883**参数:**
1884
1885| 名称 | 描述 |
1886| -------- | -------- |
1887| OH_Drawing_Canvas | 指向画布对象的指针。 |
1888
1889**返回:**
1890
1891函数会返回一个32位的值描述画布状态(画布矩阵)的数量。
1892
1893
1894### OH_Drawing_CanvasRestore()
1895
1896```
1897void OH_Drawing_CanvasRestore (OH_Drawing_Canvas * )
1898```
1899
1900**描述**
1901
1902用于恢复保存在栈顶的画布状态(画布矩阵)。
1903
1904**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1905
1906**起始版本:** 8
1907
1908**参数:**
1909
1910| 名称 | 描述 |
1911| -------- | -------- |
1912| OH_Drawing_Canvas | 指向画布对象的指针。 |
1913
1914
1915### OH_Drawing_CanvasRestoreToCount()
1916
1917```
1918void OH_Drawing_CanvasRestoreToCount (OH_Drawing_Canvas * , uint32_t saveCount )
1919```
1920
1921**描述**
1922
1923用于恢复到指定数量的画布状态(画布矩阵)。
1924
1925**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1926
1927**起始版本:** 11
1928
1929**参数:**
1930
1931| 名称 | 描述 |
1932| -------- | -------- |
1933| OH_Drawing_Canvas | 指向画布对象的指针。 |
1934| saveCount | 指定的画布状态(画布矩阵)数量。 |
1935
1936
1937### OH_Drawing_CanvasRotate()
1938
1939```
1940void OH_Drawing_CanvasRotate (OH_Drawing_Canvas * , float degrees, float px, float py )
1941```
1942
1943**描述**
1944
1945用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。
1946
1947**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1948
1949**起始版本:** 11
1950
1951**参数:**
1952
1953| 名称 | 描述 |
1954| -------- | -------- |
1955| OH_Drawing_Canvas | 指向画布对象的指针。 |
1956| degrees | 旋转角度。 |
1957| px | 旋转中心的横坐标。 |
1958| py | 旋转中心的纵坐标。 |
1959
1960
1961### OH_Drawing_CanvasSave()
1962
1963```
1964void OH_Drawing_CanvasSave (OH_Drawing_Canvas * )
1965```
1966
1967**描述**
1968
1969用于保存当前画布的状态(画布矩阵)到一个栈顶。
1970
1971**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1972
1973**起始版本:** 8
1974
1975**参数:**
1976
1977| 名称 | 描述 |
1978| -------- | -------- |
1979| OH_Drawing_Canvas | 指向画布对象的指针。 |
1980
1981
1982### OH_Drawing_CanvasScale()
1983
1984```
1985void OH_Drawing_CanvasScale (OH_Drawing_Canvas * , float sx, float sy )
1986```
1987
1988**描述**
1989
1990用于画布缩放。
1991
1992**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1993
1994**起始版本:** 11
1995
1996**参数:**
1997
1998| 名称 | 描述 |
1999| -------- | -------- |
2000| OH_Drawing_Canvas | 指向画布对象的指针。 |
2001| sx | 水平方向缩放的比例。 |
2002| sy | 垂直方向缩放的比例。 |
2003
2004
2005### OH_Drawing_CanvasTranslate()
2006
2007```
2008void OH_Drawing_CanvasTranslate (OH_Drawing_Canvas * , float dx, float dy )
2009```
2010
2011**描述**
2012
2013用于平移画布一段距离。
2014
2015**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2016
2017**起始版本:** 11
2018
2019**参数:**
2020
2021| 名称 | 描述 |
2022| -------- | -------- |
2023| OH_Drawing_Canvas | 指向画布对象的指针。 |
2024| dx | 水平方向移动的距离。 |
2025| dy | 垂直方向移动的距离。 |
2026
2027
2028### OH_Drawing_ColorFilterCreateBlendMode()
2029
2030```
2031OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode (uint32_t color, OH_Drawing_BlendMode  )
2032```
2033
2034**描述**
2035
2036创建具有混合模式的颜色滤波器。
2037
2038**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2039
2040**起始版本:** 11
2041
2042**参数:**
2043
2044| 名称 | 描述 |
2045| -------- | -------- |
2046| color | 表示颜色,是一个32位(ARGB)变量。 |
2047| OH_Drawing_BlendMode | 表示混合模式。支持可选的混合模式具体可见[OH_Drawing_BlendMode](#oh_drawing_blendmode)枚举。 |
2048
2049**返回:**
2050
2051返回创建的颜色滤波器对象的指针。
2052
2053
2054### OH_Drawing_ColorFilterCreateCompose()
2055
2056```
2057OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose (OH_Drawing_ColorFilter * colorFilter1, OH_Drawing_ColorFilter * colorFilter2 )
2058```
2059
2060**描述**
2061
2062将两个颜色滤波器合成一个新的颜色滤波器。
2063
2064**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2065
2066**起始版本:** 11
2067
2068**参数:**
2069
2070| 名称 | 描述 |
2071| -------- | -------- |
2072| OH_Drawing_ColorFilter | 指向颜色滤波器对象一的指针。 |
2073| OH_Drawing_ColorFilter | 指向颜色滤波器对象二的指针。 |
2074
2075**返回:**
2076
2077返回创建的颜色滤波器对象的指针。
2078
2079
2080### OH_Drawing_ColorFilterCreateLinearToSrgbGamma()
2081
2082```
2083OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma (void )
2084```
2085
2086**描述**
2087
2088创建一个颜色滤波器将SRGB的伽玛曲线应用到RGB颜色通道。
2089
2090**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2091
2092**起始版本:** 11
2093
2094**返回:**
2095
2096返回创建的颜色滤波器对象的指针。
2097
2098
2099### OH_Drawing_ColorFilterCreateLuma()
2100
2101```
2102OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma (void )
2103```
2104
2105**描述**
2106
2107创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。
2108
2109**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2110
2111**起始版本:** 11
2112
2113**返回:**
2114
2115返回创建的颜色滤波器对象的指针。
2116
2117
2118### OH_Drawing_ColorFilterCreateMatrix()
2119
2120```
2121OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix (const float matrix[20])
2122```
2123
2124**描述**
2125
2126创建具有5x4颜色矩阵的颜色滤波器。
2127
2128**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2129
2130**起始版本:** 11
2131
2132**参数:**
2133
2134| 名称 | 描述 |
2135| -------- | -------- |
2136| matrix | 表示矩阵,以长度为20的浮点数组表示。 |
2137
2138**返回:**
2139
2140返回创建的颜色滤波器对象的指针。
2141
2142
2143### OH_Drawing_ColorFilterCreateSrgbGammaToLinear()
2144
2145```
2146OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear (void )
2147```
2148
2149**描述**
2150
2151创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。
2152
2153**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2154
2155**起始版本:** 11
2156
2157**返回:**
2158
2159返回创建的颜色滤波器对象的指针。
2160
2161
2162### OH_Drawing_ColorFilterDestroy()
2163
2164```
2165void OH_Drawing_ColorFilterDestroy (OH_Drawing_ColorFilter * )
2166```
2167
2168**描述**
2169
2170销毁颜色滤波器对象,并收回该对象占用的内存。
2171
2172**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2173
2174**起始版本:** 11
2175
2176**参数:**
2177
2178| 名称 | 描述 |
2179| -------- | -------- |
2180| OH_Drawing_ColorFilter | 表示指向颜色滤波器对象的指针。 |
2181
2182
2183### OH_Drawing_ColorSetArgb()
2184
2185```
2186uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue )
2187```
2188
2189**描述**
2190
2191用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。
2192
2193**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2194
2195**起始版本:** 8
2196
2197**参数:**
2198
2199| 名称 | 描述 |
2200| -------- | -------- |
2201| alpha | 描述透明度的变量, 变量范围是0x00~0xFF。 |
2202| red | 描述红色的变量, 变量范围是0x00~0xFF。 |
2203| green | 描述绿色的变量, 变量范围是0x00~0xFF。 |
2204| blue | 描述蓝色的变量, 变量范围是0x00~0xFF。 |
2205
2206**返回:**
2207
2208函数返回一个描述颜色的32位(ARGB)变量。
2209
2210
2211### OH_Drawing_CreateFontCollection()
2212
2213```
2214OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void )
2215```
2216
2217**描述**
2218
2219创建字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。
2220
2221**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2222
2223**起始版本:** 8
2224
2225**返回:**
2226
2227指向创建的字体集对象的指针。
2228
2229
2230### OH_Drawing_CreateTextStyle()
2231
2232```
2233OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void )
2234```
2235
2236**描述**
2237
2238创建指向OH_Drawing_TextStyle对象的指针。
2239
2240**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2241
2242**起始版本:** 8
2243
2244**返回:**
2245
2246指向创建的OH_Drawing_TextStyle对象的指针。
2247
2248
2249### OH_Drawing_CreateTypography()
2250
2251```
2252OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate * )
2253```
2254
2255**描述**
2256
2257创建指向OH_Drawing_Typography对象的指针。
2258
2259**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2260
2261**起始版本:** 8
2262
2263**参数:**
2264
2265| 名称 | 描述 |
2266| -------- | -------- |
2267| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
2268
2269**返回:**
2270
2271指向OH_Drawing_Typography对象的指针。
2272
2273
2274### OH_Drawing_CreateTypographyHandler()
2275
2276```
2277OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle * , OH_Drawing_FontCollection *  )
2278```
2279
2280**描述**
2281
2282创建指向OH_Drawing_TypographyCreate对象的指针。
2283
2284**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2285
2286**起始版本:** 8
2287
2288**参数:**
2289
2290| 名称 | 描述 |
2291| -------- | -------- |
2292| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
2293| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection的指针,由[OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection)获取。 |
2294
2295**返回:**
2296
2297指向新创建的OH_Drawing_TypographyCreate对象的指针。
2298
2299
2300### OH_Drawing_CreateTypographyStyle()
2301
2302```
2303OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void )
2304```
2305
2306**描述**
2307
2308创建指向OH_Drawing_TypographyStyle对象的指针。
2309
2310**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2311
2312**起始版本:** 8
2313
2314**返回:**
2315
2316指向创建的OH_Drawing_TypographyStyle对象的指针。
2317
2318
2319### OH_Drawing_DestroyFontCollection()
2320
2321```
2322void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection * )
2323```
2324
2325**描述**
2326
2327释放被字体集对象占据的内存。
2328
2329**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2330
2331**起始版本:** 8
2332
2333**参数:**
2334
2335| 名称 | 描述 |
2336| -------- | -------- |
2337| OH_Drawing_FontCollection | 指向字体集对象的指针。 |
2338
2339
2340### OH_Drawing_DestroyTextStyle()
2341
2342```
2343void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle * )
2344```
2345
2346**描述**
2347
2348释放被OH_Drawing_TextStyle对象占据的内存。
2349
2350**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2351
2352**起始版本:** 8
2353
2354**参数:**
2355
2356| 名称 | 描述 |
2357| -------- | -------- |
2358| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
2359
2360
2361### OH_Drawing_DestroyTypography()
2362
2363```
2364void OH_Drawing_DestroyTypography (OH_Drawing_Typography * )
2365```
2366
2367**描述**
2368
2369释放OH_Drawing_Typography对象占据的内存。
2370
2371**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2372
2373**起始版本:** 8
2374
2375**参数:**
2376
2377| 名称 | 描述 |
2378| -------- | -------- |
2379| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
2380
2381
2382### OH_Drawing_DestroyTypographyHandler()
2383
2384```
2385void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate * )
2386```
2387
2388**描述**
2389
2390释放被OH_Drawing_TypographyCreate对象占据的内存。
2391
2392**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2393
2394**起始版本:** 8
2395
2396**参数:**
2397
2398| 名称 | 描述 |
2399| -------- | -------- |
2400| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
2401
2402
2403### OH_Drawing_DestroyTypographyStyle()
2404
2405```
2406void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle * )
2407```
2408
2409**描述**
2410
2411释放被OH_Drawing_TypographyStyle对象占据的内存。
2412
2413**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2414
2415**起始版本:** 8
2416
2417**参数:**
2418
2419| 名称 | 描述 |
2420| -------- | -------- |
2421| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
2422
2423
2424### OH_Drawing_FilterCreate()
2425
2426```
2427OH_Drawing_Filter* OH_Drawing_FilterCreate (void )
2428```
2429
2430**描述**
2431
2432创建一个滤波器对象。
2433
2434**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2435
2436**起始版本:** 11
2437
2438**返回:**
2439
2440返回创建的滤波器对象的指针。
2441
2442
2443### OH_Drawing_FilterDestroy()
2444
2445```
2446void OH_Drawing_FilterDestroy (OH_Drawing_Filter * )
2447```
2448
2449**描述**
2450
2451销毁滤波器对象,并收回该对象占用的内存。
2452
2453**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2454
2455**起始版本:** 11
2456
2457**参数:**
2458
2459| 名称 | 描述 |
2460| -------- | -------- |
2461| OH_Drawing_Filter | 指示指向滤波器对象的指针。 |
2462
2463
2464### OH_Drawing_FilterSetColorFilter()
2465
2466```
2467void OH_Drawing_FilterSetColorFilter (OH_Drawing_Filter * , OH_Drawing_ColorFilter *  )
2468```
2469
2470**描述**
2471
2472为滤波器对象设置颜色滤波器对象。
2473
2474**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2475
2476**起始版本:** 11
2477
2478**参数:**
2479
2480| 名称 | 描述 |
2481| -------- | -------- |
2482| OH_Drawing_Filter | 指示指向滤波器对象的指针。 |
2483| OH_Drawing_ColorFilter | 指示指向颜色滤波器对象的指针。 |
2484
2485
2486### OH_Drawing_FilterSetMaskFilter()
2487
2488```
2489void OH_Drawing_FilterSetMaskFilter (OH_Drawing_Filter * , OH_Drawing_MaskFilter *  )
2490```
2491
2492**描述**
2493
2494为滤波器对象设置蒙板滤波器对象。
2495
2496**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2497
2498**起始版本:** 11
2499
2500**参数:**
2501
2502| 名称 | 描述 |
2503| -------- | -------- |
2504| OH_Drawing_Filter | 指示指向滤波器对象的指针。 |
2505| OH_Drawing_MaskFilter | 指示指向模板滤波器对象的指针。 |
2506
2507
2508### OH_Drawing_FontCreate()
2509
2510```
2511OH_Drawing_Font* OH_Drawing_FontCreate (void )
2512```
2513
2514**描述**
2515
2516用于创建一个字体对象。
2517
2518**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2519
2520**起始版本:** 11
2521
2522**返回:**
2523
2524函数会返回一个指针,指针指向创建的字体对象。
2525
2526
2527### OH_Drawing_FontDestroy()
2528
2529```
2530void OH_Drawing_FontDestroy (OH_Drawing_Font * )
2531```
2532
2533**描述**
2534
2535用于销毁字体对象并回收该对象占有的内存。
2536
2537**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2538
2539**起始版本:** 11
2540
2541**参数:**
2542
2543| 名称 | 描述 |
2544| -------- | -------- |
2545| OH_Drawing_Font | 指向字体对象的指针。 |
2546
2547
2548### OH_Drawing_FontSetFakeBoldText()
2549
2550```
2551void OH_Drawing_FontSetFakeBoldText (OH_Drawing_Font * , bool isFakeBoldText )
2552```
2553
2554**描述**
2555
2556用于设置增加描边宽度以近似粗体字体效果。
2557
2558**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2559
2560**起始版本:** 11
2561
2562**参数:**
2563
2564| 名称 | 描述 |
2565| -------- | -------- |
2566| OH_Drawing_Font | 指向字体对象的指针。 |
2567| isFakeBoldText | 参数真为使能增加描边宽度,参数假为不使能。 |
2568
2569
2570### OH_Drawing_FontSetLinearText()
2571
2572```
2573void OH_Drawing_FontSetLinearText (OH_Drawing_Font * , bool isLinearText )
2574```
2575
2576**描述**
2577
2578用于设置线性可缩放字体。
2579
2580**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2581
2582**起始版本:** 11
2583
2584**参数:**
2585
2586| 名称 | 描述 |
2587| -------- | -------- |
2588| OH_Drawing_Font | 指向字体对象的指针。 |
2589| isLinearText | 参数真为使能线性可缩放字体,参数假为不使能。 |
2590
2591
2592### OH_Drawing_FontSetTextSize()
2593
2594```
2595void OH_Drawing_FontSetTextSize (OH_Drawing_Font * , float textSize )
2596```
2597
2598**描述**
2599
2600用于给字体设置文字大小。
2601
2602**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2603
2604**起始版本:** 11
2605
2606**参数:**
2607
2608| 名称 | 描述 |
2609| -------- | -------- |
2610| OH_Drawing_Font | 指向字体对象的指针。 |
2611| textSize | 字体大小。 |
2612
2613
2614### OH_Drawing_FontSetTextSkewX()
2615
2616```
2617void OH_Drawing_FontSetTextSkewX (OH_Drawing_Font * , float skewX )
2618```
2619
2620**描述**
2621
2622用于给字体设置文本倾斜。
2623
2624**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2625
2626**起始版本:** 11
2627
2628**参数:**
2629
2630| 名称 | 描述 |
2631| -------- | -------- |
2632| OH_Drawing_Font | 指向字体对象的指针。 |
2633| skewX | X轴相对于Y轴的倾斜度。 |
2634
2635
2636### OH_Drawing_FontSetTypeface()
2637
2638```
2639void OH_Drawing_FontSetTypeface (OH_Drawing_Font * , OH_Drawing_Typeface *  )
2640```
2641
2642**描述**
2643
2644用于给字体设置字形。
2645
2646**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2647
2648**起始版本:** 11
2649
2650**参数:**
2651
2652| 名称 | 描述 |
2653| -------- | -------- |
2654| OH_Drawing_Font | 指向字体对象的指针。 |
2655| OH_Drawing_Typeface | 指向字形对象的指针。 |
2656
2657
2658### OH_Drawing_GetAffinityFromPositionAndAffinity()
2659
2660```
2661int OH_Drawing_GetAffinityFromPositionAndAffinity (OH_Drawing_PositionAndAffinity * )
2662```
2663
2664**描述**
2665
2666获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本
2667
2668**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2669
2670**起始版本:** 11
2671
2672**参数:**
2673
2674| 名称 | 描述 |
2675| -------- | -------- |
2676| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针,由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或[OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。 |
2677
2678**返回:**
2679
2680返回OH_Drawing_PositionAndAffinity对象的亲和性
2681
2682
2683### OH_Drawing_GetBottomFromTextBox()
2684
2685```
2686float OH_Drawing_GetBottomFromTextBox (OH_Drawing_TextBox * , int  )
2687```
2688
2689**描述**
2690
2691获取文本框底部位置
2692
2693**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2694
2695**起始版本:** 11
2696
2697**参数:**
2698
2699| 名称 | 描述 |
2700| -------- | -------- |
2701| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或[OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
2702| int | 文本框的索引 |
2703
2704**返回:**
2705
2706返回文本框底部位置
2707
2708
2709### OH_Drawing_GetEndFromRange()
2710
2711```
2712size_t OH_Drawing_GetEndFromRange (OH_Drawing_Range * )
2713```
2714
2715**描述**
2716
2717获取OH_Drawing_Range对象结束位置。
2718
2719**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2720
2721**起始版本:** 11
2722
2723**参数:**
2724
2725| 名称 | 描述 |
2726| -------- | -------- |
2727| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 |
2728
2729**返回:**
2730
2731返回OH_Drawing_Range对象结束位置
2732
2733
2734### OH_Drawing_GetLeftFromTextBox()
2735
2736```
2737float OH_Drawing_GetLeftFromTextBox (OH_Drawing_TextBox * , int  )
2738```
2739
2740**描述**
2741
2742获取文本框左侧位置
2743
2744**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2745
2746**起始版本:** 11
2747
2748**参数:**
2749
2750| 名称 | 描述 |
2751| -------- | -------- |
2752| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或[OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
2753| int | 文本框的索引 |
2754
2755**返回:**
2756
2757返回文本框左侧位置
2758
2759
2760### OH_Drawing_GetPositionFromPositionAndAffinity()
2761
2762```
2763size_t OH_Drawing_GetPositionFromPositionAndAffinity (OH_Drawing_PositionAndAffinity * )
2764```
2765
2766**描述**
2767
2768获取OH_Drawing_PositionAndAffinity对象的位置属性
2769
2770**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2771
2772**起始版本:** 11
2773
2774**参数:**
2775
2776| 名称 | 描述 |
2777| -------- | -------- |
2778| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针,由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或[OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。|
2779
2780**返回:**
2781
2782返回OH_Drawing_PositionAndAffinity对象的位置属性
2783
2784
2785### OH_Drawing_GetRightFromTextBox()
2786
2787```
2788float OH_Drawing_GetRightFromTextBox (OH_Drawing_TextBox * , int  )
2789```
2790
2791**描述**
2792
2793获取文本框右侧位置
2794
2795**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2796
2797**起始版本:** 11
2798
2799**参数:**
2800
2801| 名称 | 描述 |
2802| -------- | -------- |
2803| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或[OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
2804| int | 文本框的索引 |
2805
2806**返回:**
2807
2808返回文本框右侧位置
2809
2810
2811### OH_Drawing_GetSizeOfTextBox()
2812
2813```
2814size_t OH_Drawing_GetSizeOfTextBox (OH_Drawing_TextBox * )
2815```
2816
2817**描述**
2818
2819获取文本框数量大小
2820
2821**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2822
2823**起始版本:** 11
2824
2825**参数:**
2826
2827| 名称 | 描述 |
2828| -------- | -------- |
2829| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或[OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。|
2830
2831**返回:**
2832
2833返回文本框数量大小
2834
2835
2836### OH_Drawing_GetStartFromRange()
2837
2838```
2839size_t OH_Drawing_GetStartFromRange (OH_Drawing_Range * )
2840```
2841
2842**描述**
2843
2844获取OH_Drawing_Range对象开始位置。
2845
2846**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2847
2848**起始版本:** 11
2849
2850**参数:**
2851
2852| 名称 | 描述 |
2853| -------- | -------- |
2854| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 |
2855
2856**返回:**
2857
2858返回OH_Drawing_Range对象开始位置
2859
2860
2861### OH_Drawing_GetTextDirectionFromTextBox()
2862
2863```
2864int OH_Drawing_GetTextDirectionFromTextBox (OH_Drawing_TextBox * , int  )
2865```
2866
2867**描述**
2868
2869获取文本框方向
2870
2871**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2872
2873**起始版本:** 11
2874
2875**参数:**
2876
2877| 名称 | 描述 |
2878| -------- | -------- |
2879| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或[OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 |
2880| int | 文本框的索引 |
2881
2882**返回:**
2883
2884返回文本框方向
2885
2886
2887### OH_Drawing_GetTopFromTextBox()
2888
2889```
2890float OH_Drawing_GetTopFromTextBox (OH_Drawing_TextBox * , int  )
2891```
2892
2893**描述**
2894
2895获取文本框顶部位置
2896
2897**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2898
2899**起始版本:** 11
2900
2901**参数:**
2902
2903| 名称 | 描述 |
2904| -------- | -------- |
2905| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或[OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。|
2906| int | 文本框的索引 |
2907
2908**返回:**
2909
2910返回文本框顶部位置
2911
2912
2913### OH_Drawing_MaskFilterCreateBlur()
2914
2915```
2916OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur (OH_Drawing_BlurType blurType, float sigma, bool respectCTM )
2917```
2918
2919**描述**
2920
2921创建具有模糊效果的模板滤波器。
2922
2923**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2924
2925**起始版本:** 11
2926
2927**参数:**
2928
2929| 名称 | 描述 |
2930| -------- | -------- |
2931| blurType | 表示模糊类型。 |
2932| sigma | 表示要应用的高斯模糊的标准偏差。必须大于0。 |
2933| respectCTM | 表示模糊标准差值被CTM修改,默认为真。 |
2934
2935**返回:**
2936
2937返回创建的模板滤波器对象的指针。
2938
2939
2940### OH_Drawing_MaskFilterDestroy()
2941
2942```
2943void OH_Drawing_MaskFilterDestroy (OH_Drawing_MaskFilter * )
2944```
2945
2946**描述**
2947
2948销毁模板滤波器对象,并收回该对象占用的内存。
2949
2950**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2951
2952**起始版本:** 11
2953
2954**参数:**
2955
2956| 名称 | 描述 |
2957| -------- | -------- |
2958| OH_Drawing_MaskFilter | 表示指向模板滤波器对象的指针。 |
2959
2960
2961### OH_Drawing_MatrixCreate()
2962
2963```
2964OH_Drawing_Matrix* OH_Drawing_MatrixCreate (void )
2965```
2966
2967**描述**
2968
2969用于创建一个矩阵对象。
2970
2971**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2972
2973**起始版本:** 11
2974
2975**返回:**
2976
2977函数会返回一个指针,指针指向创建的矩阵对象。
2978
2979
2980### OH_Drawing_MatrixDestroy()
2981
2982```
2983void OH_Drawing_MatrixDestroy (OH_Drawing_Matrix * )
2984```
2985
2986**描述**
2987
2988用于销毁矩阵对象并回收该对象占有的内存。
2989
2990**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
2991
2992**起始版本:** 11
2993
2994**参数:**
2995
2996| 名称 | 描述 |
2997| -------- | -------- |
2998| OH_Drawing_Matrix | 指向字体对象的指针。 |
2999
3000
3001### OH_Drawing_MatrixSetMatrix()
3002
3003```
3004void OH_Drawing_MatrixSetMatrix (OH_Drawing_Matrix * , float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2 )
3005```
3006
3007**描述**
3008
3009用于给矩阵对象设置参数。
3010
3011**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3012
3013**起始版本:** 11
3014
3015**参数:**
3016
3017| 名称 | 描述 |
3018| -------- | -------- |
3019| OH_Drawing_Matrix | 指向矩阵对象的指针。 |
3020| scaleX | 水平缩放系数。 |
3021| skewX | 水平倾斜系数。 |
3022| transX | 水平位移系数。 |
3023| skewY | 垂直倾斜系数。 |
3024| scaleY | 垂直缩放系数。 |
3025| transY | 垂直位移系数。 |
3026| persp0 | X轴透视系数。 |
3027| persp1 | Y轴透视系数。 |
3028| persp2 | 透视缩放系数。 |
3029
3030
3031### OH_Drawing_PathArcTo()
3032
3033```
3034void OH_Drawing_PathArcTo (OH_Drawing_Path * , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg )
3035```
3036
3037**描述**
3038
3039用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。
3040
3041**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3042
3043**起始版本:** 8
3044
3045**参数:**
3046
3047| 名称 | 描述 |
3048| -------- | -------- |
3049| OH_Drawing_Path | 指向路径对象的指针。 |
3050| x1 | 包围椭圆的矩形左上角点位置的横坐标。 |
3051| y1 | 包围椭圆的矩形左上角点位置的纵坐标。 |
3052| x2 | 包围椭圆的矩形右下角点位置的横坐标。 |
3053| y2 | 包围椭圆的矩形右下角点位置的纵坐标。 |
3054| startDeg | 起始的角度。 |
3055| sweepDeg | 扫描的度数。 |
3056
3057
3058### OH_Drawing_PathClose()
3059
3060```
3061void OH_Drawing_PathClose (OH_Drawing_Path * )
3062```
3063
3064**描述**
3065
3066用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。
3067
3068**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3069
3070**起始版本:** 8
3071
3072**参数:**
3073
3074| 名称 | 描述 |
3075| -------- | -------- |
3076| OH_Drawing_Path | 指向路径对象的指针。 |
3077
3078
3079### OH_Drawing_PathCreate()
3080
3081```
3082OH_Drawing_Path* OH_Drawing_PathCreate (void )
3083```
3084
3085**描述**
3086
3087用于创建一个路径对象。
3088
3089**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3090
3091**起始版本:** 8
3092
3093**返回:**
3094
3095函数会返回一个指针,指针指向创建的路径对象。
3096
3097
3098### OH_Drawing_PathCubicTo()
3099
3100```
3101void OH_Drawing_PathCubicTo (OH_Drawing_Path * , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
3102```
3103
3104**描述**
3105
3106用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线。
3107
3108**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3109
3110**起始版本:** 8
3111
3112**参数:**
3113
3114| 名称 | 描述 |
3115| -------- | -------- |
3116| OH_Drawing_Path | 指向路径对象的指针。 |
3117| ctrlX1 | 第一个控制点位置的横坐标。 |
3118| ctrlY1 | 第一个控制点位置的纵坐标。 |
3119| ctrlX2 | 第二个控制点位置的横坐标。 |
3120| ctrlY2 | 第二个控制点位置的纵坐标。 |
3121| endX | 目标点位置的横坐标。 |
3122| endY | 目标点位置的纵坐标。 |
3123
3124
3125### OH_Drawing_PathDestroy()
3126
3127```
3128void OH_Drawing_PathDestroy (OH_Drawing_Path * )
3129```
3130
3131**描述**
3132
3133用于销毁路径对象并回收该对象占有的内存。
3134
3135**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3136
3137**起始版本:** 8
3138
3139**参数:**
3140
3141| 名称 | 描述 |
3142| -------- | -------- |
3143| OH_Drawing_Path | 指向路径对象的指针。 |
3144
3145
3146### OH_Drawing_PathLineTo()
3147
3148```
3149void OH_Drawing_PathLineTo (OH_Drawing_Path * , float x, float y )
3150```
3151
3152**描述**
3153
3154用于添加一条从路径的最后点位置到目标点位置的线段。
3155
3156**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3157
3158**起始版本:** 8
3159
3160**参数:**
3161
3162| 名称 | 描述 |
3163| -------- | -------- |
3164| OH_Drawing_Path | 指向路径对象的指针。 |
3165| x | 目标点的横坐标。 |
3166| y | 目标点的纵坐标。 |
3167
3168
3169### OH_Drawing_PathMoveTo()
3170
3171```
3172void OH_Drawing_PathMoveTo (OH_Drawing_Path * , float x, float y )
3173```
3174
3175**描述**
3176
3177用于设置自定义路径的起始点位置。
3178
3179**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3180
3181**起始版本:** 8
3182
3183**参数:**
3184
3185| 名称 | 描述 |
3186| -------- | -------- |
3187| OH_Drawing_Path | 指向路径对象的指针。 |
3188| x | 起始点的横坐标。 |
3189| y | 起始点的纵坐标。 |
3190
3191
3192### OH_Drawing_PathQuadTo()
3193
3194```
3195void OH_Drawing_PathQuadTo (OH_Drawing_Path * , float ctrlX, float ctrlY, float endX, float endY )
3196```
3197
3198**描述**
3199
3200用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线。
3201
3202**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3203
3204**起始版本:** 8
3205
3206**参数:**
3207
3208| 名称 | 描述 |
3209| -------- | -------- |
3210| OH_Drawing_Path | 指向路径对象的指针。 |
3211| ctrlX | 控制点位置的横坐标。 |
3212| ctrlY | 控制点位置的纵坐标。 |
3213| endX | 目标点位置的横坐标。 |
3214| endY | 目标点位置的纵坐标。 |
3215
3216
3217### OH_Drawing_PathReset()
3218
3219```
3220void OH_Drawing_PathReset (OH_Drawing_Path * )
3221```
3222
3223**描述**
3224
3225用于重置自定义路径数据。
3226
3227**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3228
3229**起始版本:** 8
3230
3231**参数:**
3232
3233| 名称 | 描述 |
3234| -------- | -------- |
3235| OH_Drawing_Path | 指向路径对象的指针。 |
3236
3237
3238### OH_Drawing_PenCreate()
3239
3240```
3241OH_Drawing_Pen* OH_Drawing_PenCreate (void )
3242```
3243
3244**描述**
3245
3246用于创建一个画笔对象。
3247
3248**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3249
3250**起始版本:** 8
3251
3252**返回:**
3253
3254函数会返回一个指针,指针指向创建的画笔对象。
3255
3256
3257### OH_Drawing_PenDestroy()
3258
3259```
3260void OH_Drawing_PenDestroy (OH_Drawing_Pen * )
3261```
3262
3263**描述**
3264
3265用于销毁画笔对象并回收该对象占有的内存。
3266
3267**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3268
3269**起始版本:** 8
3270
3271**参数:**
3272
3273| 名称 | 描述 |
3274| -------- | -------- |
3275| OH_Drawing_Pen | 指向画笔对象的指针。 |
3276
3277
3278### OH_Drawing_PenGetAlpha()
3279
3280```
3281uint8_t OH_Drawing_PenGetAlpha (const OH_Drawing_Pen * )
3282```
3283
3284**描述**
3285
3286获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。
3287
3288**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3289
3290**起始版本:** 11
3291
3292**参数:**
3293
3294| 名称 | 描述 |
3295| -------- | -------- |
3296| OH_Drawing_Pen | 表示指向画笔对象的指针。 |
3297
3298**返回:**
3299
3300返回一个8比特的值表示透明度。
3301
3302
3303### OH_Drawing_PenGetCap()
3304
3305```
3306OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen * )
3307```
3308
3309**描述**
3310
3311用于获取画笔笔帽的样式。
3312
3313**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3314
3315**起始版本:** 8
3316
3317**参数:**
3318
3319| 名称 | 描述 |
3320| -------- | -------- |
3321| OH_Drawing_Pen | 指向画笔对象的指针。 |
3322
3323**返回:**
3324
3325函数返回画笔笔帽样式。
3326
3327
3328### OH_Drawing_PenGetColor()
3329
3330```
3331uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen * )
3332```
3333
3334**描述**
3335
3336用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。
3337
3338**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3339
3340**起始版本:** 8
3341
3342**参数:**
3343
3344| 名称 | 描述 |
3345| -------- | -------- |
3346| OH_Drawing_Pen | 指向画笔对象的指针。 |
3347
3348**返回:**
3349
3350函数返回一个描述颜色的32位(ARGB)变量。
3351
3352
3353### OH_Drawing_PenGetJoin()
3354
3355```
3356OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen * )
3357```
3358
3359**描述**
3360
3361用于获取画笔绘制折线转角的样式。
3362
3363**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3364
3365**起始版本:** 8
3366
3367**参数:**
3368
3369| 名称 | 描述 |
3370| -------- | -------- |
3371| OH_Drawing_Pen | 指向画笔对象的指针。 |
3372
3373**返回:**
3374
3375函数返回折线转角的样式。
3376
3377
3378### OH_Drawing_PenGetMiterLimit()
3379
3380```
3381float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen * )
3382```
3383
3384**描述**
3385
3386用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。
3387
3388**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3389
3390**起始版本:** 8
3391
3392**参数:**
3393
3394| 名称 | 描述 |
3395| -------- | -------- |
3396| OH_Drawing_Pen | 指向画笔对象的指针。 |
3397
3398**返回:**
3399
3400函数返回尖角的限制值。
3401
3402
3403### OH_Drawing_PenGetWidth()
3404
3405```
3406float OH_Drawing_PenGetWidth (const OH_Drawing_Pen * )
3407```
3408
3409**描述**
3410
3411用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。
3412
3413**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3414
3415**起始版本:** 8
3416
3417**参数:**
3418
3419| 名称 | 描述 |
3420| -------- | -------- |
3421| OH_Drawing_Pen | 指向画笔对象的指针。 |
3422
3423**返回:**
3424
3425函数返回画笔的厚度。
3426
3427
3428### OH_Drawing_PenIsAntiAlias()
3429
3430```
3431bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen * )
3432```
3433
3434**描述**
3435
3436用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
3437
3438**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3439
3440**起始版本:** 8
3441
3442**参数:**
3443
3444| 名称 | 描述 |
3445| -------- | -------- |
3446| OH_Drawing_Pen | 指向画笔对象的指针。 |
3447
3448**返回:**
3449
3450函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。
3451
3452
3453### OH_Drawing_PenSetAlpha()
3454
3455```
3456void OH_Drawing_PenSetAlpha (OH_Drawing_Pen * , uint8_t alpha )
3457```
3458
3459**描述**
3460
3461为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。
3462
3463**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3464
3465**起始版本:** 11
3466
3467**参数:**
3468
3469| 名称 | 描述 |
3470| -------- | -------- |
3471| OH_Drawing_Pen | 表示指向画笔对象的指针。 |
3472| alpha | 表示要设置的透明度值,是一个8比特的变量。 |
3473
3474
3475### OH_Drawing_PenSetAntiAlias()
3476
3477```
3478void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen * , bool  )
3479```
3480
3481**描述**
3482
3483用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。
3484
3485**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3486
3487**起始版本:** 8
3488
3489**参数:**
3490
3491| 名称 | 描述 |
3492| -------- | -------- |
3493| OH_Drawing_Pen | 指向画笔对象的指针。 |
3494| bool | 参数真为抗锯齿,参数假则不做抗锯齿处理。 |
3495
3496
3497### OH_Drawing_PenSetCap()
3498
3499```
3500void OH_Drawing_PenSetCap (OH_Drawing_Pen * , OH_Drawing_PenLineCapStyle  )
3501```
3502
3503**描述**
3504
3505用于设置画笔笔帽样式。
3506
3507**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3508
3509**起始版本:** 8
3510
3511**参数:**
3512
3513| 名称 | 描述 |
3514| -------- | -------- |
3515| OH_Drawing_Pen | 指向画笔对象的指针。 |
3516| OH_Drawing_PenLineCapStyle | 描述画笔笔帽样式的变量。 |
3517
3518
3519### OH_Drawing_PenSetColor()
3520
3521```
3522void OH_Drawing_PenSetColor (OH_Drawing_Pen * , uint32_t color )
3523```
3524
3525**描述**
3526
3527用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。
3528
3529**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3530
3531**起始版本:** 8
3532
3533**参数:**
3534
3535| 名称 | 描述 |
3536| -------- | -------- |
3537| OH_Drawing_Pen | 指向画笔对象的指针。 |
3538| color | 描述颜色的32位(ARGB)变量。 |
3539
3540### OH_Drawing_PenSetFilter()
3541
3542```
3543void OH_Drawing_PenSetFilter (OH_Drawing_Pen* , OH_Drawing_Filter*  )
3544```
3545
3546**描述**
3547
3548设置画笔滤波器。
3549
3550**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3551
3552**起始版本:** 11
3553
3554**参数:**
3555
3556| 名称 | 描述 |
3557| -------- | -------- |
3558| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
3559| OH_Drawing_Filter | 指向滤波器[OH_Drawing_Filter](#oh_drawing_filter)的指针,为空表示清空画笔滤波器。 |
3560
3561
3562### OH_Drawing_PenSetJoin()
3563
3564```
3565void OH_Drawing_PenSetJoin (OH_Drawing_Pen * , OH_Drawing_PenLineJoinStyle  )
3566```
3567
3568**描述**
3569
3570用于设置画笔绘制转角的样式。
3571
3572**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3573
3574**起始版本:** 8
3575
3576**参数:**
3577
3578| 名称 | 描述 |
3579| -------- | -------- |
3580| OH_Drawing_Pen | 指向画笔对象的指针。 |
3581| OH_Drawing_PenLineJoinStyle | 描述折线转角样式的变量。 |
3582
3583
3584### OH_Drawing_PenSetMiterLimit()
3585
3586```
3587void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen * , float miter )
3588```
3589
3590**描述**
3591
3592用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。
3593
3594**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3595
3596**起始版本:** 8
3597
3598**参数:**
3599
3600| 名称 | 描述 |
3601| -------- | -------- |
3602| OH_Drawing_Pen | 指向画笔对象的指针。 |
3603| miter | 描述尖角限制值的变量。 |
3604
3605### OH_Drawing_PenSetShaderEffect()
3606
3607```
3608void OH_Drawing_PenSetShaderEffect (OH_Drawing_Pen* , OH_Drawing_ShaderEffect*  )
3609```
3610
3611**描述**
3612
3613设置画笔着色器效果。
3614
3615**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3616
3617**起始版本:** 11
3618
3619**参数:**
3620
3621| 名称 | 描述 |
3622| -------- | -------- |
3623| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 |
3624| OH_Drawing_ShaderEffect | 指向着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)的指针。 |
3625
3626### OH_Drawing_PenSetWidth()
3627
3628```
3629void OH_Drawing_PenSetWidth (OH_Drawing_Pen * , float width )
3630```
3631
3632**描述**
3633
3634用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。
3635
3636**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3637
3638**起始版本:** 8
3639
3640**参数:**
3641
3642| 名称 | 描述 |
3643| -------- | -------- |
3644| OH_Drawing_Pen | 指向画笔对象的指针。 |
3645| width | 描述画笔厚度的变量。 |
3646
3647
3648### OH_Drawing_PointCreate()
3649
3650```
3651OH_Drawing_Point* OH_Drawing_PointCreate (float x, float y )
3652```
3653
3654**描述**
3655
3656用于创建一个坐标点对象。
3657
3658**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3659
3660**起始版本:** 11
3661
3662**参数:**
3663
3664| 名称 | 描述 |
3665| -------- | -------- |
3666| x | X轴坐标。 |
3667| y | Y轴坐标。 |
3668
3669**返回:**
3670
3671函数会返回一个指针,指针指向创建的坐标点对象。
3672
3673
3674### OH_Drawing_PointDestroy()
3675
3676```
3677void OH_Drawing_PointDestroy (OH_Drawing_Point * )
3678```
3679
3680**描述**
3681
3682用于销毁坐标点对象并回收该对象占有的内存。
3683
3684**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3685
3686**起始版本:** 11
3687
3688**参数:**
3689
3690| 名称 | 描述 |
3691| -------- | -------- |
3692| OH_Drawing_Point | 指向坐标点对象的指针。 |
3693
3694
3695### OH_Drawing_RectCreate()
3696
3697```
3698OH_Drawing_Rect* OH_Drawing_RectCreate (float left, float top, float right, float bottom )
3699```
3700
3701**描述**
3702
3703用于创建一个矩形对象。
3704
3705**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3706
3707**起始版本:** 11
3708
3709**参数:**
3710
3711| 名称 | 描述 |
3712| -------- | -------- |
3713| left | 矩形左上角的横坐标。 |
3714| top | 矩形左上角的纵坐标。 |
3715| right | 矩形右下角的横坐标。 |
3716| bottom | 矩形右下角的纵坐标。 |
3717
3718**返回:**
3719
3720函数会返回一个指针,指针指向创建的矩形对象。
3721
3722
3723### OH_Drawing_RectDestroy()
3724
3725```
3726void OH_Drawing_RectDestroy (OH_Drawing_Rect * )
3727```
3728
3729**描述**
3730
3731用于销毁矩形对象并回收该对象占有的内存。
3732
3733**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3734
3735**起始版本:** 11
3736
3737**参数:**
3738
3739| 名称 | 描述 |
3740| -------- | -------- |
3741| OH_Drawing_Rect | 指向矩形对象的指针。 |
3742
3743
3744### OH_Drawing_RoundRectCreate()
3745
3746```
3747OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate (const OH_Drawing_Rect * , float xRad, float yRad )
3748```
3749
3750**描述**
3751
3752用于创建一个圆角矩形对象。
3753
3754**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3755
3756**起始版本:** 11
3757
3758**参数:**
3759
3760| 名称 | 描述 |
3761| -------- | -------- |
3762| OH_Drawing_Rect | 指向矩形对象的指针。 |
3763| xRad | X轴上的圆角半径。 |
3764| yRad | Y轴上的圆角半径。 |
3765
3766**返回:**
3767
3768函数会返回一个指针,指针指向创建的圆角矩形对象。
3769
3770
3771### OH_Drawing_RoundRectDestroy()
3772
3773```
3774void OH_Drawing_RoundRectDestroy (OH_Drawing_RoundRect * )
3775```
3776
3777**描述**
3778
3779用于销毁圆角矩形对象并回收该对象占有的内存。
3780
3781**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3782
3783**起始版本:** 11
3784
3785**参数:**
3786
3787| 名称 | 描述 |
3788| -------- | -------- |
3789| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 |
3790
3791### OH_Drawing_RegisterFont()
3792
3793```
3794uint32_t OH_Drawing_RegisterFont (OH_Drawing_FontCollection* , const char* fontFamily, const char* familySrc )
3795```
3796
3797**描述**
3798
3799用于在字体管理器中注册自定义字体。
3800
3801**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3802
3803**起始版本:** 11
3804
3805**参数:**
3806
3807| 名称 | 描述 |
3808| -------- | -------- |
3809| OH_Drawing_FontCollection | 指向[OH_Drawing_FontCollection](#oh_drawing_fontcollection)对象的指针。 |
3810| fontFamily | 指需要注册的字体的字体名称。 |
3811| familySrc | 指需要注册的字体文件的路径。 |
3812
3813**返回:**
3814
3815返回错误代码,0为成功,1为文件不存在,2为打开文件失败,3为读取文件失败,4为寻找文件失败,5为获取大小失败。
3816
3817
3818### OH_Drawing_RegisterFontBuffer()
3819
3820```
3821uint32_t OH_Drawing_RegisterFontBuffer (OH_Drawing_FontCollection* , const char* fontFamily, uint8_t* fontBuffer, size_t length )
3822```
3823
3824**描述**
3825
3826用于在字体管理器中注册字体缓冲区。
3827
3828**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3829
3830**起始版本:** 11
3831
3832**参数:**
3833
3834| 名称 | 描述 |
3835| -------- | -------- |
3836| OH_Drawing_FontCollection | 指向[OH_Drawing_FontCollection](#oh_drawing_fontcollection)对象的指针。 |
3837| fontFamily | 指需要注册的字体的字体名称。 |
3838| fontBuffer | 指需要注册的字体文件的缓冲区。 |
3839| length | 指需要注册的字体文件的长度。 |
3840
3841**返回:**
3842
3843返回错误代码,0为成功,6为缓冲区大小为零,7为字体集合为空。
3844
3845### OH_Drawing_SetTextStyleBaseLine()
3846
3847```
3848void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle * , int  )
3849```
3850
3851**描述**
3852
3853设置字体基线位置。
3854
3855**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3856
3857**起始版本:** 8
3858
3859**参数:**
3860
3861| 名称 | 描述 |
3862| -------- | -------- |
3863| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
3864| int | 设置字体基线位置,设置1基线位于底部,设置0或其它基线在中间偏下的位置,具体可见[OH_Drawing_TextBaseline](#oh_drawing_textbaseline)枚举。 |
3865
3866
3867### OH_Drawing_SetTextStyleColor()
3868
3869```
3870void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle * , uint32_t  )
3871```
3872
3873**描述**
3874
3875设置文本颜色。
3876
3877**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3878
3879**起始版本:** 8
3880
3881**参数:**
3882
3883| 名称 | 描述 |
3884| -------- | -------- |
3885| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
3886| uint32_t | 颜色。 |
3887
3888
3889### OH_Drawing_SetTextStyleDecoration()
3890
3891```
3892void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle * , int  )
3893```
3894
3895**描述**
3896
3897设置装饰。
3898
3899**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3900
3901**起始版本:** 8
3902
3903**参数:**
3904
3905| 名称 | 描述 |
3906| -------- | -------- |
3907| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
3908| int | 设置装饰,设置1为下划线,设置2为上划线,设置3为删除线,设置0或其它为无装饰,具体可见[OH_Drawing_TextDecoration](#oh_drawing_textdecoration)枚举。 |
3909
3910
3911### OH_Drawing_SetTextStyleDecorationColor()
3912
3913```
3914void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle * , uint32_t  )
3915```
3916
3917**描述**
3918
3919设置装饰颜色。
3920
3921**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3922
3923**起始版本:** 8
3924
3925**参数:**
3926
3927| 名称 | 描述 |
3928| -------- | -------- |
3929| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
3930| uint32_t | 颜色。 |
3931
3932
3933### OH_Drawing_SetTextStyleDecorationStyle()
3934
3935```
3936void OH_Drawing_SetTextStyleDecorationStyle (OH_Drawing_TextStyle * , int  )
3937```
3938
3939**描述**
3940
3941设置文本装饰样式。
3942
3943**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3944
3945**起始版本:** 11
3946
3947**参数:**
3948
3949| 名称 | 描述 |
3950| -------- | -------- |
3951| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
3952| int | 设置的文本装饰样式,支持可选的装饰样式具体可见[OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)枚举。 |
3953
3954
3955### OH_Drawing_SetTextStyleDecorationThicknessScale()
3956
3957```
3958void OH_Drawing_SetTextStyleDecorationThicknessScale (OH_Drawing_TextStyle * , double  )
3959```
3960
3961**描述**
3962
3963设置文本装饰线的厚度缩放比例。
3964
3965**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3966
3967**起始版本:** 11
3968
3969**参数:**
3970
3971| 名称 | 描述 |
3972| -------- | -------- |
3973| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
3974| double | 缩放比例。 |
3975
3976
3977### OH_Drawing_SetTextStyleEllipsis()
3978
3979```
3980void OH_Drawing_SetTextStyleEllipsis (OH_Drawing_TextStyle * , const char *  )
3981```
3982
3983**描述**
3984
3985设置文本的省略号内容。
3986
3987**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
3988
3989**起始版本:** 11
3990
3991**参数:**
3992
3993| 名称 | 描述 |
3994| -------- | -------- |
3995| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
3996| char\* | 设置省略号内容,数据类型为指向char的指针。 |
3997
3998
3999### OH_Drawing_SetTextStyleEllipsisModal()
4000
4001```
4002void OH_Drawing_SetTextStyleEllipsisModal (OH_Drawing_TextStyle * , int  )
4003```
4004
4005**描述**
4006
4007设置文本的省略号样式。
4008
4009**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4010
4011**起始版本:** 11
4012
4013**参数:**
4014
4015| 名称 | 描述 |
4016| -------- | -------- |
4017| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4018| int | 设置省略号样式,支持可选的省略号样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 |
4019
4020
4021### OH_Drawing_SetTextStyleFontFamilies()
4022
4023```
4024void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle * , int , const char * fontFamilies[] )
4025```
4026
4027**描述**
4028
4029设置字体类型。
4030
4031**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4032
4033**起始版本:** 8
4034
4035**参数:**
4036
4037| 名称 | 描述 |
4038| -------- | -------- |
4039| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4040| int | 字体名称数量。 |
4041| char | 指向字体类型的指针。 |
4042
4043
4044### OH_Drawing_SetTextStyleFontHeight()
4045
4046```
4047void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle * , double  )
4048```
4049
4050**描述**
4051
4052设置字体高度。
4053
4054**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4055
4056**起始版本:** 8
4057
4058**参数:**
4059
4060| 名称 | 描述 |
4061| -------- | -------- |
4062| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4063| double | 字体高度。 |
4064
4065
4066### OH_Drawing_SetTextStyleFontSize()
4067
4068```
4069void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle * , double  )
4070```
4071
4072**描述**
4073
4074设置字号。
4075
4076**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4077
4078**起始版本:** 8
4079
4080**参数:**
4081
4082| 名称 | 描述 |
4083| -------- | -------- |
4084| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4085| double | 字号。 |
4086
4087
4088### OH_Drawing_SetTextStyleFontStyle()
4089
4090```
4091void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle * , int  )
4092```
4093
4094**描述**
4095
4096设置字体风格。
4097
4098**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4099
4100**起始版本:** 8
4101
4102**参数:**
4103
4104| 名称 | 描述 |
4105| -------- | -------- |
4106| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4107| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 |
4108
4109
4110### OH_Drawing_SetTextStyleFontWeight()
4111
4112```
4113void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle * , int  )
4114```
4115
4116**描述**
4117
4118设置字重。
4119
4120**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4121
4122**起始版本:** 8
4123
4124**参数:**
4125
4126| 名称 | 描述 |
4127| -------- | -------- |
4128| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4129| 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)枚举。 |
4130
4131
4132### OH_Drawing_SetTextStyleHalfLeading()
4133
4134```
4135void OH_Drawing_SetTextStyleHalfLeading (OH_Drawing_TextStyle * , bool  )
4136```
4137
4138**描述**
4139
4140设置文本为一半行间距。
4141
4142**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4143
4144**起始版本:** 11
4145
4146**参数:**
4147
4148| 名称 | 描述 |
4149| -------- | -------- |
4150| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4151| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 |
4152
4153
4154### OH_Drawing_SetTextStyleLetterSpacing()
4155
4156```
4157void OH_Drawing_SetTextStyleLetterSpacing (OH_Drawing_TextStyle * , double  )
4158```
4159
4160**描述**
4161
4162设置文本的字符间距。
4163
4164**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4165
4166**起始版本:** 11
4167
4168**参数:**
4169
4170| 名称 | 描述 |
4171| -------- | -------- |
4172| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4173| double | 间距大小。 |
4174
4175
4176### OH_Drawing_SetTextStyleLocale()
4177
4178```
4179void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle * , const char *  )
4180```
4181
4182**描述**
4183
4184设置语言区域。
4185
4186**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4187
4188**起始版本:** 8
4189
4190**参数:**
4191
4192| 名称 | 描述 |
4193| -------- | -------- |
4194| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4195| char | 语言区域,数据类型为指向char的指针。 |
4196
4197
4198### OH_Drawing_SetTextStyleWordSpacing()
4199
4200```
4201void OH_Drawing_SetTextStyleWordSpacing (OH_Drawing_TextStyle * , double  )
4202```
4203
4204**描述**
4205
4206设置文本的单词间距。
4207
4208**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4209
4210**起始版本:** 11
4211
4212**参数:**
4213
4214| 名称 | 描述 |
4215| -------- | -------- |
4216| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
4217| double | 间距大小。 |
4218
4219
4220### OH_Drawing_SetTypographyTextAlign()
4221
4222```
4223void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle * , int  )
4224```
4225
4226**描述**
4227
4228设置文本对齐方式。
4229
4230**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4231
4232**起始版本:** 8
4233
4234**参数:**
4235
4236| 名称 | 描述 |
4237| -------- | -------- |
4238| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
4239| int | 设置文本对齐方式,设置1为右对齐,设置2为居中对齐,设置3为两端对齐,设置4为与文字方向相同,设置5为文字方向相反,设置0或其它为左对齐,具体可见[OH_Drawing_TextAlign](#oh_drawing_textalign)枚举。 |
4240
4241
4242### OH_Drawing_SetTypographyTextBreakStrategy()
4243
4244```
4245void OH_Drawing_SetTypographyTextBreakStrategy (OH_Drawing_TypographyStyle * , int  )
4246```
4247
4248**描述**
4249
4250设置文本的中断策略
4251
4252**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4253
4254**起始版本:** 11
4255
4256**参数:**
4257
4258| 名称 | 描述 |
4259| -------- | -------- |
4260| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
4261| int | 设置中断策略,支持可选的中断策略具体可见[OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy)枚举。 |
4262
4263
4264### OH_Drawing_SetTypographyTextDirection()
4265
4266```
4267void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle * , int  )
4268```
4269
4270**描述**
4271
4272设置文本方向。
4273
4274**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4275
4276**起始版本:** 8
4277
4278**参数:**
4279
4280| 名称 | 描述 |
4281| -------- | -------- |
4282| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
4283| int | 设置文本方向,设置1为从左到右,设置0或其它为从右到左,具体可见[OH_Drawing_TextDirection](#oh_drawing_textdirection)枚举。 |
4284
4285
4286### OH_Drawing_SetTypographyTextEllipsisModal()
4287
4288```
4289void OH_Drawing_SetTypographyTextEllipsisModal (OH_Drawing_TypographyStyle * , int  )
4290```
4291
4292**描述**
4293
4294设置文本的省略号样式。
4295
4296**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4297
4298**起始版本:** 11
4299
4300**参数:**
4301
4302| 名称 | 描述 |
4303| -------- | -------- |
4304| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
4305| int | 设置省略号样式,支持可选的省略号样式样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 |
4306
4307
4308### OH_Drawing_SetTypographyTextMaxLines()
4309
4310```
4311void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle * , int  )
4312```
4313
4314**描述**
4315
4316设置文本最大行数。
4317
4318**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4319
4320**起始版本:** 8
4321
4322**参数:**
4323
4324| 名称 | 描述 |
4325| -------- | -------- |
4326| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
4327| int | 最大行数。 |
4328
4329
4330### OH_Drawing_SetTypographyTextWordBreakType()
4331
4332```
4333void OH_Drawing_SetTypographyTextWordBreakType (OH_Drawing_TypographyStyle * , int  )
4334```
4335
4336**描述**
4337
4338设置单词的断词方式。
4339
4340**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4341
4342**起始版本:** 11
4343
4344**参数:**
4345
4346| 名称 | 描述 |
4347| -------- | -------- |
4348| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 |
4349| int | 设置断词方式,支持可选的断词方式样式具体可见[OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype)枚举。 |
4350
4351
4352### OH_Drawing_ShaderEffectCreateLinearGradient()
4353
4354```
4355OH_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  )
4356```
4357
4358**描述**
4359
4360创建着色器,在两个指定点之间生成线性渐变。
4361
4362**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4363
4364**起始版本:** 11
4365
4366**参数:**
4367
4368| 名称 | 描述 |
4369| -------- | -------- |
4370| startPt | 表示渐变的起点。 |
4371| endPt | 表示渐变的终点。 |
4372| colors | 表示在两个点之间分布的颜色。 |
4373| pos | 表示每种对应颜色在颜色数组中的相对位置。 |
4374| size | 表示颜色和位置的数量。 |
4375| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 |
4376
4377**返回:**
4378
4379返回创建的着色器对象的指针。
4380
4381
4382### OH_Drawing_ShaderEffectCreateRadialGradient()
4383
4384```
4385OH_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  )
4386```
4387
4388**描述**
4389
4390创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。
4391
4392**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4393
4394**起始版本:** 11
4395
4396**参数:**
4397
4398| 名称 | 描述 |
4399| -------- | -------- |
4400| centerPt | 指示渐变的圆心。 |
4401| radius | 指示此渐变的圆半径。 |
4402| colors | 表示在两个点之间分布的颜色。 |
4403| pos | 表示每种对应颜色在颜色数组中的相对位置。 |
4404| size | 表示颜色和位置的数量。 |
4405| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 |
4406
4407**返回:**
4408
4409返回创建的着色器对象的指针。
4410
4411
4412### OH_Drawing_ShaderEffectCreateSweepGradient()
4413
4414```
4415OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient (const OH_Drawing_Point * centerPt, const uint32_t * colors, const float * pos, uint32_t size, OH_Drawing_TileMode  )
4416```
4417
4418**描述**
4419
4420创建着色器,在给定中心的情况下生成扇形渐变。
4421
4422**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4423
4424**起始版本:** 11
4425
4426**参数:**
4427
4428| 名称 | 描述 |
4429| -------- | -------- |
4430| centerPt | 表示渐变的圆心。 |
4431| colors | 表示在两个点之间分布的颜色。 |
4432| pos | 表示每种对应颜色在颜色数组中的相对位置。 |
4433| size | 表示颜色和位置的数量。 |
4434| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 |
4435
4436**返回:**
4437
4438返回创建的着色器对象的指针。
4439
4440
4441### OH_Drawing_ShaderEffectDestroy()
4442
4443```
4444void OH_Drawing_ShaderEffectDestroy (OH_Drawing_ShaderEffect * )
4445```
4446
4447**描述**
4448
4449销毁着色器对象,并收回该对象占用的内存。
4450
4451**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4452
4453**起始版本:** 11
4454
4455**参数:**
4456
4457| 名称 | 描述 |
4458| -------- | -------- |
4459| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针。 |
4460
4461
4462### OH_Drawing_TextBlobBuilderAllocRunPos()
4463
4464```
4465const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos (OH_Drawing_TextBlobBuilder * , const OH_Drawing_Font * , int32_t count, const OH_Drawing_Rect *  )
4466```
4467
4468**描述**
4469
4470申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理, 当调用[OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake)后禁止使用。
4471
4472**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4473
4474**起始版本:** 11
4475
4476**参数:**
4477
4478| 名称 | 描述 |
4479| -------- | -------- |
4480| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 |
4481| OH_Drawing_Font | 指向字体对象的指针。 |
4482| count | 文字的数量。 |
4483| OH_Drawing_Rect | 文本的边界框。 |
4484
4485
4486### OH_Drawing_TextBlobBuilderCreate()
4487
4488```
4489OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate (void )
4490```
4491
4492**描述**
4493
4494用于创建一个文本构造器对象。
4495
4496**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4497
4498**起始版本:** 11
4499
4500**返回:**
4501
4502函数会返回一个指针,指针指向创建的文本构造器对象。
4503
4504
4505### OH_Drawing_TextBlobBuilderDestroy()
4506
4507```
4508void OH_Drawing_TextBlobBuilderDestroy (OH_Drawing_TextBlobBuilder * )
4509```
4510
4511**描述**
4512
4513用于销毁文本构造器对象并回收该对象占有的内存。
4514
4515**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4516
4517**起始版本:** 11
4518
4519**参数:**
4520
4521| 名称 | 描述 |
4522| -------- | -------- |
4523| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 |
4524
4525
4526### OH_Drawing_TextBlobBuilderMake()
4527
4528```
4529OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake (OH_Drawing_TextBlobBuilder * )
4530```
4531
4532**描述**
4533
4534用于从文本构造器中创建文本对象。
4535
4536**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4537
4538**起始版本:** 11
4539
4540**参数:**
4541
4542| 名称 | 描述 |
4543| -------- | -------- |
4544| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 |
4545
4546**返回:**
4547
4548返回一个指针,指针指向创建的文本对象。
4549
4550
4551### OH_Drawing_TextBlobDestroy()
4552
4553```
4554void OH_Drawing_TextBlobDestroy (OH_Drawing_TextBlob * )
4555```
4556
4557**描述**
4558
4559用于销毁文本对象并回收该对象占有的内存。
4560
4561**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4562
4563**起始版本:** 11
4564
4565**参数:**
4566
4567| 名称 | 描述 |
4568| -------- | -------- |
4569| OH_Drawing_TextBlob | 指向文本对象的指针。 |
4570
4571
4572### OH_Drawing_TypefaceCreateDefault()
4573
4574```
4575OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault (void )
4576```
4577
4578**描述**
4579
4580用于创建一个默认的字形对象。
4581
4582**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4583
4584**起始版本:** 11
4585
4586**返回:**
4587
4588返回一个指针,指针指向创建的字形对象。
4589
4590
4591### OH_Drawing_TypefaceDestroy()
4592
4593```
4594void OH_Drawing_TypefaceDestroy (OH_Drawing_Typeface * )
4595```
4596
4597**描述**
4598
4599用于销毁字形对象并回收该对象占有的内存。
4600
4601**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4602
4603**起始版本:** 11
4604
4605**参数:**
4606
4607| 名称 | 描述 |
4608| -------- | -------- |
4609| OH_Drawing_Typeface | 指向字形对象的指针。 |
4610
4611
4612### OH_Drawing_TypographyDidExceedMaxLines()
4613
4614```
4615bool OH_Drawing_TypographyDidExceedMaxLines (OH_Drawing_Typography * )
4616```
4617
4618**描述**
4619
4620获取文本是否超过最大行。
4621
4622**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4623
4624**起始版本:** 11
4625
4626**参数:**
4627
4628| 名称 | 描述 |
4629| -------- | -------- |
4630| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4631
4632**返回:**
4633
4634返回文本是否超过最大行,true表示超过,false表示未超过
4635
4636
4637### OH_Drawing_TypographyGetAlphabeticBaseline()
4638
4639```
4640double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography * )
4641```
4642
4643**描述**
4644
4645获取字母文字基线。
4646
4647**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4648
4649**起始版本:** 9
4650
4651**参数:**
4652
4653| 名称 | 描述 |
4654| -------- | -------- |
4655| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4656
4657**返回:**
4658
4659返回字母文字基线。
4660
4661
4662### OH_Drawing_TypographyGetGlyphPositionAtCoordinate()
4663
4664```
4665OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate (OH_Drawing_Typography * , double , double  )
4666```
4667
4668**描述**
4669
4670获取坐标处文本的索引位置和亲和性。
4671
4672**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4673
4674**起始版本:** 11
4675
4676**参数:**
4677
4678| 名称 | 描述 |
4679| -------- | -------- |
4680| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4681| double | 光标的x坐标。 |
4682| double | 光标的y坐标。 |
4683
4684**返回:**
4685
4686返回坐标处字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。
4687
4688
4689### OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster()
4690
4691```
4692OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster (OH_Drawing_Typography * , double , double  )
4693```
4694
4695**描述**
4696
4697获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。
4698
4699**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4700
4701**起始版本:** 11
4702
4703**参数:**
4704
4705| 名称 | 描述 |
4706| -------- | -------- |
4707| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4708| double | 光标的x坐标。 |
4709| double | 光标的y坐标。 |
4710
4711**返回:**
4712
4713返回坐标处指定类型字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。
4714
4715
4716### OH_Drawing_TypographyGetHeight()
4717
4718```
4719double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography * )
4720```
4721
4722**描述**
4723
4724获取高度。
4725
4726**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4727
4728**起始版本:** 9
4729
4730**参数:**
4731
4732| 名称 | 描述 |
4733| -------- | -------- |
4734| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4735
4736**返回:**
4737
4738返回高度。
4739
4740
4741### OH_Drawing_TypographyGetIdeographicBaseline()
4742
4743```
4744double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography * )
4745```
4746
4747**描述**
4748
4749获取表意文字基线。
4750
4751**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4752
4753**起始版本:** 9
4754
4755**参数:**
4756
4757| 名称 | 描述 |
4758| -------- | -------- |
4759| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4760
4761**返回:**
4762
4763返回表意文字基线。
4764
4765
4766### OH_Drawing_TypographyGetLineCount()
4767
4768```
4769size_t OH_Drawing_TypographyGetLineCount (OH_Drawing_Typography * )
4770```
4771
4772**描述**
4773
4774获取文本行数。
4775
4776**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4777
4778**起始版本:** 11
4779
4780**参数:**
4781
4782| 名称 | 描述 |
4783| -------- | -------- |
4784| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4785
4786**返回:**
4787
4788返回行数。
4789
4790
4791### OH_Drawing_TypographyGetLineHeight()
4792
4793```
4794double OH_Drawing_TypographyGetLineHeight (OH_Drawing_Typography * , int  )
4795```
4796
4797**描述**
4798
4799获取指定行的行高。
4800
4801**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4802
4803**起始版本:** 11
4804
4805**参数:**
4806
4807| 名称 | 描述 |
4808| -------- | -------- |
4809| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4810| int | 要指定的行数。 |
4811
4812**返回:**
4813
4814返回指定行的行高。
4815
4816
4817### OH_Drawing_TypographyGetLineWidth()
4818
4819```
4820double OH_Drawing_TypographyGetLineWidth (OH_Drawing_Typography * , int  )
4821```
4822
4823**描述**
4824
4825获取指定行的行宽。
4826
4827**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4828
4829**起始版本:** 11
4830
4831**参数:**
4832
4833| 名称 | 描述 |
4834| -------- | -------- |
4835| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4836| int | 要指定的行数。 |
4837
4838**返回:**
4839
4840返回指定行的行宽。
4841
4842
4843### OH_Drawing_TypographyGetLongestLine()
4844
4845```
4846double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography * )
4847```
4848
4849**描述**
4850
4851获取最长行的宽度,建议实际使用时将返回值向上取整。当文本内容为空时,返回float的最小值,即:-340282346638528859811704183484516925440.000000。
4852
4853**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4854
4855**起始版本:** 9
4856
4857**参数:**
4858
4859| 名称 | 描述 |
4860| -------- | -------- |
4861| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4862
4863**返回:**
4864
4865返回最长行的宽度。
4866
4867
4868### OH_Drawing_TypographyGetMaxIntrinsicWidth()
4869
4870```
4871double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography * )
4872```
4873
4874**描述**
4875
4876获取最大固有宽度。
4877
4878**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4879
4880**起始版本:** 9
4881
4882**参数:**
4883
4884| 名称 | 描述 |
4885| -------- | -------- |
4886| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4887
4888**返回:**
4889
4890返回最大固有宽度。
4891
4892
4893### OH_Drawing_TypographyGetMaxWidth()
4894
4895```
4896double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography * )
4897```
4898
4899**描述**
4900
4901获取最大宽度。
4902
4903**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4904
4905**起始版本:** 9
4906
4907**参数:**
4908
4909| 名称 | 描述 |
4910| -------- | -------- |
4911| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4912
4913**返回:**
4914
4915返回最大宽度。
4916
4917
4918### OH_Drawing_TypographyGetMinIntrinsicWidth()
4919
4920```
4921double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography * )
4922```
4923
4924**描述**
4925
4926获取最小固有宽度。
4927
4928**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4929
4930**起始版本:** 9
4931
4932**参数:**
4933
4934| 名称 | 描述 |
4935| -------- | -------- |
4936| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4937
4938**返回:**
4939
4940返回最小固有宽度。
4941
4942
4943### OH_Drawing_TypographyGetRectsForPlaceholders()
4944
4945```
4946OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders (OH_Drawing_Typography * )
4947```
4948
4949**描述**
4950
4951获取占位符的文本框。
4952
4953**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4954
4955**起始版本:** 11
4956
4957**参数:**
4958
4959| 名称 | 描述 |
4960| -------- | -------- |
4961| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4962
4963**返回:**
4964
4965返回占位符的文本框,返回类型为[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。
4966
4967
4968### OH_Drawing_TypographyGetRectsForRange()
4969
4970```
4971OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange (OH_Drawing_Typography * , size_t , size_t , OH_Drawing_RectHeightStyle , OH_Drawing_RectWidthStyle  )
4972```
4973
4974**描述**
4975
4976获取指定范围内的文本框。
4977
4978**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
4979
4980**起始版本:** 11
4981
4982**参数:**
4983
4984| 名称 | 描述 |
4985| -------- | -------- |
4986| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
4987| size_t | 设置开始位置。 |
4988| size_t | 设置结束位置。 |
4989| OH_Drawing_RectHeightStyle | 设置高度样式,支持可选的高度样式具体可见[OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle)枚举。 |
4990| OH_Drawing_RectWidthStyle | 设置宽度样式,支持可选的宽度样式具体可见[OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)枚举。 |
4991
4992**返回:**
4993
4994返回指定范围内的文本框,具体可见[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。
4995
4996
4997### OH_Drawing_TypographyGetWordBoundary()
4998
4999```
5000OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary (OH_Drawing_Typography * , size_t  )
5001```
5002
5003**描述**
5004
5005获取单词的边界。
5006
5007**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5008
5009**起始版本:** 11
5010
5011**参数:**
5012
5013| 名称 | 描述 |
5014| -------- | -------- |
5015| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
5016| size_t | 单词索引。 |
5017
5018**返回:**
5019
5020返回单词边界,返回类型为[OH_Drawing_Range](#oh_drawing_range)结构体。
5021
5022
5023### OH_Drawing_TypographyHandlerAddPlaceholder()
5024
5025```
5026void OH_Drawing_TypographyHandlerAddPlaceholder (OH_Drawing_TypographyCreate * , OH_Drawing_PlaceholderSpan *  )
5027```
5028
5029**描述**
5030
5031设置占位符。
5032
5033**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5034
5035**起始版本:** 11
5036
5037**参数:**
5038
5039| 名称 | 描述 |
5040| -------- | -------- |
5041| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
5042| [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | 指向OH_Drawing_PlaceholderSpan对象的指针。 |
5043
5044
5045### OH_Drawing_TypographyHandlerAddText()
5046
5047```
5048void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate * , const char *  )
5049```
5050
5051**描述**
5052
5053设置文本内容。
5054
5055**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5056
5057**起始版本:** 8
5058
5059**参数:**
5060
5061| 名称 | 描述 |
5062| -------- | -------- |
5063| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
5064| char | 指向文本内容的指针。 |
5065
5066
5067### OH_Drawing_TypographyHandlerPopTextStyle()
5068
5069```
5070void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate * )
5071```
5072
5073**描述**
5074
5075排版弹出。
5076
5077**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5078
5079**起始版本:** 8
5080
5081**参数:**
5082
5083| 名称 | 描述 |
5084| -------- | -------- |
5085| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
5086
5087
5088### OH_Drawing_TypographyHandlerPushTextStyle()
5089
5090```
5091void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate * , OH_Drawing_TextStyle *  )
5092```
5093
5094**描述**
5095
5096设置排版风格。
5097
5098**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5099
5100**起始版本:** 8
5101
5102**参数:**
5103
5104| 名称 | 描述 |
5105| -------- | -------- |
5106| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 |
5107| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 |
5108
5109
5110### OH_Drawing_TypographyLayout()
5111
5112```
5113void OH_Drawing_TypographyLayout (OH_Drawing_Typography * , double  )
5114```
5115
5116**描述**
5117
5118排版布局。
5119
5120**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5121
5122**起始版本:** 8
5123
5124**参数:**
5125
5126| 名称 | 描述 |
5127| -------- | -------- |
5128| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
5129| double | 文本最大宽度 |
5130
5131
5132### OH_Drawing_TypographyPaint()
5133
5134```
5135void OH_Drawing_TypographyPaint (OH_Drawing_Typography * , OH_Drawing_Canvas * , double , double  )
5136```
5137
5138**描述**
5139
5140显示文本。
5141
5142**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
5143
5144**起始版本:** 8
5145
5146**参数:**
5147
5148| 名称 | 描述 |
5149| -------- | -------- |
5150| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 |
5151| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针,由[OH_Drawing_CanvasCreate](#oh_drawing_canvascreate)获取。 |
5152| double | x坐标。 |
5153| double | y坐标。 |
5154