From f0de0bee0fbde025d31ceea66057fcabe9a82de0 Mon Sep 17 00:00:00 2001 From: zengyawen Date: Fri, 8 Apr 2022 16:48:34 +0800 Subject: [PATCH] update docs Signed-off-by: zengyawen --- .../reference/native-apis/Readme-CN.md | 33 + .../reference/native-apis/_drawing.md | 2107 +++++++++++++++++ .../reference/native-apis/_hi_log.md | 316 +++ .../reference/native-apis/_native___bundle.md | 61 + .../reference/native-apis/_native_window.md | 339 +++ .../_o_h___drawing___bitmap_format.md | 61 + .../native-apis/_o_h___native_x_component.md | 575 +++++ .../_o_h___native_x_component___callback.md | 29 + ..._o_h___native_x_component___touch_event.md | 29 + ..._o_h___native_x_component___touch_point.md | 27 + .../native-apis/_raw_file_descriptor.md | 76 + .../reference/native-apis/annotated.md | 13 + .../native-apis/drawing__bitmap_8h.md | 38 + .../native-apis/drawing__brush_8h.md | 31 + .../native-apis/drawing__canvas_8h.md | 37 + .../native-apis/drawing__color_8h.md | 26 + .../drawing__font__collection_8h.md | 27 + .../reference/native-apis/drawing__path_8h.md | 34 + .../reference/native-apis/drawing__pen_8h.md | 47 + .../drawing__text__declaration_8h.md | 30 + .../drawing__text__typography_8h.md | 63 + .../native-apis/drawing__types_8h.md | 38 + .../native-apis/external__window_8h.md | 37 + .../reference/native-apis/files.md | 35 + .../reference/native-apis/index.md | 15 + .../reference/native-apis/log_8h.md | 48 + .../native__interface__bundle_8h.md | 26 + .../native__interface__xcomponent_8h.md | 62 + .../public_sys-resources/icon-caution.gif | Bin 0 -> 580 bytes .../public_sys-resources/icon-danger.gif | Bin 0 -> 580 bytes .../public_sys-resources/icon-note.gif | Bin 0 -> 394 bytes .../public_sys-resources/icon-notice.gif | Bin 0 -> 406 bytes .../public_sys-resources/icon-tip.gif | Bin 0 -> 253 bytes .../public_sys-resources/icon-warning.gif | Bin 0 -> 580 bytes .../reference/native-apis/raw__dir_8h.md | 37 + .../reference/native-apis/raw__file_8h.md | 48 + .../reference/native-apis/rawfile.md | 461 ++++ .../reference/native-apis/total.md | 7 + 38 files changed, 4813 insertions(+) create mode 100644 zh-cn/application-dev/reference/native-apis/Readme-CN.md create mode 100644 zh-cn/application-dev/reference/native-apis/_drawing.md create mode 100644 zh-cn/application-dev/reference/native-apis/_hi_log.md create mode 100644 zh-cn/application-dev/reference/native-apis/_native___bundle.md create mode 100644 zh-cn/application-dev/reference/native-apis/_native_window.md create mode 100644 zh-cn/application-dev/reference/native-apis/_o_h___drawing___bitmap_format.md create mode 100644 zh-cn/application-dev/reference/native-apis/_o_h___native_x_component.md create mode 100644 zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___callback.md create mode 100644 zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___touch_event.md create mode 100644 zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___touch_point.md create mode 100644 zh-cn/application-dev/reference/native-apis/_raw_file_descriptor.md create mode 100644 zh-cn/application-dev/reference/native-apis/annotated.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__brush_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__canvas_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__color_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__font__collection_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__path_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__pen_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__text__declaration_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__text__typography_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/drawing__types_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/external__window_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/files.md create mode 100644 zh-cn/application-dev/reference/native-apis/index.md create mode 100644 zh-cn/application-dev/reference/native-apis/log_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/native__interface__bundle_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/native__interface__xcomponent_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-caution.gif create mode 100644 zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-danger.gif create mode 100644 zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-note.gif create mode 100644 zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-notice.gif create mode 100644 zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-tip.gif create mode 100644 zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-warning.gif create mode 100644 zh-cn/application-dev/reference/native-apis/raw__dir_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/raw__file_8h.md create mode 100644 zh-cn/application-dev/reference/native-apis/rawfile.md create mode 100644 zh-cn/application-dev/reference/native-apis/total.md diff --git a/zh-cn/application-dev/reference/native-apis/Readme-CN.md b/zh-cn/application-dev/reference/native-apis/Readme-CN.md new file mode 100644 index 0000000000..f11bbcfaea --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/Readme-CN.md @@ -0,0 +1,33 @@ +# Native API + +- MyProject + - [Native XComponent](_o_h___native_x_component.md) + - [Native_Bundle](_native___bundle.md) + - [HiLog](_hi_log.md) + - [NativeWindow](_native_window.md) + - [Drawing](_drawing.md) + - [Rawfile](rawfile.md) +- 头文件和结构体 + - 头文件 + - [drawing_bitmap.h](drawing__bitmap_8h.md) + - [drawing_brush.h](drawing__brush_8h.md) + - [drawing_canvas.h](drawing__canvas_8h.md) + - [drawing_color.h](drawing__color_8h.md) + - [drawing_font_collection.h](drawing__font__collection_8h.md) + - [drawing_path.h](drawing__path_8h.md) + - [drawing_pen.h](drawing__pen_8h.md) + - [drawing_text_declaration.h](drawing__text__declaration_8h.md) + - [drawing_text_typography.h](drawing__text__typography_8h.md) + - [drawing_types.h](drawing__types_8h.md) + - [external_window.h](external__window_8h.md) + - [log.h](log_8h.md) + - [native_interface_bundle.h](native__interface__bundle_8h.md) + - [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) + - [raw_dir.h](raw__dir_8h.md) + - [raw_file.h](raw__file_8h.md) + - 结构体 + - [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) + - [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) + - [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) + - [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) + - [RawFileDescriptor](_raw_file_descriptor.md) diff --git a/zh-cn/application-dev/reference/native-apis/_drawing.md b/zh-cn/application-dev/reference/native-apis/_drawing.md new file mode 100644 index 0000000000..76b6c2c2e5 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_drawing.md @@ -0,0 +1,2107 @@ +# Drawing + + +## **Overview** + +**Description:** + +Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + +Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数. + +提供2D绘制功能 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Since:** + +8 + +**Version:** + +1.0 + + +## **Summary** + + +### Files + + | File Name | Description | +| -------- | -------- | +| [drawing_bitmap.h](drawing__bitmap_8h.md) | 文件中定义了与位图相关的功能函数 | +| [drawing_brush.h](drawing__brush_8h.md) | 文件中定义了与画刷相关的功能函数 | +| [drawing_canvas.h](drawing__canvas_8h.md) | 文件中定义了与画布相关的功能函数 | +| [drawing_color.h](drawing__color_8h.md) | 文件中定义了与颜色相关的功能函数 | +| [drawing_font_collection.h](drawing__font__collection_8h.md) | 定义绘制模块中与fontCollection相关的函数 | +| [drawing_path.h](drawing__path_8h.md) | 文件中定义了与自定义路径相关的功能函数 | +| [drawing_pen.h](drawing__pen_8h.md) | 文件中定义了与画笔相关的功能函数 | +| [drawing_text_declaration.h](drawing__text__declaration_8h.md) | 提供2d drawing文本相关的数据结构声明 | +| [drawing_text_typography.h](drawing__text__typography_8h.md) | 定义绘制模块中排版相关的函数 | +| [drawing_types.h](drawing__types_8h.md) | 文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径 | + + +### Classes + + | Classe Name | Description | +| -------- | -------- | +| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 | + + +### Typedefs + + | Typedef Name | Description | +| -------- | -------- | +| OH_Drawing_FontCollection | typedef struct OH_Drawing_FontCollection
OH_Drawing_FontCollection用于加载字体 | +| OH_Drawing_Typography | typedef struct OH_Drawing_Typography
OH_Drawing_Typography用于管理排版的布局和显示等 | +| OH_Drawing_TextStyle | typedef struct OH_Drawing_TextStyle
OH_Drawing_TextStyle用于管理字体颜色、装饰等 | +| OH_Drawing_TypographyStyle | typedef struct OH_Drawing_TypographyStyle
OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等 | +| OH_Drawing_TypographyCreate | typedef struct OH_Drawing_TypographyCreate
OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography. | +| OH_Drawing_Canvas | typedef struct OH_Drawing_Canvas
OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字 | +| OH_Drawing_Pen | typedef struct OH_Drawing_Pen
OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色 | +| OH_Drawing_Brush | typedef struct OH_Drawing_Brush
OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色 | +| OH_Drawing_Path | typedef struct OH_Drawing_Path
OH_Drawing_Path定义为路径,路径用于自定义各种形状 | +| OH_Drawing_Bitmap | typedef struct OH_Drawing_Bitmap
OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据 | + + +### Enumerations + + | Enumeration Name | Description | +| -------- | -------- | +| OH_Drawing_PenLineCapStyle { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式 | +| OH_Drawing_PenLineJoinStyle { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式 | +| OH_Drawing_TextDirection { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | 文字方向 | +| OH_Drawing_TextAlign {   TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY,   TEXT_ALIGN_START, TEXT_ALIGN_END } | 文字对齐方式 | +| OH_Drawing_FontWeight {   FONT_WEIGHT_100, FONT_WEIGHT_200, FONT_WEIGHT_300, FONT_WEIGHT_400,   FONT_WEIGHT_500, FONT_WEIGHT_600, FONT_WEIGHT_700, FONT_WEIGHT_800,   FONT_WEIGHT_900 } | 字重 | +| OH_Drawing_TextBaseline { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | 基线位置 | +| OH_Drawing_TextDecoration { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } | 文本装饰 | +| OH_Drawing_FontStyle { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC } | 区分字体是否为斜体 | +| OH_Drawing_ColorFormat {   COLOR_FORMAT_UNKNOWN, COLOR_FORMAT_ALPHA_8, COLOR_FORMAT_RGB_565, COLOR_FORMAT_ARGB_4444,   COLOR_FORMAT_RGBA_8888, COLOR_FORMAT_BGRA_8888 } | OH_Drawing_ColorFormat用于描述位图像素的存储格式 | +| OH_Drawing_AlphaFormat { ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL } | OH_Drawing_AlphaFormat用于描述位图像素的透明度分量 | + + +### Functions + + | Function | Description | +| -------- | -------- | +| OH_Drawing_BitmapCreate (void) | OH_Drawing_Bitmap \*
函数用于创建一个位图对象。 | +| OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap \*) | void
函数用于销毁位图对象并回收该对象占有内存。 | +| OH_Drawing_BitmapBuild (OH_Drawing_Bitmap \*, const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat \*) | void
函数用于初始化位图对象的宽度和高度,并且为该位图设置像素格式 | +| OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap \*) | uint32_t
该函数用于获取指定位图的宽度 | +| OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap \*) | uint32_t
函数用于获取指定位图的高度 | +| OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap \*) | void \*
函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据 | +| OH_Drawing_BrushCreate (void) | OH_Drawing_Brush \*
函数用于创建一个画刷对象 | +| OH_Drawing_BrushDestroy (OH_Drawing_Brush \*) | void
函数用于销毁画刷对象并回收该对象占有的内存。 | +| OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush \*) | bool
函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush \*, bool) | void
函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| OH_Drawing_BrushGetColor (const OH_Drawing_Brush \*) | uint32_t
函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 | +| OH_Drawing_BrushSetColor (OH_Drawing_Brush \*, uint32_t color) | void
函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 | +| OH_Drawing_CanvasCreate (void) | OH_Drawing_Canvas \*
函数用于创建一个画布对象 | +| OH_Drawing_CanvasDestroy (OH_Drawing_Canvas \*) | void
函数用于销毁画布对象并回收该对象占有的内存 | +| OH_Drawing_CanvasBind (OH_Drawing_Canvas \*, OH_Drawing_Bitmap \*) | void
函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染) | +| OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas \*, const OH_Drawing_Pen \*) | void
函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓 | +| OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas \*) | void
函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓 | +| OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas \*, const OH_Drawing_Brush \*) | void
函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状 | +| OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas \*) | void
函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状 | +| OH_Drawing_CanvasSave (OH_Drawing_Canvas \*) | void
函数用于保存当前画布的状态(画布矩阵)到一个栈顶 | +| OH_Drawing_CanvasRestore (OH_Drawing_Canvas \*) | void
函数用于恢复保存在栈顶的画布状态(画布矩阵) | +| OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas \*, float x1, float y1, float x2, float y2) | void
函数用于画一条直线段 | +| OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas \*, const OH_Drawing_Path \*) | void
函数用于画一个自定义路径 | +| OH_Drawing_CanvasClear (OH_Drawing_Canvas \*, uint32_t color) | void
函数用于使用指定颜色去清空画布 | +| OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | uint32_t
函数用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量 | +| OH_Drawing_CreateFontCollection (void) | OH_Drawing_FontCollection \*
创建OH_Drawing_FontCollection | +| OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection \*) | void
释放被OH_Drawing_FontCollection对象占据的内存 | +| OH_Drawing_PathCreate (void) | OH_Drawing_Path \*
函数用于创建一个路径对象 | +| OH_Drawing_PathDestroy (OH_Drawing_Path \*) | void
函数用于销毁路径对象并回收该对象占有的内存 | +| OH_Drawing_PathMoveTo (OH_Drawing_Path \*, float x, float y) | void
函数用于设置自定义路径的起始点位置 | +| OH_Drawing_PathLineTo (OH_Drawing_Path \*, float x, float y) | void
函数用于添加一条从路径的最后点位置到目标点位置的线段 | +| OH_Drawing_PathArcTo (OH_Drawing_Path \*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg) | void
函数用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段 | +| OH_Drawing_PathQuadTo (OH_Drawing_Path \*, float ctrlX, float ctrlY, float endX, float endY) | void
函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线 | +| OH_Drawing_PathCubicTo (OH_Drawing_Path \*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY) | void
函数用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线 | +| OH_Drawing_PathClose (OH_Drawing_Path \*) | void
函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段 | +| OH_Drawing_PathReset (OH_Drawing_Path \*) | void
函数用于重置自定义路径数据 | +| OH_Drawing_PenCreate (void) | OH_Drawing_Pen \*
函数用于创建一个画笔对象 | +| OH_Drawing_PenDestroy (OH_Drawing_Pen \*) | void
函数用于销毁画笔对象并回收该对象占有的内存 | +| OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen \*) | bool
函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen \*, bool) | void
函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| OH_Drawing_PenGetColor (const OH_Drawing_Pen \*) | uint32_t
函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 | +| OH_Drawing_PenSetColor (OH_Drawing_Pen \*, uint32_t color) | void
函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 | +| OH_Drawing_PenGetWidth (const OH_Drawing_Pen \*) | float
函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 | +| OH_Drawing_PenSetWidth (OH_Drawing_Pen \*, float width) | void
函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 | +| OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen \*) | float
函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 | +| OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen \*, float miter) | void
函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 | +| OH_Drawing_PenGetCap (const OH_Drawing_Pen \*) | OH_Drawing_PenLineCapStyle
函数用于获取画笔笔帽的样式 | +| OH_Drawing_PenSetCap (OH_Drawing_Pen \*, OH_Drawing_PenLineCapStyle) | void
函数用于设置画笔笔帽样式 | +| OH_Drawing_PenGetJoin (const OH_Drawing_Pen \*) | OH_Drawing_PenLineJoinStyle
函数用于获取画笔绘制折线转角的样式 | +| OH_Drawing_PenSetJoin (OH_Drawing_Pen \*, OH_Drawing_PenLineJoinStyle) | void
函数用于设置画笔绘制转角的样式 | +| OH_Drawing_CreateTypographyStyle (void) | OH_Drawing_TypographyStyle \*
创建OH_Drawing_TypographyStyle | +| OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle \*) | void
释放被OH_Drawing_TypographyStyle对象占据的内存 | +| OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle \*, int) | void
设置文本方向 | +| OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle \*, int) | void
设置文本对齐方式 | +| OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle \*, int) | void
设置文本最大行数 | +| OH_Drawing_CreateTextStyle (void) | OH_Drawing_TextStyle \*
创建OH_Drawing_TextStyle | +| OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle \*) | void
释放被OH_Drawing_TextStyle对象占据的内存 | +| OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle \*, uint32_t) | void
设置文本颜色 | +| OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle \*, double) | void
设置字号 | +| OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle \*, int) | void
设置字重 | +| OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle \*, int) | void
设置字体基线位置 | +| OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle \*, int) | void
设置装饰 | +| OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle \*, uint32_t) | void
设置装饰颜色 | +| OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle \*, double) | void
设置字体高度 | +| OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle \*, int, const char \*fontFamilies[]) | void
设置字体类型 | +| OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle \*, int) | void
设置字体风格 | +| OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle \*, const char \*) | void
设置语言区域 | +| OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle \*, OH_Drawing_FontCollection \*) | OH_Drawing_TypographyCreate \*
创建指向OH_Drawing_TypographyCreate对象的指针 | +| OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate \*) | void
释放被OH_Drawing_TypographyCreate对象占据的内存 | +| OH_Drawing_TypographyHandlerPushStyle (OH_Drawing_TypographyCreate \*, OH_Drawing_TextStyle \*) | void
设置排版风格 | +| OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate \*, const char \*) | void
设置文本内容 | +| OH_Drawing_TypographyHandlerPop (OH_Drawing_TypographyCreate \*) | void
排版弹出 | +| OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate \*) | OH_Drawing_Typography \*
创建OH_Drawing_Typography | +| OH_Drawing_DestroyTypography (OH_Drawing_Typography \*) | void
释放OH_Drawing_Typography对象占据的内存 | +| OH_Drawing_TypographyLayout (OH_Drawing_Typography \*, double) | void
排版布局 | +| OH_Drawing_TypographyPaint (OH_Drawing_Typography \*, OH_Drawing_Canvas \*, double, double) | void
显示文本 | + + +## **Details** + + +## **Typedef** + + +### OH_Drawing_Bitmap + + +``` +typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap +``` + +**Description:** + +OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据 + + +### OH_Drawing_Brush + + +``` +typedef struct OH_Drawing_Brush OH_Drawing_Brush +``` + +**Description:** + +OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色 + + +### OH_Drawing_Canvas + + +``` +typedef struct OH_Drawing_Canvas OH_Drawing_Canvas +``` + +**Description:** + +OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字 + + +### OH_Drawing_FontCollection + + +``` +typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection +``` + +**Description:** + +OH_Drawing_FontCollection用于加载字体 + + +### OH_Drawing_Path + + +``` +typedef struct OH_Drawing_Path OH_Drawing_Path +``` + +**Description:** + +OH_Drawing_Path定义为路径,路径用于自定义各种形状 + + +### OH_Drawing_Pen + + +``` +typedef struct OH_Drawing_Pen OH_Drawing_Pen +``` + +**Description:** + +OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色 + + +### OH_Drawing_TextStyle + + +``` +typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle +``` + +**Description:** + +OH_Drawing_TextStyle用于管理字体颜色、装饰等 + + +### OH_Drawing_Typography + + +``` +typedef struct OH_Drawing_Typography OH_Drawing_Typography +``` + +**Description:** + +OH_Drawing_Typography用于管理排版的布局和显示等 + + +### OH_Drawing_TypographyCreate + + +``` +typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate +``` + +**Description:** + +OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography. + + +### OH_Drawing_TypographyStyle + + +``` +typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle +``` + +**Description:** + +OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等 + + +## **Enumeration Type** + + +### OH_Drawing_AlphaFormat + + +``` +enum OH_Drawing_AlphaFormat +``` + +**Description:** + +OH_Drawing_AlphaFormat用于描述位图像素的透明度分量 + + | Enumerator | Description | +| -------- | -------- | +| ALPHA_FORMAT_UNKNOWN | 未知格式 | +| ALPHA_FORMAT_OPAQUE | 位图无透明度 | +| ALPHA_FORMAT_PREMUL | 每个像素的颜色组件由透明度分量预先乘以 | +| ALPHA_FORMAT_UNPREMUL | 每个像素的颜色组件未由透明度分量预先乘以 | + + +### OH_Drawing_ColorFormat + + +``` +enum OH_Drawing_ColorFormat +``` + +**Description:** + +OH_Drawing_ColorFormat用于描述位图像素的存储格式 + + | Enumerator | Description | +| -------- | -------- | +| COLOR_FORMAT_UNKNOWN | 未知格式. | +| COLOR_FORMAT_ALPHA_8 | 每个像素用一个8位的量表示,8个位比特位表示透明度 | +| COLOR_FORMAT_RGB_565 | 每个像素用一个16位的量表示,高位到低位依次是5个比特位表示红,6个比特位表示绿,5个比特位表示蓝 | +| COLOR_FORMAT_ARGB_4444 | 每个像素用一个16位的量表示,高位到低位依次是4个比特位表示透明度,4个比特位表示红,4个比特位表示绿,4个比特位表示蓝 | +| COLOR_FORMAT_RGBA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示透明度,8个比特位表示红,8个比特位表示绿,8个比特位表示蓝 | +| COLOR_FORMAT_BGRA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示蓝,8个比特位表示绿,8个比特位表示红,8个比特位表示透明度 | + + +### OH_Drawing_FontStyle + + +``` +enum OH_Drawing_FontStyle +``` + +**Description:** + +区分字体是否为斜体 + + | Enumerator | Description | +| -------- | -------- | +| FONT_STYLE_NORMAL | 非斜体 | +| FONT_STYLE_ITALIC | 斜体 | + + +### OH_Drawing_FontWeight + + +``` +enum OH_Drawing_FontWeight +``` + +**Description:** + +字重 + + | Enumerator | Description | +| -------- | -------- | +| FONT_WEIGHT_100 | 字重为thin | +| FONT_WEIGHT_200 | 字重为extra-light | +| FONT_WEIGHT_300 | 字重为light | +| FONT_WEIGHT_400 | 字重为normal/regular | +| FONT_WEIGHT_500 | 字重为medium | +| FONT_WEIGHT_600 | 字重为semi-bold | +| FONT_WEIGHT_700 | 字重为bold | +| FONT_WEIGHT_800 | 字重为extra-bold | +| FONT_WEIGHT_900 | 字重为black | + + +### OH_Drawing_PenLineCapStyle + + +``` +enum OH_Drawing_PenLineCapStyle +``` + +**Description:** + +枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式 + + | Enumerator | Description | +| -------- | -------- | +| LINE_FLAT_CAP | 没有笔帽样式,线条头尾端点处横切 | +| LINE_SQUARE_CAP | 笔帽的样式为方框,线条的头尾端点处多出一个方框,方框宽度和线段一样宽,高度时线段厚度的一半 | +| LINE_ROUND_CAP | 笔帽的样式为圆弧,线条的头尾端点处多出一个半圆弧,半圆的直径与线段厚度一致 | + + +### OH_Drawing_PenLineJoinStyle + + +``` +enum OH_Drawing_PenLineJoinStyle +``` + +**Description:** + +枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式 + + | Enumerator | Description | +| -------- | -------- | +| LINE_MITER_JOIN | 转角类型为尖角,如果折线角度比较小,则尖角会很长,需要使用限制值(miter limit)进行限制 | +| LINE_ROUND_JOIN | 转角类型为圆头 | +| LINE_BEVEL_JOIN | 转角类型为平头 | + + +### OH_Drawing_TextAlign + + +``` +enum OH_Drawing_TextAlign +``` + +**Description:** + +文字对齐方式 + + | Enumerator | Description | +| -------- | -------- | +| TEXT_ALIGN_LEFT | 左对齐 | +| TEXT_ALIGN_RIGHT | 右对齐 | +| TEXT_ALIGN_CENTER | 居中对齐 | +| TEXT_ALIGN_JUSTIFY | 两端对齐,即紧靠左和右边缘,中间单词空隙由空格填充 最后一行除外 | +| 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相同。 | +| 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相同。 | + + +### OH_Drawing_TextBaseline + + +``` +enum OH_Drawing_TextBaseline +``` + +**Description:** + +基线位置 + + | Enumerator | Description | +| -------- | -------- | +| TEXT_BASELINE_ALPHABETIC | 用于表音文字,基线在中间偏下的位置 | +| TEXT_BASELINE_IDEOGRAPHIC | 用于表意文字,基线位于底部 | + + +### OH_Drawing_TextDecoration + + +``` +enum OH_Drawing_TextDecoration +``` + +**Description:** + +文本装饰 + + | Enumerator | Description | +| -------- | -------- | +| TEXT_DECORATION_NONE | 无装饰 | +| TEXT_DECORATION_UNDERLINE | 下划线 | +| TEXT_DECORATION_OVERLINE | 上划线 | +| TEXT_DECORATION_LINE_THROUGH | 删除线 | + + +### OH_Drawing_TextDirection + + +``` +enum OH_Drawing_TextDirection +``` + +**Description:** + +文字方向 + + | Enumerator | Description | +| -------- | -------- | +| TEXT_DIRECTION_RTL | 方向:从右到左 | +| TEXT_DIRECTION_LTR | 方向:从左到右 | + + +## **Function** + + +### OH_Drawing_BitmapBuild() + + +``` +void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap * , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat * ) +``` + +**Description:** + +函数用于初始化位图对象的宽度和高度,并且为该位图设置像素格式 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | +| width | 参数是位图要初始化设置的宽度 | +| height | 参数是位图要初始化设置的高度 | +| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 参数是位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型 | + + +### OH_Drawing_BitmapCreate() + + +``` +OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void ) +``` + +**Description:** + +函数用于创建一个位图对象。 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Returns:** + +函数会返回一个指针,指针指向创建的位图对象 + + +### OH_Drawing_BitmapDestroy() + + +``` +void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap * ) +``` + +**Description:** + +函数用于销毁位图对象并回收该对象占有内存。 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | + + +### OH_Drawing_BitmapGetHeight() + + +``` +uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap * ) +``` + +**Description:** + +函数用于获取指定位图的高度 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | + +**Returns:** + +函数返回位图的高度 + + +### OH_Drawing_BitmapGetPixels() + + +``` +void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap * ) +``` + +**Description:** + +函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | + +**Returns:** + +函数返回位图的像素地址 + + +### OH_Drawing_BitmapGetWidth() + + +``` +uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap * ) +``` + +**Description:** + +该函数用于获取指定位图的宽度 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | + +**Returns:** + +函数返回位图的宽度 + + +### OH_Drawing_BrushCreate() + + +``` +OH_Drawing_Brush* OH_Drawing_BrushCreate (void ) +``` + +**Description:** + +函数用于创建一个画刷对象 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Returns:** + +函数会返回一个指针,指针指向创建的画刷对象 + + +### OH_Drawing_BrushDestroy() + + +``` +void OH_Drawing_BrushDestroy (OH_Drawing_Brush * ) +``` + +**Description:** + +函数用于销毁画刷对象并回收该对象占有的内存。 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | + + +### OH_Drawing_BrushGetColor() + + +``` +uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush * ) +``` + +**Description:** + +函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | + +**Returns:** + +函数返回一个描述颜色的32位(ARGB)变量 + + +### OH_Drawing_BrushIsAntiAlias() + + +``` +bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush * ) +``` + +**Description:** + +函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | + +**Returns:** + +函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿 + + +### OH_Drawing_BrushSetAntiAlias() + + +``` +void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush * , bool ) +``` + +**Description:** + +函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | +| bool | 参数真为抗锯齿,参数假则不做抗锯齿处理 | + + +### OH_Drawing_BrushSetColor() + + +``` +void OH_Drawing_BrushSetColor (OH_Drawing_Brush * , uint32_t color ) +``` + +**Description:** + +函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | +| color | 参数是一个描述颜色的32位(ARGB)变量 | + + +### OH_Drawing_CanvasAttachBrush() + + +``` +void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas * , const OH_Drawing_Brush * ) +``` + +**Description:** + +函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Brush | 参数为一个指向画刷对象的指针 | + + +### OH_Drawing_CanvasAttachPen() + + +``` +void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas * , const OH_Drawing_Pen * ) +``` + +**Description:** + +函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Pen | 参数为一个指向画笔对象的指针 | + + +### OH_Drawing_CanvasBind() + + +``` +void OH_Drawing_CanvasBind (OH_Drawing_Canvas * , OH_Drawing_Bitmap * ) +``` + +**Description:** + +函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染) + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Bitmap | 参数为一个指向位图对象的指针 | + + +### OH_Drawing_CanvasClear() + + +``` +void OH_Drawing_CanvasClear (OH_Drawing_Canvas * , uint32_t color ) +``` + +**Description:** + +函数用于使用指定颜色去清空画布 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| color | 参数为一个描述颜色的32位(ARGB)变量 | + + +### OH_Drawing_CanvasCreate() + + +``` +OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void ) +``` + +**Description:** + +函数用于创建一个画布对象 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Returns:** + +函数会返回一个指针,指针指向创建的画布对象 + + +### OH_Drawing_CanvasDestroy() + + +``` +void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas * ) +``` + +**Description:** + +函数用于销毁画布对象并回收该对象占有的内存 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数是一个指向画布对象的指针 | + + +### OH_Drawing_CanvasDetachBrush() + + +``` +void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas * ) +``` + +**Description:** + +函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | + + +### OH_Drawing_CanvasDetachPen() + + +``` +void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas * ) +``` + +**Description:** + +函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | + + +### OH_Drawing_CanvasDrawLine() + + +``` +void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas * , float x1, float y1, float x2, float y2 ) +``` + +**Description:** + +函数用于画一条直线段 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| x1 | 参数为线段起始点的横坐标 | +| y1 | 参数为线段起始点的纵坐标 | +| x2 | 参数为线段结束点的横坐标 | +| y2 | 参数为线段结束点的纵坐标 | + + +### OH_Drawing_CanvasDrawPath() + + +``` +void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas * , const OH_Drawing_Path * ) +``` + +**Description:** + +函数用于画一个自定义路径 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | + + +### OH_Drawing_CanvasRestore() + + +``` +void OH_Drawing_CanvasRestore (OH_Drawing_Canvas * ) +``` + +**Description:** + +函数用于恢复保存在栈顶的画布状态(画布矩阵) + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | + + +### OH_Drawing_CanvasSave() + + +``` +void OH_Drawing_CanvasSave (OH_Drawing_Canvas * ) +``` + +**Description:** + +函数用于保存当前画布的状态(画布矩阵)到一个栈顶 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | + + +### OH_Drawing_ColorSetArgb() + + +``` +uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue ) +``` + +**Description:** + +函数用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| alpha | 参数为一个描述透明度的变量, 变量范围是0x00~0xFF | +| red | 参数为一个描述红色的变量, 变量范围是0x00~0xFF | +| green | 参数为一个描述绿色的变量, 变量范围是0x00~0xFF | +| blue | 参数为一个描述蓝色的变量, 变量范围是0x00~0xFF | + +**Returns:** + +函数返回一个描述颜色的32位(ARGB)变量 + + +### OH_Drawing_CreateFontCollection() + + +``` +OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void ) +``` + +**Description:** + +创建OH_Drawing_FontCollection + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Returns:** + +指向创建的OH_Drawing_FontCollection对象的指针 + + +### OH_Drawing_CreateTextStyle() + + +``` +OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void ) +``` + +**Description:** + +创建OH_Drawing_TextStyle + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Returns:** + +指向创建的OH_Drawing_TextStyle对象的指针 + + +### OH_Drawing_CreateTypography() + + +``` +OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate * ) +``` + +**Description:** + +创建OH_Drawing_Typography + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | + +**Returns:** + +指向OH_Drawing_Typography对象的指针 + + +### OH_Drawing_CreateTypographyHandler() + + +``` +OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle * , OH_Drawing_FontCollection * ) +``` + +**Description:** + +创建指向OH_Drawing_TypographyCreate对象的指针 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle的指针 | +| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection的指针 | + +**Returns:** + +指向新创建的OH_Drawing_TypographyCreate对象的指针 + + +### OH_Drawing_CreateTypographyStyle() + + +``` +OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void ) +``` + +**Description:** + +创建OH_Drawing_TypographyStyle + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Returns:** + +指向创建的OH_Drawing_TypographyStyle对象的指针 + + +### OH_Drawing_DestroyFontCollection() + + +``` +void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection * ) +``` + +**Description:** + +释放被OH_Drawing_FontCollection对象占据的内存 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针 | + + +### OH_Drawing_DestroyTextStyle() + + +``` +void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle * ) +``` + +**Description:** + +释放被OH_Drawing_TextStyle对象占据的内存 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | + + +### OH_Drawing_DestroyTypography() + + +``` +void OH_Drawing_DestroyTypography (OH_Drawing_Typography * ) +``` + +**Description:** + +释放OH_Drawing_Typography对象占据的内存 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针 | + + +### OH_Drawing_DestroyTypographyHandler() + + +``` +void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate * ) +``` + +**Description:** + +释放被OH_Drawing_TypographyCreate对象占据的内存 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | + + +### OH_Drawing_DestroyTypographyStyle() + + +``` +void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle * ) +``` + +**Description:** + +释放被OH_Drawing_TypographyStyle对象占据的内存 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | + + +### OH_Drawing_PathArcTo() + + +``` +void OH_Drawing_PathArcTo (OH_Drawing_Path * , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg ) +``` + +**Description:** + +函数用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| x1 | 参数为包围椭圆的矩形左上角点位置的横坐标 | +| y1 | 参数为包围椭圆的矩形左上角点位置的纵坐标 | +| x2 | 参数为包围椭圆的矩形右下角点位置的横坐标 | +| y3 | 参数为包围椭圆的矩形右下角点位置的纵坐标 | + + +### OH_Drawing_PathClose() + + +``` +void OH_Drawing_PathClose (OH_Drawing_Path * ) +``` + +**Description:** + +函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | + + +### OH_Drawing_PathCreate() + + +``` +OH_Drawing_Path* OH_Drawing_PathCreate (void ) +``` + +**Description:** + +函数用于创建一个路径对象 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Returns:** + +函数会返回一个指针,指针指向创建的路径对象 + + +### OH_Drawing_PathCubicTo() + + +``` +void OH_Drawing_PathCubicTo (OH_Drawing_Path * , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY ) +``` + +**Description:** + +函数用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| ctrlX1 | 参数为第一个控制点位置的横坐标 | +| ctrlY1 | 参数为第一个控制点位置的纵坐标 | +| ctrlX2 | 参数为第二个控制点位置的横坐标 | +| ctrlY2 | 参数为第二个控制点位置的纵坐标 | +| endX | 参数为目标点位置的横坐标 | +| endY | 参数为目标点位置的纵坐标 | + + +### OH_Drawing_PathDestroy() + + +``` +void OH_Drawing_PathDestroy (OH_Drawing_Path * ) +``` + +**Description:** + +函数用于销毁路径对象并回收该对象占有的内存 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | + + +### OH_Drawing_PathLineTo() + + +``` +void OH_Drawing_PathLineTo (OH_Drawing_Path * , float x, float y ) +``` + +**Description:** + +函数用于添加一条从路径的最后点位置到目标点位置的线段 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| x | 参数为目标点的横坐标 | +| y | 参数为目标点的纵坐标 | + + +### OH_Drawing_PathMoveTo() + + +``` +void OH_Drawing_PathMoveTo (OH_Drawing_Path * , float x, float y ) +``` + +**Description:** + +函数用于设置自定义路径的起始点位置 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| x | 参数为起始点的横坐标 | +| y | 参数为起始点的纵坐标 | + + +### OH_Drawing_PathQuadTo() + + +``` +void OH_Drawing_PathQuadTo (OH_Drawing_Path * , float ctrlX, float ctrlY, float endX, float endY ) +``` + +**Description:** + +函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| ctrlX | 参数为控制点位置的横坐标 | +| ctrlY | 参数为控制点位置的纵坐标 | +| endX | 参数为目标点位置的横坐标 | +| endY | 参数为目标点位置的纵坐标 | + + +### OH_Drawing_PathReset() + + +``` +void OH_Drawing_PathReset (OH_Drawing_Path * ) +``` + +**Description:** + +函数用于重置自定义路径数据 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | + + +### OH_Drawing_PenCreate() + + +``` +OH_Drawing_Pen* OH_Drawing_PenCreate (void ) +``` + +**Description:** + +函数用于创建一个画笔对象 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Returns:** + +函数会返回一个指针,指针指向创建的画笔对象 + + +### OH_Drawing_PenDestroy() + + +``` +void OH_Drawing_PenDestroy (OH_Drawing_Pen * ) +``` + +**Description:** + +函数用于销毁画笔对象并回收该对象占有的内存 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | + + +### OH_Drawing_PenGetCap() + + +``` +OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen * ) +``` + +**Description:** + +函数用于获取画笔笔帽的样式 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | + +**Returns:** + +函数返回画笔笔帽样式 + + +### OH_Drawing_PenGetColor() + + +``` +uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen * ) +``` + +**Description:** + +函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | + +**Returns:** + +函数返回一个描述颜色的32位(ARGB)变量 + + +### OH_Drawing_PenGetJoin() + + +``` +OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen * ) +``` + +**Description:** + +函数用于获取画笔绘制折线转角的样式 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | + +**Returns:** + +函数返回折线转角的样式 + + +### OH_Drawing_PenGetMiterLimit() + + +``` +float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen * ) +``` + +**Description:** + +函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | + +**Returns:** + +函数返回尖角的限制值 + + +### OH_Drawing_PenGetWidth() + + +``` +float OH_Drawing_PenGetWidth (const OH_Drawing_Pen * ) +``` + +**Description:** + +函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | + +**Returns:** + +函数返回画笔的厚度 + + +### OH_Drawing_PenIsAntiAlias() + + +``` +bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen * ) +``` + +**Description:** + +函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | + +**Returns:** + +函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿 + + +### OH_Drawing_PenSetAntiAlias() + + +``` +void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen * , bool ) +``` + +**Description:** + +函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| bool | 参数真为抗锯齿,参数假则不做抗锯齿处理 | + + +### OH_Drawing_PenSetCap() + + +``` +void OH_Drawing_PenSetCap (OH_Drawing_Pen * , OH_Drawing_PenLineCapStyle ) +``` + +**Description:** + +函数用于设置画笔笔帽样式 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_PenLineCapStyle | 参数是一个描述画笔笔帽样式的变量 | + + +### OH_Drawing_PenSetColor() + + +``` +void OH_Drawing_PenSetColor (OH_Drawing_Pen * , uint32_t color ) +``` + +**Description:** + +函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| color | 参数是一个描述颜色的32位(ARGB)变量 | + + +### OH_Drawing_PenSetJoin() + + +``` +void OH_Drawing_PenSetJoin (OH_Drawing_Pen * , OH_Drawing_PenLineJoinStyle ) +``` + +**Description:** + +函数用于设置画笔绘制转角的样式 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_PenLineJoinStyle | 参数值一个描述折线转角样式的变量 | + + +### OH_Drawing_PenSetMiterLimit() + + +``` +void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen * , float miter ) +``` + +**Description:** + +函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| miter | 参数是一个描述尖角限制值的变量 | + + +### OH_Drawing_PenSetWidth() + + +``` +void OH_Drawing_PenSetWidth (OH_Drawing_Pen * , float width ) +``` + +**Description:** + +函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| width | 参数是一个描述画笔厚度的变量 | + + +### OH_Drawing_SetTextStyleBaseLine() + + +``` +void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle * , int ) +``` + +**Description:** + +设置字体基线位置 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | OH_Drawing_TextBaseline枚举类型 | + + +### OH_Drawing_SetTextStyleColor() + + +``` +void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle * , uint32_t ) +``` + +**Description:** + +设置文本颜色 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| uint32_t | 颜色 | + + +### OH_Drawing_SetTextStyleDecoration() + + +``` +void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle * , int ) +``` + +**Description:** + +设置装饰 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | OH_Drawing_TextDecoration枚举类型 | + + +### OH_Drawing_SetTextStyleDecorationColor() + + +``` +void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle * , uint32_t ) +``` + +**Description:** + +设置装饰颜色 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| uint32_t | 颜色 | + + +### OH_Drawing_SetTextStyleFontFamilies() + + +``` +void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle * , int , const char * fontFamilies[] ) +``` + +**Description:** + +设置字体类型 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | 字体名称数量 | +| char | 指向字体类型的指针 | + + +### OH_Drawing_SetTextStyleFontHeight() + + +``` +void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle * , double ) +``` + +**Description:** + +设置字体高度 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| double | 字体高度 | + + +### OH_Drawing_SetTextStyleFontSize() + + +``` +void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle * , double ) +``` + +**Description:** + +设置字号 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| double | 字号 | + + +### OH_Drawing_SetTextStyleFontStyle() + + +``` +void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle * , int ) +``` + +**Description:** + +设置字体风格 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | OH_Drawing_FontStyle枚举类型 | + + +### OH_Drawing_SetTextStyleFontWeight() + + +``` +void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle * , int ) +``` + +**Description:** + +设置字重 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | OH_Drawing_FontWeight枚举类型 | + + +### OH_Drawing_SetTextStyleLocale() + + +``` +void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle * , const char * ) +``` + +**Description:** + +设置语言区域 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| char | 语言区域,数据类型为指向char的指针 | + + +### OH_Drawing_SetTypographyTextAlign() + + +``` +void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle * , int ) +``` + +**Description:** + +设置文本对齐方式 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | +| int | OH_Drawing_TextAlign枚举类型 | + + +### OH_Drawing_SetTypographyTextDirection() + + +``` +void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle * , int ) +``` + +**Description:** + +设置文本方向 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | +| int | OH_Drawing_TextDirection枚举类型 | + + +### OH_Drawing_SetTypographyTextMaxLines() + + +``` +void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle * , int ) +``` + +**Description:** + +设置文本最大行数 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | +| int | 最大行数 | + + +### OH_Drawing_TypographyHandlerAddText() + + +``` +void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate * , const char * ) +``` + +**Description:** + +设置文本内容 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | +| char | 指向文本内容的指针 | + + +### OH_Drawing_TypographyHandlerPop() + + +``` +void OH_Drawing_TypographyHandlerPop (OH_Drawing_TypographyCreate * ) +``` + +**Description:** + +排版弹出 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | + + +### OH_Drawing_TypographyHandlerPushStyle() + + +``` +void OH_Drawing_TypographyHandlerPushStyle (OH_Drawing_TypographyCreate * , OH_Drawing_TextStyle * ) +``` + +**Description:** + +设置排版风格 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | + + +### OH_Drawing_TypographyLayout() + + +``` +void OH_Drawing_TypographyLayout (OH_Drawing_Typography * , double ) +``` + +**Description:** + +排版布局 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针 | +| double | 文本最大宽度 | + + +### OH_Drawing_TypographyPaint() + + +``` +void OH_Drawing_TypographyPaint (OH_Drawing_Typography * , OH_Drawing_Canvas * , double , double ) +``` + +**Description:** + +显示文本 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针 | +| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针 | +| double | x坐标 | +| double | y坐标 | diff --git a/zh-cn/application-dev/reference/native-apis/_hi_log.md b/zh-cn/application-dev/reference/native-apis/_hi_log.md new file mode 100644 index 0000000000..5e2e9c3a1a --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_hi_log.md @@ -0,0 +1,316 @@ +# HiLog + + +## **Overview** + +**Description:** + +HiLog模块实现日志打印功能。 + +开发者可以通过使用这些接口实现日志相关功能,输出日志时可以指定日志类型、所属业务领域、日志TAG标识、日志级别等。 + +\@syscap SystemCapability.HiviewDFX.HiLog + +**Since:** + +8 + + +## **Summary** + + +### Files + + | File Name | Description | +| -------- | -------- | +| [log.h](log_8h.md) | HiLog模块日志接口定义,通过这些接口实现日志打印相关功能。 | + + +### Macros + + | Macro Name and Value | Description | +| -------- | -------- | +| LOG_DOMAIN   0 | 日志所对应的业务领域,用于标识业务的子系统、模块。 | +| LOG_TAG   NULL | 字符串常量,标识调用所在的类或者业务。 | +| OH_LOG_DEBUG(type, ...)   ((void)OH_LOG_Print((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | DEBUG级别写日志,宏封装接口。 | +| OH_LOG_INFO(type, ...)   ((void)OH_LOG_Print((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | INFO级别写日志,宏封装接口。 | +| OH_LOG_WARN(type, ...)   ((void)OH_LOG_Print((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | WARN级别写日志,宏封装接口。 | +| OH_LOG_ERROR(type, ...)   ((void)OH_LOG_Print((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | ERROR级别写日志,宏封装接口。 | +| OH_LOG_FATAL(type, ...)   ((void)HiLogPrint((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | FATAL级别写日志,宏封装接口。 | + + +### Enumerations + + | Enumeration Name | Description | +| -------- | -------- | +| LogType { LOG_APP = 0 } | 日志类型。 | +| LogLevel {   LOG_DEBUG = 3, LOG_INFO = 4, LOG_WARN = 5, LOG_ERROR = 6,   LOG_FATAL = 7 } | 日志级别。 | + + +### Functions + + | Function | Description | +| -------- | -------- | +| OH_LOG_Print (LogType type, LogLevel level, unsigned int domain, const char \*tag, const char \*fmt,...) __attribute__((__format__(os_log | int
写日志接口。 | +| OH_LOG_IsLoggable (unsigned int domain, const char \*tag, LogLevel level) | int bool
检查指定业务领域、TAG、级别的日志是否可以打印。 | + + +## **Details** + + +## **Macro Definition** + + +### LOG_DOMAIN + + +``` +#define LOG_DOMAIN 0 +``` + +**Description:** + +日志所对应的业务领域,用于标识业务的子系统、模块。 + +16进制整数,有效范围0x0~0xFFFF,超过自动截掉高位。 + + +### LOG_TAG + + +``` +#define LOG_TAG NULL +``` + +**Description:** + +字符串常量,标识调用所在的类或者业务。 + + +### OH_LOG_DEBUG + + +``` +#define OH_LOG_DEBUG( type, ... ) ((void)OH_LOG_Print((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) +``` + +**Description:** + +DEBUG级别写日志,宏封装接口。 + +使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| type | 日志类型,三方应用日志类型为[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1241690359110741,link:zh-cn_topic_0000001232471312.xml#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5](#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5)。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | + +**See also:** + +[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1236273882110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946) + + +### OH_LOG_ERROR + + +``` +#define OH_LOG_ERROR( type, ... ) ((void)OH_LOG_Print((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) +``` + +**Description:** + +ERROR级别写日志,宏封装接口。 + +使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| type | 日志类型,三方应用日志类型为[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1238901741110741,link:zh-cn_topic_0000001232471312.xml#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5](#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5)。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | + +**See also:** + +[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1115878060110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946) + + +### OH_LOG_FATAL + + +``` +#define OH_LOG_FATAL( type, ... ) ((void)HiLogPrint((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) +``` + +**Description:** + +FATAL级别写日志,宏封装接口。 + +使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| type | 日志类型,三方应用日志类型为LOG_APP。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | + +**See also:** + +[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1089905568110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946) + + +### OH_LOG_INFO + + +``` +#define OH_LOG_INFO( type, ... ) ((void)OH_LOG_Print((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) +``` + +**Description:** + +INFO级别写日志,宏封装接口。 + +使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| type | 日志类型,三方应用日志类型为LOG_APP。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | + +**See also:** + +[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref871872876110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946) + + +### OH_LOG_WARN + + +``` +#define OH_LOG_WARN( type, ... ) ((void)OH_LOG_Print((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) +``` + +**Description:** + +WARN级别写日志,宏封装接口。 + +使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| type | 日志类型,三方应用日志类型为LOG_APP。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | + +**See also:** + +[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1438124158110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946) + + +## **Enumeration Type** + + +### LogLevel + + +``` +enum LogLevel +``` + +**Description:** + +日志级别。 + +该枚举类型用于定义日志级别。各级别建议使用方式: DEBUG:比INFO级别更详细的流程记录,通过该级别的日志可以更详细地分析业务流程和定位分析问题。DEBUG级别的日志在正式发布版本中默认不会被打印,只有在调试版本或打开调试开关的情况下才会打印。 INFO:用来记录业务关键流程节点,可以还原业务的主要运行过程;用来记录非正常情况信息,但这些情况都是可以预期的(如无网络信号、登录失败等)。这些日志都应该由该业务内处于支配地位的模块来记录,避免在多个被调用的模块或低级函数中重复记录。 WARN:发生了较为严重的非预期情况,但是对用户影响不大,程序可以自动恢复或通过简单的操作就可以恢复的问题。 ERROR:程序或功能发生了错误,该错误会影响功能的正常运行或用户的正常使用,可以恢复但恢复代价较高,如重置数据等。 FATAL:重大致命异常,表明程序或功能即将崩溃,故障无法恢复。 + + | Enumerator | Description | +| -------- | -------- | +| LOG_DEBUG | DEBUG日志级别,使用OH_LOG_DEBUG接口打印 | +| LOG_INFO | INFO日志级别,使用OH_LOG_INFO接口打印 | +| LOG_WARN | WARN日志级别,使用OH_LOG_WARN接口打印 | +| LOG_ERROR | ERROR日志级别,使用OH_LOG_ERROR接口打印 | +| LOG_FATAL | FATAL日志级别,使用OH_LOG_FATAL接口打印 | + + +### LogType + + +``` +enum LogType +``` + +**Description:** + +日志类型。 + +该枚举类型用于定义应用开发者可以使用的日志类型。当前有应用日志LOG_APP。 + + | Enumerator | Description | +| -------- | -------- | +| LOG_APP | 应用日志 | + + +## **Function** + + +### OH_LOG_IsLoggable() + + +``` +int bool OH_LOG_IsLoggable (unsigned int domain, const char * tag, LogLevel level ) +``` + +**Description:** + +检查指定业务领域、TAG、级别的日志是否可以打印。 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| domain | 指定日志业务领域。 | +| tag | 指定日志TAG。 | +| level | 指定日志level。 | + +**Returns:** + +如果指定domain、tag、level日志可以打印则返回true;否则返回false。 + + +### OH_LOG_Print() + + +``` +int OH_LOG_Print (LogType type, LogLevel level, unsigned int domain, const char * tag, const char * fmt, ... ) +``` + +**Description:** + +写日志接口。 + +指定日志类型、日志级别、业务领域、TAG,按照类printf格式类型和隐私指示确定需要输出的变参。 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| type | 日志类型,三方应用日志类型为LOG_APP。 | +| level | 日志级别,日志级别包括LOG_DEBUG、LOG_INFO、LOG_WARN、LOG_ERROR、LOG_FATAL。 | +| domain | 日志业务领域,16进制整数,范围0x0~0xFFFF。 | +| tag | 日志TAG,字符串,标识调用所在的类或者业务。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | + +**Returns:** + +大于等于0表示成功;小于0表示失败。 diff --git a/zh-cn/application-dev/reference/native-apis/_native___bundle.md b/zh-cn/application-dev/reference/native-apis/_native___bundle.md new file mode 100644 index 0000000000..4322e5a5e9 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_native___bundle.md @@ -0,0 +1,61 @@ +# Native_Bundle + + +## **Overview** + +**Description:** + +Describes the Native Bundle. + +**Since:** + +9 + +**Version:** + +1.0 + + +## **Summary** + + +### Files + + | File Name | Description | +| -------- | -------- | +| [native_interface_bundle.h](native__interface__bundle_8h.md) | Declares the **Bundle**-specific function, including function for obtaining application ID. | + + +### Functions + + | Function | Description | +| -------- | -------- | +| OH_NativeBundle_GetAppIdByBundleName (const char \*bundleName) | char \*
Obtains the application ID based on the given bundle name. | + + +## **Details** + + +## **Function** + + +### OH_NativeBundle_GetAppIdByBundleName() + + +``` +char* OH_NativeBundle_GetAppIdByBundleName (const char * bundleName) +``` + +**Description:** + +Obtains the application ID based on the given bundle name. + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| bundleName | Indicates the bundle name of the application. | + +**Returns:** + +Returns the application ID pointer if successfully obtained and needs to be freed; returns nullptr otherwise. diff --git a/zh-cn/application-dev/reference/native-apis/_native_window.md b/zh-cn/application-dev/reference/native-apis/_native_window.md new file mode 100644 index 0000000000..7c5ae2c90a --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_native_window.md @@ -0,0 +1,339 @@ +# NativeWindow + + +## **Overview** + +**Description:** + +提供NativeWindow功能,主要用来和egl对接 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Since:** + +8 + +**Version:** + +1.0 + + +## **Summary** + + +### Files + + | File Name | Description | +| -------- | -------- | +| [external_window.h](external__window_8h.md) | 定义获取和使用NativeWindow的相关函数 | + + +### Functions + + | Function | Description | +| -------- | -------- | +| OH_NativeWindow_CreateNativeWindowFromSurface (void \*pSurface) | struct NativeWindow \*
创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例 | +| OH_NativeWindow_DestroyNativeWindow (struct NativeWindow \*window) | void
将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉 | +| OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void \*pSurfaceBuffer) | struct NativeWindowBuffer \*
创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例 | +| OH_NativeWindow_DestroyNativeWindowBuffer (struct NativeWindowBuffer \*buffer) | void
将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉 | +| OH_NativeWindow_NativeWindowRequestBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*\*buffer, int \*fenceFd) | int32_t
通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产 | +| OH_NativeWindow_NativeWindowFlushBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer, int fenceFd, Region region) | int32_t
通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费 | +| OH_NativeWindow_NativeWindowCancelBuffer (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer) | int32_t
通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请 | +| OH_NativeWindow_NativeWindowHandleOpt (struct NativeWindow \*window, int code,...) | int32_t
设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等 | +| OH_NativeWindow_GetBufferHandleFromNative (struct NativeWindowBuffer \*buffer) | BufferHandle \*
通过NativeWindowBuffer获取该buffer的BufferHandle指针 | +| OH_NativeWindow_NativeObjectReference (void \*obj) | int32_t
增加一个NativeObject的引用计数 | +| OH_NativeWindow_NativeObjectUnreference (void \*obj) | int32_t
减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉 | +| OH_NativeWindow_GetNativeObjectMagic (void \*obj) | int32_t
获取NativeObject的MagicId | + + +## **Details** + + +## **Function** + + +### OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer() + + +``` +struct NativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void * pSurfaceBuffer) +``` + +**Description:** + +创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| pSurfaceBuffer | 参数是一个指向生产者buffer的指针,类型为sptr<OHOS::SurfaceBuffer> | + +**Returns:** + +返回一个指针,指向NativeWindowBuffer的结构体实例 + + +### OH_NativeWindow_CreateNativeWindowFromSurface() + + +``` +struct NativeWindow* OH_NativeWindow_CreateNativeWindowFromSurface (void * pSurface) +``` + +**Description:** + +创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| pSurface | 参数是一个指向生产者ProduceSurface的指针,类型为sptr<OHOS::Surface> | + +**Returns:** + +返回一个指针,指向NativeWindow的结构体实例 + + +### OH_NativeWindow_DestroyNativeWindow() + + +``` +void OH_NativeWindow_DestroyNativeWindow (struct NativeWindow * window) +``` + +**Description:** + +将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| window | 参数是一个NativeWindow的结构体实例的指针 | + + +### OH_NativeWindow_DestroyNativeWindowBuffer() + + +``` +void OH_NativeWindow_DestroyNativeWindowBuffer (struct NativeWindowBuffer * buffer) +``` + +**Description:** + +将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | + + +### OH_NativeWindow_GetBufferHandleFromNative() + + +``` +BufferHandle* OH_NativeWindow_GetBufferHandleFromNative (struct NativeWindowBuffer * buffer) +``` + +**Description:** + +通过NativeWindowBuffer获取该buffer的BufferHandle指针 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | + +**Returns:** + +BufferHandle 返回一个指针,指向BufferHandle的结构体实例 + + +### OH_NativeWindow_GetNativeObjectMagic() + + +``` +int32_t OH_NativeWindow_GetNativeObjectMagic (void * obj) +``` + +**Description:** + +获取NativeObject的MagicId + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| obj | 参数是一个NativeWindow or NativeWindowBuffer的结构体实例的指针 | + +**Returns:** + +MagicId 返回值为魔鬼数字,每个NativeObject唯一 + + +### OH_NativeWindow_NativeObjectReference() + + +``` +int32_t OH_NativeWindow_NativeObjectReference (void * obj) +``` + +**Description:** + +增加一个NativeObject的引用计数 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| obj | 参数是一个NativeWindow or NativeWindowBuffer的结构体实例的指针 | + +**Returns:** + +GSError 返回值为错误码 + + +### OH_NativeWindow_NativeObjectUnreference() + + +``` +int32_t OH_NativeWindow_NativeObjectUnreference (void * obj) +``` + +**Description:** + +减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| obj | 参数是一个NativeWindow or NativeWindowBuffer的结构体实例的指针 | + +**Returns:** + +GSError + + +### OH_NativeWindow_NativeWindowCancelBuffer() + + +``` +int32_t OH_NativeWindow_NativeWindowCancelBuffer (struct NativeWindow * window, struct NativeWindowBuffer * buffer ) +``` + +**Description:** + +通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| window | 参数是一个NativeWindow的结构体实例的指针 | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | + +**Returns:** + +GSError 返回值为错误码 + + +### OH_NativeWindow_NativeWindowFlushBuffer() + + +``` +int32_t OH_NativeWindow_NativeWindowFlushBuffer (struct NativeWindow * window, struct NativeWindowBuffer * buffer, int fenceFd, Region region ) +``` + +**Description:** + +通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| window | 参数是一个NativeWindow的结构体实例的指针 | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | +| fenceFd | 参数是一个文件描述符句柄,用以同步时序 | +| region | 参数表示一块脏区域,该区域有内容更新 | + +**Returns:** + +GSError 返回值为错误码 + + +### OH_NativeWindow_NativeWindowHandleOpt() + + +``` +int32_t OH_NativeWindow_NativeWindowHandleOpt (struct NativeWindow * window, int code, ... ) +``` + +**Description:** + +设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| window | 参数是一个NativeWindow的结构体实例的指针 | +| code | 操作码 | + +**Returns:** + +GSError 返回值为错误码 + + +### OH_NativeWindow_NativeWindowRequestBuffer() + + +``` +int32_t OH_NativeWindow_NativeWindowRequestBuffer (struct NativeWindow * window, struct NativeWindowBuffer ** buffer, int * fenceFd ) +``` + +**Description:** + +通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产 + +\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| window | 参数是一个NativeWindow的结构体实例的指针 | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的二级指针 | +| fenceFd | 参数是一个文件描述符句柄 | + +**Returns:** + +GSError 返回值为错误码 diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___drawing___bitmap_format.md b/zh-cn/application-dev/reference/native-apis/_o_h___drawing___bitmap_format.md new file mode 100644 index 0000000000..bf5350217d --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___drawing___bitmap_format.md @@ -0,0 +1,61 @@ +# OH_Drawing_BitmapFormat + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +结构体用于描述位图像素的格式,包括颜色类型和透明度类型 + +**Since:** + +8 + +**Version:** + +1.0 + + +## **Summary** + + +### Public Attributes + + | Public Attribute Name | Description | +| -------- | -------- | +| colorFormat | | +| alphaFormat | | + + +## **Details** + + +## **Member Data** + + +### alphaFormat + + +``` +OH_Drawing_AlphaFormat OH_Drawing_BitmapFormat::alphaFormat +``` + +**Description:** + +描述位图像素的透明度分量 + + +### colorFormat + + +``` +OH_Drawing_ColorFormat OH_Drawing_BitmapFormat::colorFormat +``` + +**Description:** + +描述位图像素的存储格式 diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component.md new file mode 100644 index 0000000000..048ec09047 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component.md @@ -0,0 +1,575 @@ +# Native XComponent + + +## **Overview** + +**Description:** + +Describes the surface and touch event held by the ArkUI XComponent, which can be used for the EGL/OpenGLES and media data input and displayed on the ArkUI XComponent. + +**Since:** + +8 + +**Version:** + +1.0 + + +## **Summary** + + +### Files + + | File Name | Description | +| -------- | -------- | +| [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) | Declares APIs for accessing a Native XComponent. | + + +### Classes + + | Classe Name | Description | +| -------- | -------- | +| [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) | | +| [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) | | +| [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) | Registers the surface lifecycle and touch event callbacks. | + + +### Macros + + | Macro Name and Value | Description | +| -------- | -------- | +| **OH_NATIVE_XCOMPONENT_OBJ**   ("__NATIVE_XCOMPONENT_OBJ__") | | + + +### Typedefs + + | Typedef Name | Description | +| -------- | -------- | +| OH_NativeXComponent | typedef struct OH_NativeXComponent
Provides an encapsulated **OH_NativeXComponent** instance. | +| OH_NativeXComponent_Callback | typedef struct OH_NativeXComponent_Callback
Registers the surface lifecycle and touch event callbacks. | + + +### Enumerations + + | Enumeration Name | Description | +| -------- | -------- | +| { OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0, OH_NATIVEXCOMPONENT_RESULT_FAILED = -1, OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2 } | Enumerates the API access states. | +| OH_NativeXComponent_TouchEventType {   OH_NATIVEXCOMPONENT_DOWN = 0, OH_NATIVEXCOMPONENT_UP, OH_NATIVEXCOMPONENT_MOVE, OH_NATIVEXCOMPONENT_CANCEL,   OH_NATIVEXCOMPONENT_UNKNOWN } | | + + +### Functions + + | Function | Description | +| -------- | -------- | +| OH_NativeXComponent_GetXComponentId (OH_NativeXComponent \*component, char \*id, uint64_t \*size) | int32_t
Obtains the ID of the ArkUI XComponent. | +| OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent \*component, const void \*window, uint64_t \*width, uint64_t \*height) | int32_t
Obtains the size of the surface held by the ArkUI XComponent. | +| OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent \*component, const void \*window, double \*x, double \*y) | int32_t
Obtains the offset of the surface held by the ArkUI XComponent. | +| OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent \*component, const void \*window, OH_NativeXComponent_TouchEvent \*touchEvent) | int32_t
Obtains the touch event dispatched by the ArkUI XComponent. | +| OH_NativeXComponent_RegisterCallback (OH_NativeXComponent \*component, OH_NativeXComponent_Callback \*callback) | int32_t
Registers a callback for this **OH_NativeXComponent** instance. | + + +## **Details** + + +## **Typedef** + + +### OH_NativeXComponent + + +``` +typedef struct OH_NativeXComponent OH_NativeXComponent +``` + +**Description:** + +Provides an encapsulated **OH_NativeXComponent** instance. + + +### OH_NativeXComponent_Callback + + +``` +typedef struct OH_NativeXComponent_Callback OH_NativeXComponent_Callback +``` + +**Description:** + +Registers the surface lifecycle and touch event callbacks. + + +## **Enumeration Type** + + +### anonymous enum + + +``` +anonymous enum +``` + +**Description:** + +Enumerates the API access states. + + | Enumerator | Description | +| -------- | -------- | +| OH_NATIVEXCOMPONENT_RESULT_SUCCESS | Success result. | +| OH_NATIVEXCOMPONENT_RESULT_FAILED | Failed result. | +| OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER | Invalid parameters. | + + +### OH_NativeXComponent_TouchEventType + + +``` +enum OH_NativeXComponent_TouchEventType +``` + + | Enumerator | Description | +| -------- | -------- | +| OH_NATIVEXCOMPONENT_DOWN | Trigger a touch event when a finger is pressed. | +| OH_NATIVEXCOMPONENT_UP | Trigger a touch event when a finger is lifted. | +| OH_NATIVEXCOMPONENT_MOVE | Trigger a touch event when a finger moves on the screen in pressed state. | +| OH_NATIVEXCOMPONENT_CANCEL | Trigger an event when a touch event is canceled. | +| OH_NATIVEXCOMPONENT_UNKNOWN | Invalid touch type. | + + +## **Function** + + +### OH_NativeXComponent_GetTouchEvent() + + +``` +int32_t OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_TouchEvent * touchEvent ) +``` + +**Description:** + +Obtains the touch event dispatched by the ArkUI XComponent. + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| component | Indicates the pointer to this **OH_NativeXComponent** instance. | +| window | Indicates the native window handler. | +| touchEvent | Indicates the pointer to the current touch event. | + +**Returns:** + +Returns the status code of the execution. + + +### OH_NativeXComponent_GetXComponentId() + + +``` +int32_t OH_NativeXComponent_GetXComponentId (OH_NativeXComponent * component, char * id, uint64_t * size ) +``` + +**Description:** + +Obtains the ID of the ArkUI XComponent. + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| component | Indicates the pointer to this **OH_NativeXComponent** instance. | +| id | Indicates the char buffer to keep the ID of this **OH_NativeXComponent** instance. Note that a null-terminator will be appended to the char buffer, so the size of the char buffer should be at least as large as the size of the real id length plus 1. It is recommended that the size of the char buffer be [OH_XCOMPONENT_ID_LEN_MAX + 1]. | +| size | Indicates the pointer to the length of **id**, which you can set and receive. | + +**Returns:** + +Returns the status code of the execution. + + +### OH_NativeXComponent_GetXComponentOffset() + + +``` +int32_t OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent * component, const void * window, double * x, double * y ) +``` + +**Description:** + +Obtains the offset of the surface held by the ArkUI XComponent. + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| component | Indicates the pointer to this **OH_NativeXComponent** instance. | +| window | Indicates the native window handler. | +| x | Indicates the pointer to the x coordinate of the current surface. | +| y | Indicates the pointer to the y coordinate of the current surface. | + +**Returns:** + +Returns the status code of the execution. + + +### OH_NativeXComponent_GetXComponentSize() + + +``` +int32_t OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent * component, const void * window, uint64_t * width, uint64_t * height ) +``` + +**Description:** + +Obtains the size of the surface held by the ArkUI XComponent. + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| component | Indicates the pointer to this **OH_NativeXComponent** instance. | +| window | Indicates the native window handler. | +| width | Indicates the pointer to the width of the current surface. | +| height | Indicates the pointer to the height of the current surface. | + +**Returns:** + +Returns the status code of the execution. + + +### OH_NativeXComponent_RegisterCallback() + + +``` +int32_t OH_NativeXComponent_RegisterCallback (OH_NativeXComponent * component, OH_NativeXComponent_Callback * callback ) +``` + +**Description:** + +Registers a callback for this **OH_NativeXComponent** instance. + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| component | Indicates the pointer to this **OH_NativeXComponent** instance. | +| callback | Indicates the pointer to a surface lifecycle and touch event callback. | + +**Returns:** + +Returns the status code of the execution. + + +## **Variable** + + +### deviceId + + +``` +int64_t OH_NativeXComponent_TouchEvent::deviceId = 0 +``` + +**Description:** + +ID of the device where the current touch event is generated. + + +### DispatchTouchEvent + + +``` +void(* OH_NativeXComponent_Callback::DispatchTouchEvent) (OH_NativeXComponent *component, void *window) +``` + +**Description:** + +Called when a touch event is triggered. + + +### force [1/2] + + +``` +float OH_NativeXComponent_TouchPoint::force = 0.0 +``` + +**Description:** + +Pressure of the current touch event. + + +### force [2/2] + + +``` +float OH_NativeXComponent_TouchEvent::force = 0.0 +``` + +**Description:** + +Pressure of the current touch event. + + +### id [1/2] + + +``` +int32_t OH_NativeXComponent_TouchPoint::id = 0 +``` + +**Description:** + +Unique identifier of a finger. + + +### id [2/2] + + +``` +int32_t OH_NativeXComponent_TouchEvent::id = 0 +``` + +**Description:** + +Unique identifier of a finger. + + +### isPressed + + +``` +bool OH_NativeXComponent_TouchPoint::isPressed = false +``` + +**Description:** + +Whether the current point is pressed. + + +### numPoints + + +``` +uint32_t OH_NativeXComponent_TouchEvent::numPoints = 0 +``` + +**Description:** + +Number of current touch points. + + +### OnSurfaceChanged + + +``` +void(* OH_NativeXComponent_Callback::OnSurfaceChanged) (OH_NativeXComponent *component, void *window) +``` + +**Description:** + +Called when the surface is changed. This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. + + +### OnSurfaceCreated + + +``` +void(* OH_NativeXComponent_Callback::OnSurfaceCreated) (OH_NativeXComponent *component, void *window) +``` + +**Description:** + +Called when the surface is created. + + +### OnSurfaceDestroyed + + +``` +void(* OH_NativeXComponent_Callback::OnSurfaceDestroyed) (OH_NativeXComponent *component, void *window) +``` + +**Description:** + +Called when the surface is destroyed. + + +### screenX [1/2] + + +``` +float OH_NativeXComponent_TouchPoint::screenX = 0.0 +``` + +**Description:** + +X coordinate of the touch point relative to the left edge of the screen. + + +### screenX [2/2] + + +``` +float OH_NativeXComponent_TouchEvent::screenX = 0.0 +``` + +**Description:** + +X coordinate of the touch point relative to the left edge of the screen. + + +### screenY [1/2] + + +``` +float OH_NativeXComponent_TouchPoint::screenY = 0.0 +``` + +**Description:** + +Y coordinate of the touch point relative to the upper edge of the screen. + + +### screenY [2/2] + + +``` +float OH_NativeXComponent_TouchEvent::screenY = 0.0 +``` + +**Description:** + +Y coordinate of the touch point relative to the upper edge of the screen. + + +### size [1/2] + + +``` +double OH_NativeXComponent_TouchPoint::size = 0.0 +``` + +**Description:** + +Contact area between the finger pad and the screen. + + +### size [2/2] + + +``` +double OH_NativeXComponent_TouchEvent::size = 0.0 +``` + +**Description:** + +Contact area between the finger pad and the screen. + + +### timeStamp [1/2] + + +``` +long long OH_NativeXComponent_TouchPoint::timeStamp = 0 +``` + +**Description:** + +Timestamp of the current touch event. + + +### timeStamp [2/2] + + +``` +long long OH_NativeXComponent_TouchEvent::timeStamp = 0 +``` + +**Description:** + +Timestamp of the current touch event. + + +### touchPoints + + +``` +OH_NativeXComponent_TouchPoint OH_NativeXComponent_TouchEvent::touchPoints[OH_MAX_TOUCH_POINTS_NUMBER] +``` + +**Description:** + +Array of the current touch points. + + +### type [1/2] + + +``` +OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchPoint::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN +``` + +**Description:** + +Touch type of the touch event. + + +### type [2/2] + + +``` +OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchEvent::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN +``` + +**Description:** + +Touch type of the touch event. + + +### x [1/2] + + +``` +float OH_NativeXComponent_TouchPoint::x = 0.0 +``` + +**Description:** + +X coordinate of the touch point relative to the left edge of the element to touch. + + +### x [2/2] + + +``` +float OH_NativeXComponent_TouchEvent::x = 0.0 +``` + +**Description:** + +X coordinate of the touch point relative to the left edge of the element to touch. + + +### y [1/2] + + +``` +float OH_NativeXComponent_TouchPoint::y = 0.0 +``` + +**Description:** + +Y coordinate of the touch point relative to the upper edge of the element to touch. + + +### y [2/2] + + +``` +float OH_NativeXComponent_TouchEvent::y = 0.0 +``` + +**Description:** + +Y coordinate of the touch point relative to the upper edge of the element to touch. diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___callback.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___callback.md new file mode 100644 index 0000000000..68aeeadfd5 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___callback.md @@ -0,0 +1,29 @@ +# OH_NativeXComponent_Callback + + +## **Overview** + +**Related Modules:** + +[Native XComponent](_o_h___native_x_component.md) + +**Description:** + +Registers the surface lifecycle and touch event callbacks. + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Public Attributes + + | Public Attribute Name | Description | +| -------- | -------- | +| [OnSurfaceCreated](_o_h___native_x_component.md#ga8beefd4b2359680a3106b28227e47d00) )([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) \*component, void \*window) | | +| [OnSurfaceChanged](_o_h___native_x_component.md#ga7d84244e13477d91cfdade8d9ff8565b) )([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) \*component, void \*window) | | +| [OnSurfaceDestroyed](_o_h___native_x_component.md#gad32bd08c749422d807ac87c558af6a44) )([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) \*component, void \*window) | | +| [DispatchTouchEvent](_o_h___native_x_component.md#ga3d40ca63aba381a63435f71f679e1f26) )([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) \*component, void \*window) | | diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___touch_event.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___touch_event.md new file mode 100644 index 0000000000..2abae7c057 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___touch_event.md @@ -0,0 +1,29 @@ +# OH_NativeXComponent_TouchEvent + + +## **Overview** + +**Related Modules:** + +[Native XComponent](_o_h___native_x_component.md) + + +## **Summary** + + +### Public Attributes + + | Public Attribute Name | Description | +| -------- | -------- | +| [id](_o_h___native_x_component.md#gac986c10f386a0b55bd813caec06fe190) = 0 | | +| [screenX](_o_h___native_x_component.md#ga68fe9ff656e74ae14254523443d85bb1) = 0.0 | | +| [screenY](_o_h___native_x_component.md#ga7696e0e1a81787400e187058a1e332f2) = 0.0 | | +| [x](_o_h___native_x_component.md#ga9688a76d25bede284e36b7226ec8ad3a) = 0.0 | | +| [y](_o_h___native_x_component.md#ga0136d85dae638fbe9baaa69cf67a9833) = 0.0 | | +| [type](_o_h___native_x_component.md#ga22f67143e6acdefa5c7fd4ba23f7c2b6) = [OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182aff39d23c1412b3b110a19df4893651d3) | | +| [size](_o_h___native_x_component.md#ga723601b60610b546fbdaf29e87575ca2) = 0.0 | | +| [force](_o_h___native_x_component.md#ga7c0a450a47231bd55994a970b3750d3f) = 0.0 | | +| [deviceId](_o_h___native_x_component.md#ga00660bb31b05cebe8964ba221c24f966) = 0 | | +| [timeStamp](_o_h___native_x_component.md#gadd872bda25d5af9327d12d06a70149fd) = 0 | | +| [touchPoints](_o_h___native_x_component.md#gab3514bf8d2fa3de8191d4898ee739053) [OH_MAX_TOUCH_POINTS_NUMBER] | | +| [numPoints](_o_h___native_x_component.md#gad8c19c6c2bbb367fa18fffa813e21cc6) = 0 | | diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___touch_point.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___touch_point.md new file mode 100644 index 0000000000..221780a1d3 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___touch_point.md @@ -0,0 +1,27 @@ +# OH_NativeXComponent_TouchPoint + + +## **Overview** + +**Related Modules:** + +[Native XComponent](_o_h___native_x_component.md) + + +## **Summary** + + +### Public Attributes + + | Public Attribute Name | Description | +| -------- | -------- | +| [id](_o_h___native_x_component.md#gafc435f3e8b5acf462b28bae69180d971) = 0 | | +| [screenX](_o_h___native_x_component.md#gae96f097ddffb119b824bcd9f59857ea4) = 0.0 | | +| [screenY](_o_h___native_x_component.md#ga8fb126875104358f84e17ddd66dbbf60) = 0.0 | | +| [x](_o_h___native_x_component.md#ga04e0e65a35a652d86460c82bf0ca02e3) = 0.0 | | +| [y](_o_h___native_x_component.md#ga13d254769a362f049243505e84df8fa4) = 0.0 | | +| [type](_o_h___native_x_component.md#gac2b852641112bce8de71f080a21a118a) = [OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182aff39d23c1412b3b110a19df4893651d3) | | +| [size](_o_h___native_x_component.md#ga9e5a0e118ab61a889126a985be7947dd) = 0.0 | | +| [force](_o_h___native_x_component.md#gaf3d4f92022552678d5d81d2396900595) = 0.0 | | +| [timeStamp](_o_h___native_x_component.md#gad090e826a0e33a4054f468109a5a729d) = 0 | | +| [isPressed](_o_h___native_x_component.md#ga527c92deb88977ae842ffe6fee50d571) = false | | diff --git a/zh-cn/application-dev/reference/native-apis/_raw_file_descriptor.md b/zh-cn/application-dev/reference/native-apis/_raw_file_descriptor.md new file mode 100644 index 0000000000..2b4212c485 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_raw_file_descriptor.md @@ -0,0 +1,76 @@ +# RawFileDescriptor + + +## **Overview** + +**Related Modules:** + +[Rawfile](rawfile.md) + +**Description:** + +提供rawfile文件描述符信息 + +RawFileDescriptor是[OH_ResourceManager_GetRawFileDescriptor](rawfile.md#ga8313a7d4bb361a98ced485346a9be4b1)的输出参数, 涵盖了rawfile文件的文件描述符以及在HAP包中的起始位置和长度。 + +**Since:** + +8 + +**Version:** + +1.0 + + +## **Summary** + + +### Public Attributes + + | Public Attribute Name | Description | +| -------- | -------- | +| fd | | +| start | | +| length | | + + +## **Details** + + +## **Member Data** + + +### fd + + +``` +int RawFileDescriptor::fd +``` + +**Description:** + +rawfile文件描述符 + + +### length + + +``` +long RawFileDescriptor::length +``` + +**Description:** + +rawfile在HAP包中的长度 + + +### start + + +``` +long RawFileDescriptor::start +``` + +**Description:** + +rawfile在HAP包中的起始位置 diff --git a/zh-cn/application-dev/reference/native-apis/annotated.md b/zh-cn/application-dev/reference/native-apis/annotated.md new file mode 100644 index 0000000000..b4b83d5bb7 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/annotated.md @@ -0,0 +1,13 @@ +# 结构体 + + + +- **[OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)** + +- **[OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)** + +- **[OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md)** + +- **[OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md)** + +- **[RawFileDescriptor](_raw_file_descriptor.md)** \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md new file mode 100644 index 0000000000..e16944b2b8 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md @@ -0,0 +1,38 @@ +# drawing_bitmap.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +文件中定义了与位图相关的功能函数 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Classes + + | Classe Name | Description | +| -------- | -------- | +| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 | + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_Drawing_BitmapCreate](_drawing.md#gac2d33ba4b18e71eca8c41c136004ba48) (void) | [OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb) \*
函数用于创建一个位图对象。 | +| [OH_Drawing_BitmapDestroy](_drawing.md#ga5c31becccf1d3ad5df5f6bc7d9007b8f) ([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb) \*) | void
函数用于销毁位图对象并回收该对象占有内存。 | +| [OH_Drawing_BitmapBuild](_drawing.md#ga699afe9c4d2665cdd21b5d9b6dfed2ec) ([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb) \*, const uint32_t width, const uint32_t height, const [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) \*) | void
函数用于初始化位图对象的宽度和高度,并且为该位图设置像素格式 | +| [OH_Drawing_BitmapGetWidth](_drawing.md#ga67b83650847ab1f6e79ca122905d55a3) ([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb) \*) | uint32_t
该函数用于获取指定位图的宽度 | +| [OH_Drawing_BitmapGetHeight](_drawing.md#gace471d69bec5b152bd4de5fa8504f7fd) ([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb) \*) | uint32_t
函数用于获取指定位图的高度 | +| [OH_Drawing_BitmapGetPixels](_drawing.md#gaf007f52cfbcbc63cd02971c6480c55fb) ([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb) \*) | void \*
函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据 | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__brush_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__brush_8h.md new file mode 100644 index 0000000000..6d656d795c --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__brush_8h.md @@ -0,0 +1,31 @@ +# drawing_brush.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +文件中定义了与画刷相关的功能函数 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_Drawing_BrushCreate](_drawing.md#ga75e2193d23cf75878c7b2c78d6b23b35) (void) | [OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711) \*
函数用于创建一个画刷对象 | +| [OH_Drawing_BrushDestroy](_drawing.md#ga9dc1d4aa465d06f2d847feddae1558b5) ([OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711) \*) | void
函数用于销毁画刷对象并回收该对象占有的内存。 | +| [OH_Drawing_BrushIsAntiAlias](_drawing.md#ga4c861e23b8c0a3fb84d906d81bea5335) (const [OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711) \*) | bool
函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| [OH_Drawing_BrushSetAntiAlias](_drawing.md#ga41735fc7a2776fbe41c77b3f4637e1c5) ([OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711) \*, bool) | void
函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| [OH_Drawing_BrushGetColor](_drawing.md#ga29dc1e2442cea7e958a5e037c4cc9f59) (const [OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711) \*) | uint32_t
函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 | +| [OH_Drawing_BrushSetColor](_drawing.md#ga4b62aa574623c1a75e14f612a831531b) ([OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711) \*, uint32_t color) | void
函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__canvas_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__canvas_8h.md new file mode 100644 index 0000000000..1e68afc0eb --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__canvas_8h.md @@ -0,0 +1,37 @@ +# drawing_canvas.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +文件中定义了与画布相关的功能函数 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_Drawing_CanvasCreate](_drawing.md#ga1bfe881a0b018a982678906f3522d4df) (void) | [OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*
函数用于创建一个画布对象 | +| [OH_Drawing_CanvasDestroy](_drawing.md#ga1a3023ccc48a381cc0b4ae09e2d85c38) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*) | void
函数用于销毁画布对象并回收该对象占有的内存 | +| [OH_Drawing_CanvasBind](_drawing.md#ga666595bb182a5e31733f4144c1515cae) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*, [OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb) \*) | void
函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染) | +| [OH_Drawing_CanvasAttachPen](_drawing.md#gaaec6db563bd7153dc95d0bfab71a4ed1) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*, const [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*) | void
函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓 | +| [OH_Drawing_CanvasDetachPen](_drawing.md#ga79321b669f2b5dc0460ca929f00dfc47) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*) | void
函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓 | +| [OH_Drawing_CanvasAttachBrush](_drawing.md#ga1b238c829ea5f2ff627766a3e50feaa6) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*, const [OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711) \*) | void
函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状 | +| [OH_Drawing_CanvasDetachBrush](_drawing.md#ga7a6b5e56d2492b5641b8b3f634b096fe) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*) | void
函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状 | +| [OH_Drawing_CanvasSave](_drawing.md#ga4ebc55405e00ad4b8609303fefc6997a) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*) | void
函数用于保存当前画布的状态(画布矩阵)到一个栈顶 | +| [OH_Drawing_CanvasRestore](_drawing.md#gadd632be64ccc2601def753ecc1e53944) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*) | void
函数用于恢复保存在栈顶的画布状态(画布矩阵) | +| [OH_Drawing_CanvasDrawLine](_drawing.md#gadf6bae5efd20587612596f8e78a16144) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*, float x1, float y1, float x2, float y2) | void
函数用于画一条直线段 | +| [OH_Drawing_CanvasDrawPath](_drawing.md#ga99ebc73abdc27599f4bcc1c1045cb75e) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*, const [OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*) | void
函数用于画一个自定义路径 | +| [OH_Drawing_CanvasClear](_drawing.md#ga7f07cc6f0b223d9b343c133fbb2503f6) ([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*, uint32_t color) | void
函数用于使用指定颜色去清空画布 | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__color_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__color_8h.md new file mode 100644 index 0000000000..5f156e5927 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__color_8h.md @@ -0,0 +1,26 @@ +# drawing_color.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +文件中定义了与颜色相关的功能函数 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_Drawing_ColorSetArgb](_drawing.md#ga9137935b970e49ffd813157ebd8bbfb7) (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | uint32_t
函数用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量 | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__font__collection_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__font__collection_8h.md new file mode 100644 index 0000000000..111f5d88e9 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__font__collection_8h.md @@ -0,0 +1,27 @@ +# drawing_font_collection.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +定义绘制模块中与fontCollection相关的函数 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_Drawing_CreateFontCollection](_drawing.md#gab54c68359a650cde36b82f021f06c814) (void) | [OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7) \*
创建OH_Drawing_FontCollection | +| [OH_Drawing_DestroyFontCollection](_drawing.md#ga4791ce4ddfaa3545a797c2ce144c819d) ([OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7) \*) | void
释放被OH_Drawing_FontCollection对象占据的内存 | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__path_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__path_8h.md new file mode 100644 index 0000000000..7f2639ed4d --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__path_8h.md @@ -0,0 +1,34 @@ +# drawing_path.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +文件中定义了与自定义路径相关的功能函数 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_Drawing_PathCreate](_drawing.md#ga379fcebc6b43c3b90e0933d928d7c890) (void) | [OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*
函数用于创建一个路径对象 | +| [OH_Drawing_PathDestroy](_drawing.md#gaa5961e76fd8d2aacdd1fe94ad354ba51) ([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*) | void
函数用于销毁路径对象并回收该对象占有的内存 | +| [OH_Drawing_PathMoveTo](_drawing.md#ga3934f53ce94644feaa79fb96bc7fbcc9) ([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*, float x, float y) | void
函数用于设置自定义路径的起始点位置 | +| [OH_Drawing_PathLineTo](_drawing.md#ga4da6ed28d5db091be54af8efe661eb18) ([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*, float x, float y) | void
函数用于添加一条从路径的最后点位置到目标点位置的线段 | +| [OH_Drawing_PathArcTo](_drawing.md#ga33c44796dfe8050dad3e6306f66ba0d3) ([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg) | void
函数用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段 | +| [OH_Drawing_PathQuadTo](_drawing.md#ga5f69a50c045822c5d5d4896bc120318b) ([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*, float ctrlX, float ctrlY, float endX, float endY) | void
函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线 | +| [OH_Drawing_PathCubicTo](_drawing.md#ga6a84a20af7911dc504696402c357f1be) ([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY) | void
函数用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线 | +| [OH_Drawing_PathClose](_drawing.md#ga7a3be11857364cdf2e6ca1af70917816) ([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*) | void
函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段 | +| [OH_Drawing_PathReset](_drawing.md#gaf907c525b05dbd1355d16dc13b4ccda9) ([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) \*) | void
函数用于重置自定义路径数据 | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__pen_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__pen_8h.md new file mode 100644 index 0000000000..2174b6e957 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__pen_8h.md @@ -0,0 +1,47 @@ +# drawing_pen.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +文件中定义了与画笔相关的功能函数 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Enumerations + + | Enumeration Name | Description | +| -------- | -------- | +| [OH_Drawing_PenLineCapStyle](_drawing.md#gafa9d815d933e0fd6aa7549d12080fa8f) { [LINE_FLAT_CAP](_drawing.md#ggafa9d815d933e0fd6aa7549d12080fa8fa99c48cc6172088f1a86e8688e347933a), [LINE_SQUARE_CAP](_drawing.md#ggafa9d815d933e0fd6aa7549d12080fa8fac9929c30114c046b75b844e459f1e69f), [LINE_ROUND_CAP](_drawing.md#ggafa9d815d933e0fd6aa7549d12080fa8fa0efe3fb7b56d7407737c42aebe5b91e5) } | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式 | +| [OH_Drawing_PenLineJoinStyle](_drawing.md#gad10001f23f6c42f97a392cba30011460) { [LINE_MITER_JOIN](_drawing.md#ggad10001f23f6c42f97a392cba30011460a126e5fbae0f63b8431d3a6763035d488), [LINE_ROUND_JOIN](_drawing.md#ggad10001f23f6c42f97a392cba30011460aa2bfcc7c744ab7a56c047942060ad3ba), [LINE_BEVEL_JOIN](_drawing.md#ggad10001f23f6c42f97a392cba30011460a8ad7df33f8ff73c5c080fcf159631fde) } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式 | + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_Drawing_PenCreate](_drawing.md#gae52fe4132b90726d813661750948e2dd) (void) | [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*
函数用于创建一个画笔对象 | +| [OH_Drawing_PenDestroy](_drawing.md#ga907538d02a50836e8033a3f7bf12c80e) ([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*) | void
函数用于销毁画笔对象并回收该对象占有的内存 | +| [OH_Drawing_PenIsAntiAlias](_drawing.md#ga31dee499a3d1dd81e526bcc1dd620961) (const [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*) | bool
函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| [OH_Drawing_PenSetAntiAlias](_drawing.md#ga93dbc44cf424038a17ae311920550283) ([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*, bool) | void
函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| [OH_Drawing_PenGetColor](_drawing.md#ga8a8db886ecf41a729e40a1f760338220) (const [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*) | uint32_t
函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 | +| [OH_Drawing_PenSetColor](_drawing.md#ga6e5b065f521dd9c41d5e7f2af5c379cb) ([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*, uint32_t color) | void
函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 | +| [OH_Drawing_PenGetWidth](_drawing.md#ga3d898184f61b685d724e6d272fb12168) (const [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*) | float
函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 | +| [OH_Drawing_PenSetWidth](_drawing.md#ga562b5102bf599e640a94e104480df0f4) ([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*, float width) | void
函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 | +| [OH_Drawing_PenGetMiterLimit](_drawing.md#ga8f8a512b3930d8883dff59916eaaa72a) (const [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*) | float
函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 | +| [OH_Drawing_PenSetMiterLimit](_drawing.md#ga73a96e3e9ca95a82f0de2076cb03ffba) ([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*, float miter) | void
函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 | +| [OH_Drawing_PenGetCap](_drawing.md#ga7db0d5ac28ac24db29fc49c113affc32) (const [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*) | [OH_Drawing_PenLineCapStyle](_drawing.md#gafa9d815d933e0fd6aa7549d12080fa8f)
函数用于获取画笔笔帽的样式 | +| [OH_Drawing_PenSetCap](_drawing.md#gaa0d8f5e75ec5fbc776c4e5e780e29af3) ([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*, [OH_Drawing_PenLineCapStyle](_drawing.md#gafa9d815d933e0fd6aa7549d12080fa8f)) | void
函数用于设置画笔笔帽样式 | +| [OH_Drawing_PenGetJoin](_drawing.md#ga35b26a60ebf70c207f1e8fb8659a9103) (const [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*) | [OH_Drawing_PenLineJoinStyle](_drawing.md#gad10001f23f6c42f97a392cba30011460)
函数用于获取画笔绘制折线转角的样式 | +| [OH_Drawing_PenSetJoin](_drawing.md#ga65e9826c39a847b22825e99af65afbb7) ([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) \*, [OH_Drawing_PenLineJoinStyle](_drawing.md#gad10001f23f6c42f97a392cba30011460)) | void
函数用于设置画笔绘制转角的样式 | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__text__declaration_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__text__declaration_8h.md new file mode 100644 index 0000000000..873019b493 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__text__declaration_8h.md @@ -0,0 +1,30 @@ +# drawing_text_declaration.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +提供2d drawing文本相关的数据结构声明 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Typedefs + + | Typedef Name | Description | +| -------- | -------- | +| [OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7) | typedef struct [OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7)
OH_Drawing_FontCollection用于加载字体 | +| [OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007) | typedef struct [OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007)
OH_Drawing_Typography用于管理排版的布局和显示等 | +| [OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) | typedef struct [OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)
OH_Drawing_TextStyle用于管理字体颜色、装饰等 | +| [OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9) | typedef struct [OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9)
OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等 | +| [OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9) | typedef struct [OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9)
OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography. | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__text__typography_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__text__typography_8h.md new file mode 100644 index 0000000000..193e657f5d --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__text__typography_8h.md @@ -0,0 +1,63 @@ +# drawing_text_typography.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +定义绘制模块中排版相关的函数 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Enumerations + + | Enumeration Name | Description | +| -------- | -------- | +| [OH_Drawing_TextDirection](_drawing.md#ga7dc9803407c3fea32075122c7605ffb2) { [TEXT_DIRECTION_RTL](_drawing.md#gga7dc9803407c3fea32075122c7605ffb2a7b4debd0a116bc438085a43efa3824cf), [TEXT_DIRECTION_LTR](_drawing.md#gga7dc9803407c3fea32075122c7605ffb2a81d702a35ec4d3482ea5ff10edd8cab7) } | 文字方向 | +| [OH_Drawing_TextAlign](_drawing.md#ga3fee1a3916c2376e62e7957be15a1b02) {   [TEXT_ALIGN_LEFT](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a3b85bc4d8cfda6b273b534eb2e1cebfc), [TEXT_ALIGN_RIGHT](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02abc81ce8623a972fc7b97f497189c494b), [TEXT_ALIGN_CENTER](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a4da3c85cde615e7442df8ef17d0753ba), [TEXT_ALIGN_JUSTIFY](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a3e3185762a0ae703ae1eab769eb3191d),   [TEXT_ALIGN_START](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a72f2441e221a61374bd891dc2b75bcb0), [TEXT_ALIGN_END](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a17b99fff762deffd75c0de66cd27d219) } | 文字对齐方式 | +| [OH_Drawing_FontWeight](_drawing.md#ga7a1d4dd0ce9dd97bf3bbbad3b87f7f21) {   [FONT_WEIGHT_100](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a23b26a36963095342fe2e0697910a6e6), [FONT_WEIGHT_200](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a4f29ce93f64a0085ca2154ee25d9e138), [FONT_WEIGHT_300](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a093d1106fec67eebea0dbcb2ebbe9a64), [FONT_WEIGHT_400](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a62367da70683540c34ddaf2a519f22a3),   [FONT_WEIGHT_500](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21aef238378a2c00c698e269b052d31d904), [FONT_WEIGHT_600](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a63eebceda71bb1ffdae4a5503d63bbd9), [FONT_WEIGHT_700](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21ae6abaa1dc57d487006cbe6c8e0f87bc6), [FONT_WEIGHT_800](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21ad34b21ce514a03d6d98b75341bb5726e),   [FONT_WEIGHT_900](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21ac3f4c8f2d6a6922780166cc08df83461) } | 字重 | +| [OH_Drawing_TextBaseline](_drawing.md#ga23be0106a439e7498cbbb1d048733ec5) { [TEXT_BASELINE_ALPHABETIC](_drawing.md#gga23be0106a439e7498cbbb1d048733ec5ad436b9da96a5246e75e785a0585963f9), [TEXT_BASELINE_IDEOGRAPHIC](_drawing.md#gga23be0106a439e7498cbbb1d048733ec5a723ba0ba56cd7106deb97c95f51febcf) } | 基线位置 | +| [OH_Drawing_TextDecoration](_drawing.md#ga11b405dddb93d91c3a5b4482d8a9165b) { [TEXT_DECORATION_NONE](_drawing.md#gga11b405dddb93d91c3a5b4482d8a9165ba2b42614c2c9b73ffecf31769cfd60f28) = 0x0, [TEXT_DECORATION_UNDERLINE](_drawing.md#gga11b405dddb93d91c3a5b4482d8a9165ba0fc17108b6c8a91d840889336c669dda) = 0x1, [TEXT_DECORATION_OVERLINE](_drawing.md#gga11b405dddb93d91c3a5b4482d8a9165bad8415c121f9b656cd5c6cab927d78802) = 0x2, [TEXT_DECORATION_LINE_THROUGH](_drawing.md#gga11b405dddb93d91c3a5b4482d8a9165ba25692d42e0a907af878d99a0a31f7f47) = 0x4 } | 文本装饰 | +| [OH_Drawing_FontStyle](_drawing.md#ga9cd0177d2561ccef51adbae0f8a42eec) { [FONT_STYLE_NORMAL](_drawing.md#gga9cd0177d2561ccef51adbae0f8a42eeca307e676fb5de5c785e856272b2f0e8ce), [FONT_STYLE_ITALIC](_drawing.md#gga9cd0177d2561ccef51adbae0f8a42eeca6054e24016c46486668dd42e4b86c036) } | 区分字体是否为斜体 | + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_Drawing_CreateTypographyStyle](_drawing.md#ga19561093a2d5ec17f2c73b40f0d97376) (void) | [OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9) \*
创建OH_Drawing_TypographyStyle | +| [OH_Drawing_DestroyTypographyStyle](_drawing.md#ga9bd838c0d86136e16faca0ada643d87e) ([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9) \*) | void
释放被OH_Drawing_TypographyStyle对象占据的内存 | +| [OH_Drawing_SetTypographyTextDirection](_drawing.md#ga9e96b89ffc3f06f50ab38f05689e766e) ([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9) \*, int) | void
设置文本方向 | +| [OH_Drawing_SetTypographyTextAlign](_drawing.md#gaa1a8b20a882ae6aa4e2ad442a18423da) ([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9) \*, int) | void
设置文本对齐方式 | +| [OH_Drawing_SetTypographyTextMaxLines](_drawing.md#gab74fd8ef23005bf584f87357147fa379) ([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9) \*, int) | void
设置文本最大行数 | +| [OH_Drawing_CreateTextStyle](_drawing.md#ga9041c35231647ed34306ef26f21037f9) (void) | [OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*
创建OH_Drawing_TextStyle | +| [OH_Drawing_DestroyTextStyle](_drawing.md#ga2550946ac8d3c8c9ddc548e128175020) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*) | void
释放被OH_Drawing_TextStyle对象占据的内存 | +| [OH_Drawing_SetTextStyleColor](_drawing.md#ga4c03826dd970defade08b67ed1861fc8) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, uint32_t) | void
设置文本颜色 | +| [OH_Drawing_SetTextStyleFontSize](_drawing.md#ga4f435be1d8b20bd0abac441ac91bb81d) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, double) | void
设置字号 | +| [OH_Drawing_SetTextStyleFontWeight](_drawing.md#ga751dd287f984367c18de6ca3a3a304ec) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, int) | void
设置字重 | +| [OH_Drawing_SetTextStyleBaseLine](_drawing.md#gacb93fa7c791e719cf9c5d218981f61ee) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, int) | void
设置字体基线位置 | +| [OH_Drawing_SetTextStyleDecoration](_drawing.md#ga2f029e23749fcd121aaae6e233202ded) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, int) | void
设置装饰 | +| [OH_Drawing_SetTextStyleDecorationColor](_drawing.md#ga22304942171ce4548b50057bd7d606be) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, uint32_t) | void
设置装饰颜色 | +| [OH_Drawing_SetTextStyleFontHeight](_drawing.md#gab96b5567c05f34e6ba7d48a4dd75eab4) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, double) | void
设置字体高度 | +| [OH_Drawing_SetTextStyleFontFamilies](_drawing.md#ga3f46d90176575f24040828264ce18a90) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, int, const char \*fontFamilies[]) | void
设置字体类型 | +| [OH_Drawing_SetTextStyleFontStyle](_drawing.md#ga67afa0910007fa3d8b15f2b6df61712c) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, int) | void
设置字体风格 | +| [OH_Drawing_SetTextStyleLocale](_drawing.md#ga7eb6f2da34059c013cfb0567c44813d4) ([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*, const char \*) | void
设置语言区域 | +| [OH_Drawing_CreateTypographyHandler](_drawing.md#gae72088abf73419c0c8e8e524602a317e) ([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9) \*, [OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7) \*) | [OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9) \*
创建指向OH_Drawing_TypographyCreate对象的指针 | +| [OH_Drawing_DestroyTypographyHandler](_drawing.md#ga211dced7f1eaed0c5bd507cd75d003c8) ([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9) \*) | void
释放被OH_Drawing_TypographyCreate对象占据的内存 | +| [OH_Drawing_TypographyHandlerPushStyle](_drawing.md#ga5aff793cec1b58c171817649b01f35d1) ([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9) \*, [OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) \*) | void
设置排版风格 | +| [OH_Drawing_TypographyHandlerAddText](_drawing.md#ga0bb4f9730faa77f6ed8cdce25e7965f2) ([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9) \*, const char \*) | void
设置文本内容 | +| [OH_Drawing_TypographyHandlerPop](_drawing.md#gabe9b81431e1a7ca473fc0659c150bb6b) ([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9) \*) | void
排版弹出 | +| [OH_Drawing_CreateTypography](_drawing.md#gaf996ac9db09b8d7c21b8ea4797ea0c19) ([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9) \*) | [OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007) \*
创建OH_Drawing_Typography | +| [OH_Drawing_DestroyTypography](_drawing.md#ga2d0d1b715931c104042c75e4d21a86a3) ([OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007) \*) | void
释放OH_Drawing_Typography对象占据的内存 | +| [OH_Drawing_TypographyLayout](_drawing.md#ga9032552c1d8d8e258f86832190223843) ([OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007) \*, double) | void
排版布局 | +| [OH_Drawing_TypographyPaint](_drawing.md#ga8b12b7dc251b3a2bb71f7e289a27e174) ([OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007) \*, [OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) \*, double, double) | void
显示文本 | diff --git a/zh-cn/application-dev/reference/native-apis/drawing__types_8h.md b/zh-cn/application-dev/reference/native-apis/drawing__types_8h.md new file mode 100644 index 0000000000..b17a49f042 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/drawing__types_8h.md @@ -0,0 +1,38 @@ +# drawing_types.h + + +## **Overview** + +**Related Modules:** + +[Drawing](_drawing.md) + +**Description:** + +文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Typedefs + + | Typedef Name | Description | +| -------- | -------- | +| [OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) | typedef struct [OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)
OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字 | +| [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) | typedef struct [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)
OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色 | +| [OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711) | typedef struct [OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711)
OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色 | +| [OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) | typedef struct [OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)
OH_Drawing_Path定义为路径,路径用于自定义各种形状 | +| [OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb) | typedef struct [OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb)
OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据 | + + +### Enumerations + + | Enumeration Name | Description | +| -------- | -------- | +| [OH_Drawing_ColorFormat](_drawing.md#ga6a37fff6c3e0b0d9d81b01755ef846db) {   [COLOR_FORMAT_UNKNOWN](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dbab58141bf00d632ba06094d3c4b6446c2), [COLOR_FORMAT_ALPHA_8](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dbabe54d848a7de45ac9a9a89a6eb6a1886), [COLOR_FORMAT_RGB_565](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dbabc7b2f524d90d876ad222dd595c287d9), [COLOR_FORMAT_ARGB_4444](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dba3dac16f10989bdacb479e7fcd9b8861e),   [COLOR_FORMAT_RGBA_8888](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dba3b1984f6b8b6fe5f5d65215c95e80ac2), [COLOR_FORMAT_BGRA_8888](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dba44017098e353684bc3bbd2cd0878df15) } | OH_Drawing_ColorFormat用于描述位图像素的存储格式 | +| [OH_Drawing_AlphaFormat](_drawing.md#gac4dc831be312bb0a7a4745448f4407d3) { [ALPHA_FORMAT_UNKNOWN](_drawing.md#ggac4dc831be312bb0a7a4745448f4407d3ac7e2536628ce62acfc14ec2538425a4a), [ALPHA_FORMAT_OPAQUE](_drawing.md#ggac4dc831be312bb0a7a4745448f4407d3abd3d60c5f30c90748393276a5845f662), [ALPHA_FORMAT_PREMUL](_drawing.md#ggac4dc831be312bb0a7a4745448f4407d3ac0ad416cd779ddc62466d6dceb9a757f), [ALPHA_FORMAT_UNPREMUL](_drawing.md#ggac4dc831be312bb0a7a4745448f4407d3a0b8120300ddca06e3d5db79bfad59a32) } | OH_Drawing_AlphaFormat用于描述位图像素的透明度分量 | diff --git a/zh-cn/application-dev/reference/native-apis/external__window_8h.md b/zh-cn/application-dev/reference/native-apis/external__window_8h.md new file mode 100644 index 0000000000..bbfe0b179a --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/external__window_8h.md @@ -0,0 +1,37 @@ +# external_window.h + + +## **Overview** + +**Related Modules:** + +[NativeWindow](_native_window.md) + +**Description:** + +定义获取和使用NativeWindow的相关函数 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_NativeWindow_CreateNativeWindowFromSurface](_native_window.md#ga4225dd025093bc610670c2b517f186c2) (void \*pSurface) | struct NativeWindow \*
创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例 | +| [OH_NativeWindow_DestroyNativeWindow](_native_window.md#ga1ca5f2e39a03b6546352ac90be19238d) (struct NativeWindow \*window) | void
将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉 | +| [OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer](_native_window.md#gaec1b04ace16a364d79b7d54cf917e6f5) (void \*pSurfaceBuffer) | struct NativeWindowBuffer \*
创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例 | +| [OH_NativeWindow_DestroyNativeWindowBuffer](_native_window.md#gafa11a7f9a36b2e6962cc34790eb1e87e) (struct NativeWindowBuffer \*buffer) | void
将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉 | +| [OH_NativeWindow_NativeWindowRequestBuffer](_native_window.md#ga80cad8d3c2863294f828caa4d3422c2c) (struct NativeWindow \*window, struct NativeWindowBuffer \*\*buffer, int \*fenceFd) | int32_t
通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产 | +| [OH_NativeWindow_NativeWindowFlushBuffer](_native_window.md#ga8489a6525b5c9f7a6b52aafba07fb777) (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer, int fenceFd, Region region) | int32_t
通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费 | +| [OH_NativeWindow_NativeWindowCancelBuffer](_native_window.md#gad7b6ffa8b402f5be0bf6e742b18f03d0) (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer) | int32_t
通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请 | +| [OH_NativeWindow_NativeWindowHandleOpt](_native_window.md#ga5620fba277d2f086da6c6d7434c09253) (struct NativeWindow \*window, int code,...) | int32_t
设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等 | +| [OH_NativeWindow_GetBufferHandleFromNative](_native_window.md#ga28c34ab9b0751010cb716ca9acd6dfef) (struct NativeWindowBuffer \*buffer) | BufferHandle \*
通过NativeWindowBuffer获取该buffer的BufferHandle指针 | +| [OH_NativeWindow_NativeObjectReference](_native_window.md#gafcbd7894c5cdae431e591028c5f7f709) (void \*obj) | int32_t
增加一个NativeObject的引用计数 | +| [OH_NativeWindow_NativeObjectUnreference](_native_window.md#ga24567fa7daee679bf927623adac93a9f) (void \*obj) | int32_t
减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉 | +| [OH_NativeWindow_GetNativeObjectMagic](_native_window.md#ga93828d364eebf3ec5c81d7897757f9f2) (void \*obj) | int32_t
获取NativeObject的MagicId | diff --git a/zh-cn/application-dev/reference/native-apis/files.md b/zh-cn/application-dev/reference/native-apis/files.md new file mode 100644 index 0000000000..f4beb38e74 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/files.md @@ -0,0 +1,35 @@ +# 头文件 + + + +- **[drawing_bitmap.h](drawing__bitmap_8h.md)** + +- **[drawing_brush.h](drawing__brush_8h.md)** + +- **[drawing_canvas.h](drawing__canvas_8h.md)** + +- **[drawing_color.h](drawing__color_8h.md)** + +- **[drawing_font_collection.h](drawing__font__collection_8h.md)** + +- **[drawing_path.h](drawing__path_8h.md)** + +- **[drawing_pen.h](drawing__pen_8h.md)** + +- **[drawing_text_declaration.h](drawing__text__declaration_8h.md)** + +- **[drawing_text_typography.h](drawing__text__typography_8h.md)** + +- **[drawing_types.h](drawing__types_8h.md)** + +- **[external_window.h](external__window_8h.md)** + +- **[log.h](log_8h.md)** + +- **[native_interface_bundle.h](native__interface__bundle_8h.md)** + +- **[native_interface_xcomponent.h](native__interface__xcomponent_8h.md)** + +- **[raw_dir.h](raw__dir_8h.md)** + +- **[raw_file.h](raw__file_8h.md)** \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-apis/index.md b/zh-cn/application-dev/reference/native-apis/index.md new file mode 100644 index 0000000000..f04f11fd3b --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/index.md @@ -0,0 +1,15 @@ +# MyProject + + + +- **[Native XComponent](_o_h___native_x_component.md)** + +- **[Native_Bundle](_native___bundle.md)** + +- **[HiLog](_hi_log.md)** + +- **[NativeWindow](_native_window.md)** + +- **[Drawing](_drawing.md)** + +- **[Rawfile](rawfile.md)** \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-apis/log_8h.md b/zh-cn/application-dev/reference/native-apis/log_8h.md new file mode 100644 index 0000000000..2eea0fb831 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/log_8h.md @@ -0,0 +1,48 @@ +# log.h + + +## **Overview** + +**Related Modules:** + +[HiLog](_hi_log.md) + +**Description:** + +HiLog模块日志接口定义,通过这些接口实现日志打印相关功能。 + +用户输出日志时,先定义日志所属业务领域、日志TAG,然后按照类型、级别选择对应API,指定参数隐私标识输出日志内容。 业务领域:指定日志所对应的业务领域,用户自定义使用,用于标识业务的子系统、模块。16进制整数,范围0x0~0xFFFF。 日志TAG:字符串常量,用于标识调用所在的类或者业务。 日志级别:DEBUG、INFO、WARN、ERROR、FATAL。 参数格式:类printf的方式,包括格式字符串(包括参数类型标识)和变参。 隐私参数标识:在格式字符串每个参数中符号后类型前增加{public}、{private}标识。注意:每个参数未指定隐私标识时,缺省为隐私。 使用示例: 定义业务领域、TAG: \#define LOG_DOMAIN 0x0201 \#define LOG_TAG "MY_TAG" 日志打印: HILOG_WARN([LOG_APP](_hi_log.md#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5), "Failed to visit %{private}s, reason:%{public}d.", url, errno); 结果输出: 05-06 15:01:06.870 1051 1051 W 0201/MY_TAG: Failed to visit <private>, reason:503. + +**Since:** +8 + +## **Summary** + + +### Macros + + | Macro Name and Value | Description | +| -------- | -------- | +| [LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d)   0 | 日志所对应的业务领域,用于标识业务的子系统、模块。 | +| [LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6)   NULL | 字符串常量,标识调用所在的类或者业务。 | +| [OH_LOG_DEBUG](_hi_log.md#gac9b9319de06bce0df57ef440ccaa25fc)(type, ...)   ((void)[OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946)((type), [LOG_DEBUG](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ab9f002c6ffbfd511da8090213227454e), [LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d), [LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6), __VA_ARGS__)) | DEBUG级别写日志,宏封装接口。 | +| [OH_LOG_INFO](_hi_log.md#gadf3fd661bccb575348c5109a0f24f252)(type, ...)   ((void)[OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946)((type), [LOG_INFO](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9a6e98ff471e3ce6c4ef2d75c37ee51837), [LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d), [LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6), __VA_ARGS__)) | INFO级别写日志,宏封装接口。 | +| [OH_LOG_WARN](_hi_log.md#ga1beaeee414c2e0238db4c57212809737)(type, ...)   ((void)[OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946)((type), [LOG_WARN](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ac8041ffa22bc823d4726701cdb13fc13), [LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d), [LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6), __VA_ARGS__)) | WARN级别写日志,宏封装接口。 | +| [OH_LOG_ERROR](_hi_log.md#gab7e62682d195ee81093e7e08673c4941)(type, ...)   ((void)[OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946)((type), [LOG_ERROR](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9a230506cce5c68c3bac5a821c42ed3473), [LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d), [LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6), __VA_ARGS__)) | ERROR级别写日志,宏封装接口。 | +| [OH_LOG_FATAL](_hi_log.md#ga17370605a946403e37024ea898d27f55)(type, ...)   ((void)HiLogPrint((type), [LOG_FATAL](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ac630750884d91cb9767ef2200bbb048b), [LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d), [LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6), __VA_ARGS__)) | FATAL级别写日志,宏封装接口。 | + + +### Enumerations + + | Enumeration Name | Description | +| -------- | -------- | +| [LogType](_hi_log.md#gaf67907baa897e9fb84df0cb89795b87c) { [LOG_APP](_hi_log.md#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5) = 0 } | 日志类型。 | +| [LogLevel](_hi_log.md#gaca1fd1d8935433e6ba2e3918214e07f9) {   [LOG_DEBUG](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ab9f002c6ffbfd511da8090213227454e) = 3, [LOG_INFO](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9a6e98ff471e3ce6c4ef2d75c37ee51837) = 4, [LOG_WARN](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ac8041ffa22bc823d4726701cdb13fc13) = 5, [LOG_ERROR](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9a230506cce5c68c3bac5a821c42ed3473) = 6,   [LOG_FATAL](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ac630750884d91cb9767ef2200bbb048b) = 7 } | 日志级别。 | + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946) ([LogType](_hi_log.md#gaf67907baa897e9fb84df0cb89795b87c) type, [LogLevel](_hi_log.md#gaca1fd1d8935433e6ba2e3918214e07f9) level, unsigned int domain, const char \*tag, const char \*fmt,...) __attribute__((__format__(os_log | int
写日志接口。 | +| [OH_LOG_IsLoggable](_hi_log.md#gabba82e8c08cf8941e4af54941eeda257) (unsigned int domain, const char \*tag, [LogLevel](_hi_log.md#gaca1fd1d8935433e6ba2e3918214e07f9) level) | int bool
检查指定业务领域、TAG、级别的日志是否可以打印。 | diff --git a/zh-cn/application-dev/reference/native-apis/native__interface__bundle_8h.md b/zh-cn/application-dev/reference/native-apis/native__interface__bundle_8h.md new file mode 100644 index 0000000000..f1ce9e4227 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/native__interface__bundle_8h.md @@ -0,0 +1,26 @@ +# native_interface_bundle.h + + +## **Overview** + +**Related Modules:** + +[Native_Bundle](_native___bundle.md) + +**Description:** + +Declares the **Bundle**-specific function, including function for obtaining application ID. + +**Since:** +9 +**Version:** +1.0 + +## **Summary** + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_NativeBundle_GetAppIdByBundleName](_native___bundle.md#gaa407fb88995597480c5584cce1fb14bd) (const char \*bundleName) | char \*
Obtains the application ID based on the given bundle name. | diff --git a/zh-cn/application-dev/reference/native-apis/native__interface__xcomponent_8h.md b/zh-cn/application-dev/reference/native-apis/native__interface__xcomponent_8h.md new file mode 100644 index 0000000000..ba93772b7a --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/native__interface__xcomponent_8h.md @@ -0,0 +1,62 @@ +# native_interface_xcomponent.h + + +## **Overview** + +**Related Modules:** + +[Native XComponent](_o_h___native_x_component.md) + +**Description:** + +Declares APIs for accessing a Native XComponent. + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Classes + + | Classe Name | Description | +| -------- | -------- | +| [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) | | +| [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) | | +| [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) | Registers the surface lifecycle and touch event callbacks. | + + +### Macros + + | Macro Name and Value | Description | +| -------- | -------- | +| **OH_NATIVE_XCOMPONENT_OBJ**   ("__NATIVE_XCOMPONENT_OBJ__") | | + + +### Typedefs + + | Typedef Name | Description | +| -------- | -------- | +| [OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) | typedef struct [OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)
Provides an encapsulated **OH_NativeXComponent** instance. | +| [OH_NativeXComponent_Callback](_o_h___native_x_component.md#gaf629ecc5d06f0a69aea9da3511679ea5) | typedef struct [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)
Registers the surface lifecycle and touch event callbacks. | + + +### Enumerations + + | Enumeration Name | Description | +| -------- | -------- | +| { [OH_NATIVEXCOMPONENT_RESULT_SUCCESS](_o_h___native_x_component.md#gga06fc87d81c62e9abb8790b6e5713c55baf2a815b270113979adea7b9440e0b80e) = 0, [OH_NATIVEXCOMPONENT_RESULT_FAILED](_o_h___native_x_component.md#gga06fc87d81c62e9abb8790b6e5713c55bad6e4a33f3c594e267b8101bbc8ba682f) = -1, [OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](_o_h___native_x_component.md#gga06fc87d81c62e9abb8790b6e5713c55baa12565a3677df7c8dc60e216ed40e580) = -2 } | Enumerates the API access states. | +| [OH_NativeXComponent_TouchEventType](_o_h___native_x_component.md#ga0a8c68dd460d7e801e7c0ff771f09182) {   [OH_NATIVEXCOMPONENT_DOWN](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182a87b4dfe82e5aafd40c202484fc10dfb4) = 0, [OH_NATIVEXCOMPONENT_UP](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182ae2da3fbb127398f9a749070edf671597), [OH_NATIVEXCOMPONENT_MOVE](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182a0b97e9e7830d0363e3617e2a7d33b378), [OH_NATIVEXCOMPONENT_CANCEL](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182a8593a5e1053e9c9df74d6b0e8a9bbb0a),   [OH_NATIVEXCOMPONENT_UNKNOWN](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182aff39d23c1412b3b110a19df4893651d3) } | | + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_NativeXComponent_GetXComponentId](_o_h___native_x_component.md#ga1aa5d0ac3778b9caef35f93b54a6f677) ([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) \*component, char \*id, uint64_t \*size) | int32_t
Obtains the ID of the ArkUI XComponent. | +| [OH_NativeXComponent_GetXComponentSize](_o_h___native_x_component.md#ga8f60375298a5d9eae57d03d4c5cf5f3f) ([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) \*component, const void \*window, uint64_t \*width, uint64_t \*height) | int32_t
Obtains the size of the surface held by the ArkUI XComponent. | +| [OH_NativeXComponent_GetXComponentOffset](_o_h___native_x_component.md#ga3a594868e2d0f633026b7fea2f45812a) ([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) \*component, const void \*window, double \*x, double \*y) | int32_t
Obtains the offset of the surface held by the ArkUI XComponent. | +| [OH_NativeXComponent_GetTouchEvent](_o_h___native_x_component.md#ga5b0e85c74dab846b5b61a5e244ee60ca) ([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) \*component, const void \*window, [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) \*touchEvent) | int32_t
Obtains the touch event dispatched by the ArkUI XComponent. | +| [OH_NativeXComponent_RegisterCallback](_o_h___native_x_component.md#gaf9b8b470cd51ac0e339710926bca72e3) ([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) \*component, [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) \*callback) | int32_t
Registers a callback for this **OH_NativeXComponent** instance. | diff --git a/zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-caution.gif b/zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-caution.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 GIT binary patch literal 580 zcmV-K0=xZ3Nk%w1VIu$?0Hp~4{QBgqmQ+MG9K51r{QB&)np^||1PlfQ%(86!{`~yv zv{XhUWKt}AZaiE{EOcHp{O-j3`t;<+eEiycJT4p@77X;(jQsMfB$R?oG%6hQ z+MMLZbQBH@)Vg&1^3?qHb(5!%>3r0+`eq=&V&E}0Dypi0000000000 z00000A^8LW000R9EC2ui03!e$000L5z=Uu}ED8YtqjJd<+B}(9bIOb$3-31_h|V>=0A{ z1Hh0#H30>fNT})^fRU_83uewx9oRr{f{Sx1Ml`t)EQ zGkHZ67&~y{W5Jpq4H_WfuLxp*3<7O}GEl;1ESe36fLNs=B0&LQM1Buf(R)qg(BRd`t1OPjI1m_q4 literal 0 HcmV?d00001 diff --git a/zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-danger.gif b/zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-danger.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 GIT binary patch literal 580 zcmV-K0=xZ3Nk%w1VIu$?0Hp~4{QBgqmQ+MG9K51r{QB&)np^||1PlfQ%(86!{`~yv zv{XhUWKt}AZaiE{EOcHp{O-j3`t;<+eEiycJT4p@77X;(jQsMfB$R?oG%6hQ z+MMLZbQBH@)Vg&1^3?qHb(5!%>3r0+`eq=&V&E}0Dypi0000000000 z00000A^8LW000R9EC2ui03!e$000L5z=Uu}ED8YtqjJd<+B}(9bIOb$3-31_h|V>=0A{ z1Hh0#H30>fNT})^fRU_83uewx9oRr{f{Sx1Ml`t)EQ zGkHZ67&~y{W5Jpq4H_WfuLxp*3<7O}GEl;1ESe36fLNs=B0&LQM1Buf(R)qg(BRd`t1OPjI1m_q4 literal 0 HcmV?d00001 diff --git a/zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-note.gif b/zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-note.gif new file mode 100644 index 0000000000000000000000000000000000000000..6314297e45c1de184204098efd4814d6dc8b1cda GIT binary patch literal 394 zcmZ?wbhEHblx7fPSjxcg=ii?@_wH=jwxy=7CMGH-B`L+l$wfv=#>UF#$gv|VY%C^b zCQFtrnKN(Bo_%|sJbO}7RAORe!otL&qo<>yq_Sq+8Xqqo5h0P3w3Lvb5E(g{p01vl zxR@)KuDH0l^z`+-dH3eaw=XqSH7aTIx{kzVBN;X&hha0dQSgWuiw0NWUvMRmkD|> literal 0 HcmV?d00001 diff --git a/zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-notice.gif b/zh-cn/application-dev/reference/native-apis/public_sys-resources/icon-notice.gif new file mode 100644 index 0000000000000000000000000000000000000000..86024f61b691400bea99e5b1f506d9d9aef36e27 GIT binary patch literal 406 zcmV;H0crk6Nk%w1VIu$@0J8u9|NsB@_xJDb@8;&_*4Ea}&d#;9wWXz{jEszHYim+c zQaU<1At50E0000000000A^8Le000gEEC2ui03!e%000R7038S%NU)&51O^i-Tu6`s z0)`MFE@;3YqD6xSC^kTNu_J>91{PH8XfZ(p1pp2-SU@u3#{mEUC}_}tg3+I#{z}{Ok@D_ZUDg- zt0stin4;pC8M{WLSlRH*1pzqEw1}3oOskyNN?j;7HD{BBZ*OEcv4HK!6Bk6beR+04 z&8}k>SkTusVTDmkyOz#5fCA$JTPGJVQvr3uZ?QzzPQFvD0rGf_PdrcF`pMs}p^BcF zKtKTd`0wipR%nKN&Wj+V}pX;WC3SdJV!a_8Qi zE7z`U*|Y^H0^}fB$R?oG%6hQ z+MMLZbQBH@)Vg&1^3?qHb(5!%>3r0+`eq=&V&E}0Dypi0000000000 z00000A^8LW000R9EC2ui03!e$000L5z=Uu}ED8YtqjJd<+B}(9bIOb$3-31_h|V>=0A{ z1Hh0#H30>fNT})^fRU_83uewx9oRr{f{Sx1Ml`t)EQ zGkHZ67&~y{W5Jpq4H_WfuLxp*3<7O}GEl;1ESe36fLNs=B0&LQM1Buf(R)qg(BRd`t1OPjI1m_q4 literal 0 HcmV?d00001 diff --git a/zh-cn/application-dev/reference/native-apis/raw__dir_8h.md b/zh-cn/application-dev/reference/native-apis/raw__dir_8h.md new file mode 100644 index 0000000000..62fa049bd1 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/raw__dir_8h.md @@ -0,0 +1,37 @@ +# raw_dir.h + + +## **Overview** + +**Related Modules:** + +[Rawfile](rawfile.md) + +**Description:** + +提供rawfile目录相关功能 + +功能包括遍历和关闭rawfile目录 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Typedefs + + | Typedef Name | Description | +| -------- | -------- | +| [RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3) | typedef struct [RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)
提供对rawfile目录的访问 | + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_ResourceManager_GetRawFileName](rawfile.md#gaf522ad160d8ca2bd476b6ad45696e1af) ([RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3) \*rawDir, int index) | const char \*
通过索引获取rawfile文件名称 | +| [OH_ResourceManager_GetRawFileCount](rawfile.md#ga604cd2ced1bf4a0d1ace7b0fc89cb884) ([RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3) \*rawDir) | int
获取[RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)中的rawfile数量 | +| [OH_ResourceManager_CloseRawDir](rawfile.md#ga1db0825028507d355db4067f187223de) ([RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3) \*rawDir) | void
关闭已打开的[RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)并释放所有相关联资源 | diff --git a/zh-cn/application-dev/reference/native-apis/raw__file_8h.md b/zh-cn/application-dev/reference/native-apis/raw__file_8h.md new file mode 100644 index 0000000000..a59adf879b --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/raw__file_8h.md @@ -0,0 +1,48 @@ +# raw_file.h + + +## **Overview** + +**Related Modules:** + +[Rawfile](rawfile.md) + +**Description:** + +提供rawfile文件相关功能 + +功能包括搜索、读取和关闭rawfile文件 + +**Since:** +8 +**Version:** +1.0 + +## **Summary** + + +### Classes + + | Classe Name | Description | +| -------- | -------- | +| [RawFileDescriptor](_raw_file_descriptor.md) | 提供rawfile文件描述符信息 | + + +### Typedefs + + | Typedef Name | Description | +| -------- | -------- | +| [RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) | typedef struct [RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)
提供对rawfile的访问功能 | + + +### Functions + + | Function | Description | +| -------- | -------- | +| [OH_ResourceManager_ReadRawFile](rawfile.md#ga2958ba7372ae1232365358115a82c219) (const [RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) \*rawFile, void \*buf, size_t length) | int
读取rawfile | +| [OH_ResourceManager_SeekRawFile](rawfile.md#ga7fc0d124fd184498b0a0bfad3454f45c) (const [RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) \*rawFile, long offset, int whence) | int
基于指定的offset,在rawfile文件内搜索读写数据的位置 | +| [OH_ResourceManager_GetRawFileSize](rawfile.md#gafcc6036360466ab5193b7b4eba5eae50) ([RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) \*rawFile) | long
获取rawfile长度,单位为int32_t | +| [OH_ResourceManager_CloseRawFile](rawfile.md#ga5cccee53550670a2111705d56a1d427b) ([RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) \*rawFile) | void
关闭已打开的[RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) 以及释放所有相关联资源 | +| [OH_ResourceManager_GetRawFileOffset](rawfile.md#ga57dc379d6df6b7c7f8e76303ad4957a4) (const [RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) \*rawFile) | long
获取rawfile当前的offset,单位为int32_t | +| [OH_ResourceManager_GetRawFileDescriptor](rawfile.md#ga8313a7d4bb361a98ced485346a9be4b1) (const [RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) \*rawFile, [RawFileDescriptor](_raw_file_descriptor.md) &descriptor) | bool
基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符 | +| [OH_ResourceManager_ReleaseRawFileDescriptor](rawfile.md#gabf9db7f05088a11cc311a6ef890eda6b) (const [RawFileDescriptor](_raw_file_descriptor.md) &descriptor) | bool
关闭rawfile文件描述符 | diff --git a/zh-cn/application-dev/reference/native-apis/rawfile.md b/zh-cn/application-dev/reference/native-apis/rawfile.md new file mode 100644 index 0000000000..ed058a19e6 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/rawfile.md @@ -0,0 +1,461 @@ +# Rawfile + + +## **Overview** + +**Description:** + +提供操作rawfile目录和rawfile文件的功能 + +提供操作rawfile目录和rawfile文件功能 + +功能包括遍历、打开、搜索、读取和关闭rawfile + +**Since:** + +8 + +**Version:** + +1.0 + + +## **Summary** + + +### Files + + | File Name | Description | +| -------- | -------- | +| [raw_dir.h](raw__dir_8h.md) | 提供rawfile目录相关功能 | +| [raw_file.h](raw__file_8h.md) | 提供rawfile文件相关功能 | + + +### Classes + + | Classe Name | Description | +| -------- | -------- | +| [RawFileDescriptor](_raw_file_descriptor.md) | 提供rawfile文件描述符信息 | + + +### Typedefs + + | Typedef Name | Description | +| -------- | -------- | +| RawDir | typedef struct RawDir
提供对rawfile目录的访问 | +| RawFile | typedef struct RawFile
提供对rawfile的访问功能 | +| NativeResourceManager | typedef struct NativeResourceManager
代表resource manager | + + +### Functions + + | Function | Description | +| -------- | -------- | +| OH_ResourceManager_GetRawFileName (RawDir \*rawDir, int index) | const char \*
通过索引获取rawfile文件名称 | +| OH_ResourceManager_GetRawFileCount (RawDir \*rawDir) | int
获取RawDir中的rawfile数量 | +| OH_ResourceManager_CloseRawDir (RawDir \*rawDir) | void
关闭已打开的RawDir并释放所有相关联资源 | +| OH_ResourceManager_ReadRawFile (const RawFile \*rawFile, void \*buf, size_t length) | int
读取rawfile | +| OH_ResourceManager_SeekRawFile (const RawFile \*rawFile, long offset, int whence) | int
基于指定的offset,在rawfile文件内搜索读写数据的位置 | +| OH_ResourceManager_GetRawFileSize (RawFile \*rawFile) | long
获取rawfile长度,单位为int32_t | +| OH_ResourceManager_CloseRawFile (RawFile \*rawFile) | void
关闭已打开的RawFile 以及释放所有相关联资源 | +| OH_ResourceManager_GetRawFileOffset (const RawFile \*rawFile) | long
获取rawfile当前的offset,单位为int32_t | +| OH_ResourceManager_GetRawFileDescriptor (const RawFile \*rawFile, RawFileDescriptor &descriptor) | bool
基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符 | +| OH_ResourceManager_ReleaseRawFileDescriptor (const RawFileDescriptor &descriptor) | bool
关闭rawfile文件描述符 | +| OH_ResourceManager_InitNativeResourceManager (napi_env env, napi_value jsResMgr) | NativeResourceManager \*
基于JavaScipt resource manager获取native resource manager | +| OH_ResourceManager_ReleaseNativeResourceManager (NativeResourceManager \*resMgr) | void
释放native resource manager | +| OH_ResourceManager_OpenRawDir (const NativeResourceManager \*mgr, const char \*dirName) | RawDir \*
打开rawfile目录 | +| OH_ResourceManager_OpenRawFile (const NativeResourceManager \*mgr, const char \*fileName) | RawFile \*
打开rawfile文件 | + + +## **Details** + + +## **Typedef** + + +### NativeResourceManager + + +``` +typedef struct NativeResourceManager NativeResourceManager +``` + +**Description:** + +代表resource manager + +此类封装了JavaScript resource manager的native实现 **ResourceManager**指针可以通过调用OH_ResourceManager_InitNativeResourceManager方法获取 + + +### RawDir + + +``` +typedef struct RawDir RawDir +``` + +**Description:** + +提供对rawfile目录的访问 + + +### RawFile + + +``` +typedef struct RawFile RawFile +``` + +**Description:** + +提供对rawfile的访问功能 + + +## **Function** + + +### OH_ResourceManager_CloseRawDir() + + +``` +void OH_ResourceManager_CloseRawDir (RawDir * rawDir) +``` + +**Description:** + +关闭已打开的RawDir并释放所有相关联资源 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| rawDir | 表示指向RawDir的指针 | + +**See also:** + +OH_ResourceManager_OpenRawDir + + +### OH_ResourceManager_CloseRawFile() + + +``` +void OH_ResourceManager_CloseRawFile (RawFile * rawFile) +``` + +**Description:** + +关闭已打开的RawFile 以及释放所有相关联资源 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| rawFile | 表示指向RawFile的指针 | + +**See also:** + +OH_ResourceManager_OpenRawFile + + +### OH_ResourceManager_GetRawFileCount() + + +``` +int OH_ResourceManager_GetRawFileCount (RawDir * rawDir) +``` + +**Description:** + +获取RawDir中的rawfile数量 + +通过此方法可以获取OH_ResourceManager_GetRawFileName中可用的索引 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| rawDir | 表示指向RawDir的指针 | + +**See also:** + +OH_ResourceManager_GetRawFileName + + +### OH_ResourceManager_GetRawFileDescriptor() + + +``` +bool OH_ResourceManager_GetRawFileDescriptor (const RawFile * rawFile, RawFileDescriptor & descriptor ) +``` + +**Description:** + +基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符 + +打开的文件描述符被用于读取rawfile + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| rawFile | 表示指向RawFile的指针 | +| descriptor | 显示rawfile文件描述符,以及在HAP包中的起始位置和长度 | + +**Returns:** + +返回true表示打开rawfile文件描述符成功,返回false表示rawfile不允许被访问 + + +### OH_ResourceManager_GetRawFileName() + + +``` +const char* OH_ResourceManager_GetRawFileName (RawDir * rawDir, int index ) +``` + +**Description:** + +通过索引获取rawfile文件名称 + +可以使用此方法遍历rawfile目录 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| rawDir | 表示指向RawDir的指针 | +| index | 表示文件在RawDir中的索引位置 | + +**Returns:** + +通过索引返回文件名称,此返回值可以作为OH_ResourceManager_OpenRawFile的输入参数, 如果遍历完所有文件仍未找到,则返回**NULL** + +**See also:** + +OH_ResourceManager_OpenRawFile + + +### OH_ResourceManager_GetRawFileOffset() + + +``` +long OH_ResourceManager_GetRawFileOffset (const RawFile * rawFile) +``` + +**Description:** + +获取rawfile当前的offset,单位为int32_t + +rawfile当前的offset + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| rawFile | 表示指向RawFile的指针 | + +**Returns:** + +返回rawfile当前的offset + + +### OH_ResourceManager_GetRawFileSize() + + +``` +long OH_ResourceManager_GetRawFileSize (RawFile * rawFile) +``` + +**Description:** + +获取rawfile长度,单位为int32_t + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| rawFile | 表示指向RawFile的指针 | + +**Returns:** + +Returns rawfile整体长度 + + +### OH_ResourceManager_InitNativeResourceManager() + + +``` +NativeResourceManager* OH_ResourceManager_InitNativeResourceManager (napi_env env, napi_value jsResMgr ) +``` + +**Description:** + +基于JavaScipt resource manager获取native resource manager + +通过获取resource manager来完成rawfile相关功能 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| env | 表示JavaScipt Native Interface (napi)环境指针 | +| jsResMgr | 表示JavaScipt resource manager | + +**Returns:** + +返回NativeResourceManager指针 + + +### OH_ResourceManager_OpenRawDir() + + +``` +RawDir* OH_ResourceManager_OpenRawDir (const NativeResourceManager * mgr, const char * dirName ) +``` + +**Description:** + +打开rawfile目录 + +打开rawfile目录后,可以遍历对应目录下的rawfile文件 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| mgr | 表示指向NativeResourceManager的指针,此指针是通过调用 OH_ResourceManager_InitNativeResourceManager方法获取的 | +| dirName | 表示要打开的rawfile目录名称,当传递一个空字符串时表示打开rawfile根目录 | + +**Returns:** + +返回RawDir指针。使用完此指针后,调用OH_ResourceManager_CloseRawDir释放。 + +**See also:** + +OH_ResourceManager_InitNativeResourceManager + +OH_ResourceManager_CloseRawDir + + +### OH_ResourceManager_OpenRawFile() + + +``` +RawFile* OH_ResourceManager_OpenRawFile (const NativeResourceManager * mgr, const char * fileName ) +``` + +**Description:** + +打开rawfile文件 + +当打开rawfile以后,可以读取它的数据 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| mgr | 表示指向NativeResourceManager的指针,此指针是通过调用 OH_ResourceManager_InitNativeResourceManager方法获取的 | +| fileName | 表示基于rawfile根目录的相对路径下的文件名称 | + +**Returns:** + +返回RawFile指针。当使用完此指针,调用OH_ResourceManager_CloseRawFile释放。 + +**See also:** + +OH_ResourceManager_InitNativeResourceManager + +OH_ResourceManager_CloseRawFile + + +### OH_ResourceManager_ReadRawFile() + + +``` +int OH_ResourceManager_ReadRawFile (const RawFile * rawFile, void * buf, size_t length ) +``` + +**Description:** + +读取rawfile + +从当前位置读取**指定长度**的数据 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| rawFile | 表示指向RawFile的指针 | +| buf | 用于接收读取数据的缓冲区指针 | +| length | 读取数据的字节长度 | + +**Returns:** + +返回读取的字节数,如果读取长度超过文件末尾长度,则返回**0** + + +### OH_ResourceManager_ReleaseNativeResourceManager() + + +``` +void OH_ResourceManager_ReleaseNativeResourceManager (NativeResourceManager * resMgr) +``` + +**Description:** + +释放native resource manager + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| resMgr | 表示NativeResourceManager指针 | + + +### OH_ResourceManager_ReleaseRawFileDescriptor() + + +``` +bool OH_ResourceManager_ReleaseRawFileDescriptor (const RawFileDescriptor & descriptor) +``` + +**Description:** + +关闭rawfile文件描述符 + +已打开的文件描述符在使用完以后必须释放,防止文件描述符泄露 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| descriptor | 包含rawfile文件描述符,以及在HAP包中的起始位置和长度 | + +**Returns:** + +返回true表示关闭文件描述符成功,返回false表示关闭文件描述符失败 + + +### OH_ResourceManager_SeekRawFile() + + +``` +int OH_ResourceManager_SeekRawFile (const RawFile * rawFile, long offset, int whence ) +``` + +**Description:** + +基于指定的offset,在rawfile文件内搜索读写数据的位置 + +**Parameters:** + + | Name | Description | +| -------- | -------- | +| rawFile | 表示指向RawFile的指针 | +| offset | 表示指定的offset | +| whence | 读写位置,有以下场景: **0**: 读写位置为**offset1**: 读写位置为当前位置加上**offset2**: 读写位置为文件末尾(EOF)加上**offset** | + +**Returns:** + +如果搜索成功返回新的读写位置,如果发生错误返回 **(long) -1** diff --git a/zh-cn/application-dev/reference/native-apis/total.md b/zh-cn/application-dev/reference/native-apis/total.md new file mode 100644 index 0000000000..bac5076606 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/total.md @@ -0,0 +1,7 @@ +# 头文件和结构体 + + + +- **[头文件](files.md)** + +- **[结构体](annotated.md)** \ No newline at end of file -- GitLab