diff --git a/zh-cn/application-dev/reference/native-apis/Readme-CN.md b/zh-cn/application-dev/reference/native-apis/Readme-CN.md index f8b7f9562bf6c3865998581e46695312eb59caa6..21e2c27ad2afe1bda36ae6aed53e991d6d5e492a 100644 --- a/zh-cn/application-dev/reference/native-apis/Readme-CN.md +++ b/zh-cn/application-dev/reference/native-apis/Readme-CN.md @@ -2,13 +2,15 @@ - 模块 - [Native XComponent](_o_h___native_x_component.md) - - [Native_Bundle](_native___bundle.md) - [HiLog](_hi_log.md) - [NativeWindow](_native_window.md) + - [OH_NativeBuffer](_o_h___native_buffer.md) - [Drawing](_drawing.md) + - [OH_NativeImage](_o_h___native_image.md) + - [NativeVsync](_native_vsync.md) + - [Image](image.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) @@ -20,14 +22,22 @@ - [drawing_text_typography.h](drawing__text__typography_8h.md) - [drawing_types.h](drawing__types_8h.md) - [external_window.h](external__window_8h.md) + - [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) - [log.h](log_8h.md) - - [native_interface_bundle.h](native__interface__bundle_8h.md) + - [native_buffer.h](native__buffer_8h.md) + - [native_image.h](native__image_8h.md) - [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) + - [native_vsync.h](native__vsync_8h.md) - [raw_dir.h](raw__dir_8h.md) + - [raw_file_manager.h](raw__file__manager_8h.md) - [raw_file.h](raw__file_8h.md) - 结构体 - [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) + - [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) - [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) + - [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) + - [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) - [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) - [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) + - [OhosPixelMapInfo](_ohos_pixel_map_info.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 index c8a55c1922209caf6049442320650f7335d7d352..f37844a0ad76c59a972315728ad55d17708d6586 100644 --- a/zh-cn/application-dev/reference/native-apis/_drawing.md +++ b/zh-cn/application-dev/reference/native-apis/_drawing.md @@ -1,2107 +1,2485 @@ # Drawing -## **Overview** +Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 -**Description:** -Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 +提供2D绘制功能。 -Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数. -提供2D绘制功能 +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Since:** - -8 - -**Version:** - -1.0 +**自从:** -## **Summary** - +8 -### 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 - - | Classes 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** +## 汇总 + + +### 文件 + +| 文件名称 | 描述 | +| -------- | -------- | +| [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图形的数据类型,包括画布、画笔、画刷、位图和路径。 | + + +### 结构体 + +| 结构体名称 | 描述 | +| -------- | -------- | +| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型。 | + + +### 类型定义 + +| 类型定义名称 | 描述 | +| -------- | -------- | +| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | OH_Drawing_FontCollection用于加载字体。 | +| [OH_Drawing_Typography](#oh_drawing_typography) | OH_Drawing_Typography用于管理排版的布局和显示等。 | +| [OH_Drawing_TextStyle](#oh_drawing_textstyle) | OH_Drawing_TextStyle用于管理字体颜色、装饰等。 | +| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) | OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等。 | +| [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) | OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography。 | +| [OH_Drawing_Canvas](#oh_drawing_canvas) | OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 | +| [OH_Drawing_Pen](#oh_drawing_pen) | OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 | +| [OH_Drawing_Brush](#oh_drawing_brush) | OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色。 | +| [OH_Drawing_Path](#oh_drawing_path) | OH_Drawing_Path定义为路径,路径用于自定义各种形状。 | +| [OH_Drawing_Bitmap](#oh_drawing_bitmap) | OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 | + + +### 枚举 + +| 枚举名称 | 描述 | +| -------- | -------- | +| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 | +| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 | +| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | 文字方向。 | +| [OH_Drawing_TextAlign](#oh_drawing_textalign) { TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY, TEXT_ALIGN_START, TEXT_ALIGN_END } | 文字对齐方式。 | +| [OH_Drawing_FontWeight](#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](#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | 基线位置。 | +| [OH_Drawing_TextDecoration](#oh_drawing_textdecoration) { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } | 文本装饰。 | +| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC } | 区分字体是否为斜体。 | +| [OH_Drawing_ColorFormat](#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](#oh_drawing_alphaformat) { ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL } | OH_Drawing_AlphaFormat用于描述位图像素的透明度分量。 | + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | 函数用于创建一个位图对象。 | +| [OH_Drawing_BitmapDestroy](#oh_drawing_bitmapdestroy) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 函数用于销毁位图对象并回收该对象占有内存。 | +| [OH_Drawing_BitmapBuild](#oh_drawing_bitmapbuild) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, const uint32_t width, const uint32_t height, const [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) \*) | 函数用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 | +| [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 该函数用于获取指定位图的宽度。 | +| [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 函数用于获取指定位图的高度。 | +| [OH_Drawing_BitmapGetPixels](#oh_drawing_bitmapgetpixels) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 | +| [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | 函数用于创建一个画刷对象。 | +| [OH_Drawing_BrushDestroy](#oh_drawing_brushdestroy) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 函数用于销毁画刷对象并回收该对象占有的内存。 | +| [OH_Drawing_BrushIsAntiAlias](#oh_drawing_brushisantialias) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | +| [OH_Drawing_BrushSetAntiAlias](#oh_drawing_brushsetantialias) ([OH_Drawing_Brush](#oh_drawing_brush) \*, bool) | 函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | +| [OH_Drawing_BrushGetColor](#oh_drawing_brushgetcolor) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 | +| [OH_Drawing_BrushSetColor](#oh_drawing_brushsetcolor) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint32_t color) | 函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 | +| [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | 函数用于创建一个画布对象。 | +| [OH_Drawing_CanvasDestroy](#oh_drawing_canvasdestroy) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 函数用于销毁画布对象并回收该对象占有的内存。 | +| [OH_Drawing_CanvasBind](#oh_drawing_canvasbind) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 | +| [OH_Drawing_CanvasAttachPen](#oh_drawing_canvasattachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 | +| [OH_Drawing_CanvasDetachPen](#oh_drawing_canvasdetachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 | +| [OH_Drawing_CanvasAttachBrush](#oh_drawing_canvasattachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 | +| [OH_Drawing_CanvasDetachBrush](#oh_drawing_canvasdetachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状。 | +| [OH_Drawing_CanvasSave](#oh_drawing_canvassave) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 函数用于保存当前画布的状态(画布矩阵)到一个栈顶。 | +| [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 函数用于恢复保存在栈顶的画布状态(画布矩阵)。 | +| [OH_Drawing_CanvasDrawLine](#oh_drawing_canvasdrawline) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float x1, float y1, float x2, float y2) | 函数用于画一条直线段。 | +| [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | 函数用于画一个自定义路径。 | +| [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | 函数用于使用指定颜色去清空画布。 | +| [OH_Drawing_ColorSetArgb](#oh_drawing_colorsetargb) (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | 函数用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 | +| [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | 创建OH_Drawing_FontCollection。 | +| [OH_Drawing_DestroyFontCollection](#oh_drawing_destroyfontcollection) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 释放被OH_Drawing_FontCollection对象占据的内存。 | +| [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | 函数用于创建一个路径对象。 | +| [OH_Drawing_PathDestroy](#oh_drawing_pathdestroy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 函数用于销毁路径对象并回收该对象占有的内存。 | +| [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 函数用于设置自定义路径的起始点位置。 | +| [OH_Drawing_PathLineTo](#oh_drawing_pathlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 函数用于添加一条从路径的最后点位置到目标点位置的线段。 | +| [OH_Drawing_PathArcTo](#oh_drawing_patharcto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg) | 函数用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 | +| [OH_Drawing_PathQuadTo](#oh_drawing_pathquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线。 | +| [OH_Drawing_PathCubicTo](#oh_drawing_pathcubicto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY) | 函数用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线。 | +| [OH_Drawing_PathClose](#oh_drawing_pathclose) ([OH_Drawing_Path](#oh_drawing_path) \*) | 函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 | +| [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | 函数用于重置自定义路径数据。 | +| [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | 函数用于创建一个画笔对象。 | +| [OH_Drawing_PenDestroy](#oh_drawing_pendestroy) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 函数用于销毁画笔对象并回收该对象占有的内存。 | +| [OH_Drawing_PenIsAntiAlias](#oh_drawing_penisantialias) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | +| [OH_Drawing_PenSetAntiAlias](#oh_drawing_pensetantialias) ([OH_Drawing_Pen](#oh_drawing_pen) \*, bool) | 函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | +| [OH_Drawing_PenGetColor](#oh_drawing_pengetcolor) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 | +| [OH_Drawing_PenSetColor](#oh_drawing_pensetcolor) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint32_t color) | 函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 | +| [OH_Drawing_PenGetWidth](#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 | +| [OH_Drawing_PenSetWidth](#oh_drawing_pensetwidth) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float width) | 函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 | +| [OH_Drawing_PenGetMiterLimit](#oh_drawing_pengetmiterlimit) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 | +| [OH_Drawing_PenSetMiterLimit](#oh_drawing_pensetmiterlimit) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float miter) | 函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 | +| [OH_Drawing_PenGetCap](#oh_drawing_pengetcap) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 函数用于获取画笔笔帽的样式。 | +| [OH_Drawing_PenSetCap](#oh_drawing_pensetcap) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)) | 函数用于设置画笔笔帽样式。 | +| [OH_Drawing_PenGetJoin](#oh_drawing_pengetjoin) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 函数用于获取画笔绘制折线转角的样式。 | +| [OH_Drawing_PenSetJoin](#oh_drawing_pensetjoin) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)) | 函数用于设置画笔绘制转角的样式。 | +| [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | 创建OH_Drawing_TypographyStyle。 | +| [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 释放被OH_Drawing_TypographyStyle对象占据的内存。 | +| [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本方向。 | +| [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本对齐方式。 | +| [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本最大行数。 | +| [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | 创建OH_Drawing_TextStyle。 | +| [OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 释放被OH_Drawing_TextStyle对象占据的内存。 | +| [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置文本颜色。 | +| [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置字号。 | +| [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字重。 | +| [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体基线位置。 | +| [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置装饰。 | +| [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置装饰颜色。 | +| [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置字体高度。 | +| [OH_Drawing_SetTextStyleFontFamilies](#oh_drawing_settextstylefontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int, const char \*fontFamilies[]) | 设置字体类型。 | +| [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体风格。 | +| [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置语言区域。 | +| [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 创建指向OH_Drawing_TypographyCreate对象的指针。 | +| [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 释放被OH_Drawing_TypographyCreate对象占据的内存。 | +| [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 设置排版风格。 | +| [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | 设置文本内容。 | +| [OH_Drawing_TypographyHandlerPopTextStyle](#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 排版弹出。 | +| [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 创建OH_Drawing_Typography。 | +| [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 释放OH_Drawing_Typography对象占据的内存。 | +| [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | 排版布局。 | +| [OH_Drawing_TypographyPaint](#oh_drawing_typographypaint) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, double, double) | 显示文本。 | + + +## 详细描述 + + +## 类型定义说明 ### OH_Drawing_Bitmap - + ``` typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap ``` -**Description:** +**描述:** OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据 +**自从:** + +8 + ### OH_Drawing_Brush - + ``` typedef struct OH_Drawing_Brush OH_Drawing_Brush ``` -**Description:** +**描述:** OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色 +**自从:** + +8 + ### OH_Drawing_Canvas - + ``` typedef struct OH_Drawing_Canvas OH_Drawing_Canvas ``` -**Description:** +**描述:** OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字 +**自从:** + +8 + ### OH_Drawing_FontCollection - + ``` typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection ``` -**Description:** +**描述:** OH_Drawing_FontCollection用于加载字体 +**自从:** + +8 + ### OH_Drawing_Path - + ``` typedef struct OH_Drawing_Path OH_Drawing_Path ``` -**Description:** +**描述:** OH_Drawing_Path定义为路径,路径用于自定义各种形状 +**自从:** + +8 + ### OH_Drawing_Pen - + ``` typedef struct OH_Drawing_Pen OH_Drawing_Pen ``` -**Description:** +**描述:** OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色 +**自从:** + +8 + ### OH_Drawing_TextStyle - + ``` typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle ``` -**Description:** +**描述:** OH_Drawing_TextStyle用于管理字体颜色、装饰等 +**自从:** + +8 + ### OH_Drawing_Typography - + ``` typedef struct OH_Drawing_Typography OH_Drawing_Typography ``` -**Description:** +**描述:** OH_Drawing_Typography用于管理排版的布局和显示等 +**自从:** + +8 + ### OH_Drawing_TypographyCreate - + ``` typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate ``` -**Description:** +**描述:** -OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography. +OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography + +**自从:** + +8 ### OH_Drawing_TypographyStyle - + ``` typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle ``` -**Description:** +**描述:** OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等 +**自从:** + +8 + -## **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 | 每个像素的颜色组件未由透明度分量预先乘以 | +| ALPHA_FORMAT_UNKNOWN | 未知格式 | +| ALPHA_FORMAT_OPAQUE | 位图无透明度 | +| ALPHA_FORMAT_PREMUL | 每个像素的颜色组件由透明度分量预先乘以 | +| ALPHA_FORMAT_UNPREMUL | 每个像素的颜色组件未由透明度分量预先乘以 | + +**自从:** + +8 ### 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个比特位表示透明度 | +| 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个比特位表示透明度 | + +**自从:** + +8 ### OH_Drawing_FontStyle - + ``` enum OH_Drawing_FontStyle ``` -**Description:** +**描述:** 区分字体是否为斜体 - | Enumerator | Description | +| 枚举值 | 描述 | | -------- | -------- | -| FONT_STYLE_NORMAL | 非斜体 | -| FONT_STYLE_ITALIC | 斜体 | +| FONT_STYLE_NORMAL | 非斜体 | +| FONT_STYLE_ITALIC | 斜体 | + +**自从:** + +8 ### 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 | +| 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 | + +**自从:** + +8 ### OH_Drawing_PenLineCapStyle - + ``` enum OH_Drawing_PenLineCapStyle ``` -**Description:** +**描述:** 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式 - | Enumerator | Description | +| 枚举值 | 描述 | | -------- | -------- | -| LINE_FLAT_CAP | 没有笔帽样式,线条头尾端点处横切 | -| LINE_SQUARE_CAP | 笔帽的样式为方框,线条的头尾端点处多出一个方框,方框宽度和线段一样宽,高度时线段厚度的一半 | -| LINE_ROUND_CAP | 笔帽的样式为圆弧,线条的头尾端点处多出一个半圆弧,半圆的直径与线段厚度一致 | +| LINE_FLAT_CAP | 没有笔帽样式,线条头尾端点处横切 | +| LINE_SQUARE_CAP | 笔帽的样式为方框,线条的头尾端点处多出一个方框,方框宽度和线段一样宽,高度时线段厚度的一半 | +| LINE_ROUND_CAP | 笔帽的样式为圆弧,线条的头尾端点处多出一个半圆弧,半圆的直径与线段厚度一致 | + +**自从:** + +8 ### OH_Drawing_PenLineJoinStyle - + ``` enum OH_Drawing_PenLineJoinStyle ``` -**Description:** +**描述:** 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式 - | Enumerator | Description | +| 枚举值 | 描述 | | -------- | -------- | -| LINE_MITER_JOIN | 转角类型为尖角,如果折线角度比较小,则尖角会很长,需要使用限制值(miter limit)进行限制 | -| LINE_ROUND_JOIN | 转角类型为圆头 | -| LINE_BEVEL_JOIN | 转角类型为平头 | +| LINE_MITER_JOIN | 转角类型为尖角,如果折线角度比较小,则尖角会很长,需要使用限制值(miter limit)进行限制 | +| LINE_ROUND_JOIN | 转角类型为圆头 | +| LINE_BEVEL_JOIN | 转角类型为平头 | + +**自从:** + +8 ### 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相同。 | +| 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相同。 | + +**自从:** + +8 ### OH_Drawing_TextBaseline - + ``` enum OH_Drawing_TextBaseline ``` -**Description:** +**描述:** 基线位置 - | Enumerator | Description | +| 枚举值 | 描述 | | -------- | -------- | -| TEXT_BASELINE_ALPHABETIC | 用于表音文字,基线在中间偏下的位置 | -| TEXT_BASELINE_IDEOGRAPHIC | 用于表意文字,基线位于底部 | +| TEXT_BASELINE_ALPHABETIC | 用于表音文字,基线在中间偏下的位置 | +| TEXT_BASELINE_IDEOGRAPHIC | 用于表意文字,基线位于底部 | + +**自从:** + +8 ### OH_Drawing_TextDecoration - + ``` enum OH_Drawing_TextDecoration ``` -**Description:** +**描述:** 文本装饰 - | Enumerator | Description | +| 枚举值 | 描述 | | -------- | -------- | -| TEXT_DECORATION_NONE | 无装饰 | -| TEXT_DECORATION_UNDERLINE | 下划线 | -| TEXT_DECORATION_OVERLINE | 上划线 | -| TEXT_DECORATION_LINE_THROUGH | 删除线 | +| TEXT_DECORATION_NONE | 无装饰 | +| TEXT_DECORATION_UNDERLINE | 下划线 | +| TEXT_DECORATION_OVERLINE | 上划线 | +| TEXT_DECORATION_LINE_THROUGH | 删除线 | + +**自从:** + +8 ### OH_Drawing_TextDirection - + ``` enum OH_Drawing_TextDirection ``` -**Description:** +**描述:** 文字方向 - | Enumerator | Description | +| 枚举值 | 描述 | | -------- | -------- | -| TEXT_DIRECTION_RTL | 方向:从右到左 | -| TEXT_DIRECTION_LTR | 方向:从左到右 | +| TEXT_DIRECTION_RTL | 方向:从右到左 | +| TEXT_DIRECTION_LTR | 方向:从左到右 | + +**自从:** + +8 -## **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 +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | -| width | 参数是位图要初始化设置的宽度 | -| height | 参数是位图要初始化设置的高度 | -| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 参数是位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型 | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | +| width | 参数是位图要初始化设置的宽度 | +| height | 参数是位图要初始化设置的高度 | +| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 参数是位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型 | + +**自从:** + +8 ### OH_Drawing_BitmapCreate() - + ``` OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void ) ``` -**Description:** +**描述:** 函数用于创建一个位图对象。 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Returns:** +**返回:** 函数会返回一个指针,指针指向创建的位图对象 +**自从:** + +8 + ### OH_Drawing_BitmapDestroy() - + ``` void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap * ) ``` -**Description:** +**描述:** 函数用于销毁位图对象并回收该对象占有内存。 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | + +**自从:** + +8 ### OH_Drawing_BitmapGetHeight() - + ``` uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap * ) ``` -**Description:** +**描述:** 函数用于获取指定位图的高度 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | -**Returns:** +**返回:** 函数返回位图的高度 +**自从:** + +8 + ### OH_Drawing_BitmapGetPixels() - + ``` void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap * ) ``` -**Description:** +**描述:** 函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | -**Returns:** +**返回:** 函数返回位图的像素地址 +**自从:** + +8 + ### OH_Drawing_BitmapGetWidth() - + ``` uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap * ) ``` -**Description:** +**描述:** 该函数用于获取指定位图的宽度 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | +| OH_Drawing_Bitmap | 参数是一个指向位图对象的指针 | -**Returns:** +**返回:** 函数返回位图的宽度 +**自从:** + +8 + ### OH_Drawing_BrushCreate() - + ``` OH_Drawing_Brush* OH_Drawing_BrushCreate (void ) ``` -**Description:** +**描述:** 函数用于创建一个画刷对象 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Returns:** +**返回:** 函数会返回一个指针,指针指向创建的画刷对象 +**自从:** + +8 + ### OH_Drawing_BrushDestroy() - + ``` void OH_Drawing_BrushDestroy (OH_Drawing_Brush * ) ``` -**Description:** +**描述:** 函数用于销毁画刷对象并回收该对象占有的内存。 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | + +**自从:** + +8 ### OH_Drawing_BrushGetColor() - + ``` uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush * ) ``` -**Description:** +**描述:** 函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | -**Returns:** +**返回:** 函数返回一个描述颜色的32位(ARGB)变量 +**自从:** + +8 + ### OH_Drawing_BrushIsAntiAlias() - + ``` bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush * ) ``` -**Description:** +**描述:** 函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | -**Returns:** +**返回:** 函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿 +**自从:** + +8 + ### OH_Drawing_BrushSetAntiAlias() - + ``` void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush * , bool ) ``` -**Description:** +**描述:** 函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | -| bool | 参数真为抗锯齿,参数假则不做抗锯齿处理 | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | +| bool | 参数真为抗锯齿,参数假则不做抗锯齿处理 | + +**自从:** + +8 ### OH_Drawing_BrushSetColor() - + ``` void OH_Drawing_BrushSetColor (OH_Drawing_Brush * , uint32_t color ) ``` -**Description:** +**描述:** 函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | -| color | 参数是一个描述颜色的32位(ARGB)变量 | +| OH_Drawing_Brush | 参数是一个指向画刷对象的指针 | +| color | 参数是一个描述颜色的32位(ARGB)变量 | + +**自从:** + +8 ### OH_Drawing_CanvasAttachBrush() - + ``` void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas * , const OH_Drawing_Brush * ) ``` -**Description:** +**描述:** 函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | -| OH_Drawing_Brush | 参数为一个指向画刷对象的指针 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Brush | 参数为一个指向画刷对象的指针 | + +**自从:** + +8 ### OH_Drawing_CanvasAttachPen() - + ``` void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas * , const OH_Drawing_Pen * ) ``` -**Description:** +**描述:** 函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | -| OH_Drawing_Pen | 参数为一个指向画笔对象的指针 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Pen | 参数为一个指向画笔对象的指针 | + +**自从:** + +8 ### OH_Drawing_CanvasBind() - + ``` void OH_Drawing_CanvasBind (OH_Drawing_Canvas * , OH_Drawing_Bitmap * ) ``` -**Description:** +**描述:** 函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染) -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | -| OH_Drawing_Bitmap | 参数为一个指向位图对象的指针 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Bitmap | 参数为一个指向位图对象的指针 | + +**自从:** + +8 ### OH_Drawing_CanvasClear() - + ``` void OH_Drawing_CanvasClear (OH_Drawing_Canvas * , uint32_t color ) ``` -**Description:** +**描述:** 函数用于使用指定颜色去清空画布 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | -| color | 参数为一个描述颜色的32位(ARGB)变量 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| color | 参数为一个描述颜色的32位(ARGB)变量 | + +**自从:** + +8 ### OH_Drawing_CanvasCreate() - + ``` OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void ) ``` -**Description:** +**描述:** 函数用于创建一个画布对象 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Returns:** +**返回:** 函数会返回一个指针,指针指向创建的画布对象 +**自从:** + +8 + ### OH_Drawing_CanvasDestroy() - + ``` void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas * ) ``` -**Description:** +**描述:** 函数用于销毁画布对象并回收该对象占有的内存 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数是一个指向画布对象的指针 | +| OH_Drawing_Canvas | 参数是一个指向画布对象的指针 | + +**自从:** + +8 ### OH_Drawing_CanvasDetachBrush() - + ``` void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas * ) ``` -**Description:** +**描述:** 函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | + +**自从:** + +8 ### OH_Drawing_CanvasDetachPen() - + ``` void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas * ) ``` -**Description:** +**描述:** 函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | + +**自从:** + +8 ### OH_Drawing_CanvasDrawLine() - + ``` void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas * , float x1, float y1, float x2, float y2 ) ``` -**Description:** +**描述:** 函数用于画一条直线段 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | -| x1 | 参数为线段起始点的横坐标 | -| y1 | 参数为线段起始点的纵坐标 | -| x2 | 参数为线段结束点的横坐标 | -| y2 | 参数为线段结束点的纵坐标 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| x1 | 参数为线段起始点的横坐标 | +| y1 | 参数为线段起始点的纵坐标 | +| x2 | 参数为线段结束点的横坐标 | +| y2 | 参数为线段结束点的纵坐标 | + +**自从:** + +8 ### OH_Drawing_CanvasDrawPath() - + ``` void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas * , const OH_Drawing_Path * ) ``` -**Description:** +**描述:** 函数用于画一个自定义路径 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | -| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | + +**自从:** + +8 ### OH_Drawing_CanvasRestore() - + ``` void OH_Drawing_CanvasRestore (OH_Drawing_Canvas * ) ``` -**Description:** +**描述:** 函数用于恢复保存在栈顶的画布状态(画布矩阵) -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | + +**自从:** + +8 ### OH_Drawing_CanvasSave() - + ``` void OH_Drawing_CanvasSave (OH_Drawing_Canvas * ) ``` -**Description:** +**描述:** 函数用于保存当前画布的状态(画布矩阵)到一个栈顶 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | +| OH_Drawing_Canvas | 参数为一个指向画布对象的指针 | + +**自从:** + +8 ### 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 +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| alpha | 参数为一个描述透明度的变量, 变量范围是0x00~0xFF | -| red | 参数为一个描述红色的变量, 变量范围是0x00~0xFF | -| green | 参数为一个描述绿色的变量, 变量范围是0x00~0xFF | -| blue | 参数为一个描述蓝色的变量, 变量范围是0x00~0xFF | +| alpha | 参数为一个描述透明度的变量, 变量范围是0x00~0xFF | +| red | 参数为一个描述红色的变量, 变量范围是0x00~0xFF | +| green | 参数为一个描述绿色的变量, 变量范围是0x00~0xFF | +| blue | 参数为一个描述蓝色的变量, 变量范围是0x00~0xFF | -**Returns:** +**返回:** 函数返回一个描述颜色的32位(ARGB)变量 +**自从:** + +8 + ### OH_Drawing_CreateFontCollection() - + ``` OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void ) ``` -**Description:** +**描述:** 创建OH_Drawing_FontCollection -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Returns:** +**返回:** 指向创建的OH_Drawing_FontCollection对象的指针 +**自从:** + +8 + ### OH_Drawing_CreateTextStyle() - + ``` OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void ) ``` -**Description:** +**描述:** 创建OH_Drawing_TextStyle -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Returns:** +**返回:** 指向创建的OH_Drawing_TextStyle对象的指针 +**自从:** + +8 + ### OH_Drawing_CreateTypography() - + ``` OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate * ) ``` -**Description:** +**描述:** 创建OH_Drawing_Typography -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | -**Returns:** +**返回:** 指向OH_Drawing_Typography对象的指针 +**自从:** + +8 + ### OH_Drawing_CreateTypographyHandler() - + ``` OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle * , OH_Drawing_FontCollection * ) ``` -**Description:** +**描述:** 创建指向OH_Drawing_TypographyCreate对象的指针 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle的指针 | -| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection的指针 | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle的指针 | +| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection的指针 | -**Returns:** +**返回:** 指向新创建的OH_Drawing_TypographyCreate对象的指针 +**自从:** + +8 + ### OH_Drawing_CreateTypographyStyle() - + ``` OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void ) ``` -**Description:** +**描述:** 创建OH_Drawing_TypographyStyle -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Returns:** +**返回:** 指向创建的OH_Drawing_TypographyStyle对象的指针 +**自从:** + +8 + ### OH_Drawing_DestroyFontCollection() - + ``` void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection * ) ``` -**Description:** +**描述:** 释放被OH_Drawing_FontCollection对象占据的内存 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针 | +| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针 | + +**自从:** + +8 ### OH_Drawing_DestroyTextStyle() - + ``` void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle * ) ``` -**Description:** +**描述:** 释放被OH_Drawing_TextStyle对象占据的内存 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | + +**自从:** + +8 ### OH_Drawing_DestroyTypography() - + ``` void OH_Drawing_DestroyTypography (OH_Drawing_Typography * ) ``` -**Description:** +**描述:** 释放OH_Drawing_Typography对象占据的内存 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针 | +| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针 | + +**自从:** + +8 ### OH_Drawing_DestroyTypographyHandler() - + ``` void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate * ) ``` -**Description:** +**描述:** 释放被OH_Drawing_TypographyCreate对象占据的内存 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | + +**自从:** + +8 ### OH_Drawing_DestroyTypographyStyle() - + ``` void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle * ) ``` -**Description:** +**描述:** 释放被OH_Drawing_TypographyStyle对象占据的内存 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | + +**自从:** + +8 ### 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 +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Path | 参数为一个指向路径对象的指针 | -| x1 | 参数为包围椭圆的矩形左上角点位置的横坐标 | -| y1 | 参数为包围椭圆的矩形左上角点位置的纵坐标 | -| x2 | 参数为包围椭圆的矩形右下角点位置的横坐标 | -| y3 | 参数为包围椭圆的矩形右下角点位置的纵坐标 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| x1 | 参数为包围椭圆的矩形左上角点位置的横坐标 | +| y1 | 参数为包围椭圆的矩形左上角点位置的纵坐标 | +| x2 | 参数为包围椭圆的矩形右下角点位置的横坐标 | +| y3 | 参数为包围椭圆的矩形右下角点位置的纵坐标 | + +**自从:** + +8 ### OH_Drawing_PathClose() - + ``` void OH_Drawing_PathClose (OH_Drawing_Path * ) ``` -**Description:** +**描述:** 函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | + +**自从:** + +8 ### OH_Drawing_PathCreate() - + ``` OH_Drawing_Path* OH_Drawing_PathCreate (void ) ``` -**Description:** +**描述:** 函数用于创建一个路径对象 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Returns:** +**返回:** 函数会返回一个指针,指针指向创建的路径对象 +**自从:** + +8 + ### 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 +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Path | 参数为一个指向路径对象的指针 | -| ctrlX1 | 参数为第一个控制点位置的横坐标 | -| ctrlY1 | 参数为第一个控制点位置的纵坐标 | -| ctrlX2 | 参数为第二个控制点位置的横坐标 | -| ctrlY2 | 参数为第二个控制点位置的纵坐标 | -| endX | 参数为目标点位置的横坐标 | -| endY | 参数为目标点位置的纵坐标 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| ctrlX1 | 参数为第一个控制点位置的横坐标 | +| ctrlY1 | 参数为第一个控制点位置的纵坐标 | +| ctrlX2 | 参数为第二个控制点位置的横坐标 | +| ctrlY2 | 参数为第二个控制点位置的纵坐标 | +| endX | 参数为目标点位置的横坐标 | +| endY | 参数为目标点位置的纵坐标 | + +**自从:** + +8 ### OH_Drawing_PathDestroy() - + ``` void OH_Drawing_PathDestroy (OH_Drawing_Path * ) ``` -**Description:** +**描述:** 函数用于销毁路径对象并回收该对象占有的内存 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | + +**自从:** + +8 ### OH_Drawing_PathLineTo() - + ``` void OH_Drawing_PathLineTo (OH_Drawing_Path * , float x, float y ) ``` -**Description:** +**描述:** 函数用于添加一条从路径的最后点位置到目标点位置的线段 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Path | 参数为一个指向路径对象的指针 | -| x | 参数为目标点的横坐标 | -| y | 参数为目标点的纵坐标 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| x | 参数为目标点的横坐标 | +| y | 参数为目标点的纵坐标 | + +**自从:** + +8 ### OH_Drawing_PathMoveTo() - + ``` void OH_Drawing_PathMoveTo (OH_Drawing_Path * , float x, float y ) ``` -**Description:** +**描述:** 函数用于设置自定义路径的起始点位置 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Path | 参数为一个指向路径对象的指针 | -| x | 参数为起始点的横坐标 | -| y | 参数为起始点的纵坐标 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| x | 参数为起始点的横坐标 | +| y | 参数为起始点的纵坐标 | + +**自从:** + +8 ### OH_Drawing_PathQuadTo() - + ``` void OH_Drawing_PathQuadTo (OH_Drawing_Path * , float ctrlX, float ctrlY, float endX, float endY ) ``` -**Description:** +**描述:** 函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Path | 参数为一个指向路径对象的指针 | -| ctrlX | 参数为控制点位置的横坐标 | -| ctrlY | 参数为控制点位置的纵坐标 | -| endX | 参数为目标点位置的横坐标 | -| endY | 参数为目标点位置的纵坐标 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| ctrlX | 参数为控制点位置的横坐标 | +| ctrlY | 参数为控制点位置的纵坐标 | +| endX | 参数为目标点位置的横坐标 | +| endY | 参数为目标点位置的纵坐标 | + +**自从:** + +8 ### OH_Drawing_PathReset() - + ``` void OH_Drawing_PathReset (OH_Drawing_Path * ) ``` -**Description:** +**描述:** 函数用于重置自定义路径数据 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Path | 参数为一个指向路径对象的指针 | +| OH_Drawing_Path | 参数为一个指向路径对象的指针 | + +**自从:** + +8 ### OH_Drawing_PenCreate() - + ``` OH_Drawing_Pen* OH_Drawing_PenCreate (void ) ``` -**Description:** +**描述:** 函数用于创建一个画笔对象 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Returns:** +**返回:** 函数会返回一个指针,指针指向创建的画笔对象 +**自从:** + +8 + ### OH_Drawing_PenDestroy() - + ``` void OH_Drawing_PenDestroy (OH_Drawing_Pen * ) ``` -**Description:** +**描述:** 函数用于销毁画笔对象并回收该对象占有的内存 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | + +**自从:** + +8 ### OH_Drawing_PenGetCap() - + ``` OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen * ) ``` -**Description:** +**描述:** 函数用于获取画笔笔帽的样式 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -**Returns:** +**返回:** 函数返回画笔笔帽样式 +**自从:** + +8 + ### OH_Drawing_PenGetColor() - + ``` uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen * ) ``` -**Description:** +**描述:** 函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -**Returns:** +**返回:** 函数返回一个描述颜色的32位(ARGB)变量 +**自从:** + +8 + ### OH_Drawing_PenGetJoin() - + ``` OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen * ) ``` -**Description:** +**描述:** 函数用于获取画笔绘制折线转角的样式 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -**Returns:** +**返回:** 函数返回折线转角的样式 +**自从:** + +8 + ### OH_Drawing_PenGetMiterLimit() - + ``` float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen * ) ``` -**Description:** +**描述:** 函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -**Returns:** +**返回:** 函数返回尖角的限制值 +**自从:** + +8 + ### OH_Drawing_PenGetWidth() - + ``` float OH_Drawing_PenGetWidth (const OH_Drawing_Pen * ) ``` -**Description:** +**描述:** 函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -**Returns:** +**返回:** 函数返回画笔的厚度 +**自从:** + +8 + ### OH_Drawing_PenIsAntiAlias() - + ``` bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen * ) ``` -**Description:** +**描述:** 函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -**Returns:** +**返回:** 函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿 +**自从:** + +8 + ### OH_Drawing_PenSetAntiAlias() - + ``` void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen * , bool ) ``` -**Description:** +**描述:** 函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -| bool | 参数真为抗锯齿,参数假则不做抗锯齿处理 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| bool | 参数真为抗锯齿,参数假则不做抗锯齿处理 | + +**自从:** + +8 ### OH_Drawing_PenSetCap() - + ``` void OH_Drawing_PenSetCap (OH_Drawing_Pen * , OH_Drawing_PenLineCapStyle ) ``` -**Description:** +**描述:** 函数用于设置画笔笔帽样式 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -| OH_Drawing_PenLineCapStyle | 参数是一个描述画笔笔帽样式的变量 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_PenLineCapStyle | 参数是一个描述画笔笔帽样式的变量 | + +**自从:** + +8 ### OH_Drawing_PenSetColor() - + ``` void OH_Drawing_PenSetColor (OH_Drawing_Pen * , uint32_t color ) ``` -**Description:** +**描述:** 函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -| color | 参数是一个描述颜色的32位(ARGB)变量 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| color | 参数是一个描述颜色的32位(ARGB)变量 | + +**自从:** + +8 ### OH_Drawing_PenSetJoin() - + ``` void OH_Drawing_PenSetJoin (OH_Drawing_Pen * , OH_Drawing_PenLineJoinStyle ) ``` -**Description:** +**描述:** 函数用于设置画笔绘制转角的样式 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -| OH_Drawing_PenLineJoinStyle | 参数值一个描述折线转角样式的变量 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| OH_Drawing_PenLineJoinStyle | 参数值一个描述折线转角样式的变量 | + +**自从:** + +8 ### OH_Drawing_PenSetMiterLimit() - + ``` void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen * , float miter ) ``` -**Description:** +**描述:** 函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -| miter | 参数是一个描述尖角限制值的变量 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| miter | 参数是一个描述尖角限制值的变量 | + +**自从:** + +8 ### OH_Drawing_PenSetWidth() - + ``` void OH_Drawing_PenSetWidth (OH_Drawing_Pen * , float width ) ``` -**Description:** +**描述:** 函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | -| width | 参数是一个描述画笔厚度的变量 | +| OH_Drawing_Pen | 参数是一个指向画笔对象的指针 | +| width | 参数是一个描述画笔厚度的变量 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleBaseLine() - + ``` void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle * , int ) ``` -**Description:** +**描述:** 设置字体基线位置 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| int | OH_Drawing_TextBaseline枚举类型 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | OH_Drawing_TextBaseline枚举类型 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleColor() - + ``` void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle * , uint32_t ) ``` -**Description:** +**描述:** 设置文本颜色 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| uint32_t | 颜色 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| uint32_t | 颜色 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleDecoration() - + ``` void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle * , int ) ``` -**Description:** +**描述:** 设置装饰 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| int | OH_Drawing_TextDecoration枚举类型 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | OH_Drawing_TextDecoration枚举类型 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleDecorationColor() - + ``` void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle * , uint32_t ) ``` -**Description:** +**描述:** 设置装饰颜色 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| uint32_t | 颜色 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| uint32_t | 颜色 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleFontFamilies() - + ``` void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle * , int , const char * fontFamilies[] ) ``` -**Description:** +**描述:** 设置字体类型 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| int | 字体名称数量 | -| char | 指向字体类型的指针 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | 字体名称数量 | +| char | 指向字体类型的指针 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleFontHeight() - + ``` void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle * , double ) ``` -**Description:** +**描述:** 设置字体高度 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| double | 字体高度 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| double | 字体高度 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleFontSize() - + ``` void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle * , double ) ``` -**Description:** +**描述:** 设置字号 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| double | 字号 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| double | 字号 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleFontStyle() - + ``` void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle * , int ) ``` -**Description:** +**描述:** 设置字体风格 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| int | OH_Drawing_FontStyle枚举类型 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | OH_Drawing_FontStyle枚举类型 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleFontWeight() - + ``` void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle * , int ) ``` -**Description:** +**描述:** 设置字重 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| int | OH_Drawing_FontWeight枚举类型 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| int | OH_Drawing_FontWeight枚举类型 | + +**自从:** + +8 ### OH_Drawing_SetTextStyleLocale() - + ``` void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle * , const char * ) ``` -**Description:** +**描述:** 设置语言区域 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | -| char | 语言区域,数据类型为指向char的指针 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| char | 语言区域,数据类型为指向char的指针 | + +**自从:** + +8 ### OH_Drawing_SetTypographyTextAlign() - + ``` void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle * , int ) ``` -**Description:** +**描述:** 设置文本对齐方式 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | -| int | OH_Drawing_TextAlign枚举类型 | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | +| int | OH_Drawing_TextAlign枚举类型 | + +**自从:** + +8 ### OH_Drawing_SetTypographyTextDirection() - + ``` void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle * , int ) ``` -**Description:** +**描述:** 设置文本方向 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | -| int | OH_Drawing_TextDirection枚举类型 | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | +| int | OH_Drawing_TextDirection枚举类型 | + +**自从:** + +8 ### OH_Drawing_SetTypographyTextMaxLines() - + ``` void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle * , int ) ``` -**Description:** +**描述:** 设置文本最大行数 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | -| int | 最大行数 | +| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针 | +| int | 最大行数 | + +**自从:** + +8 ### OH_Drawing_TypographyHandlerAddText() - + ``` void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate * , const char * ) ``` -**Description:** +**描述:** 设置文本内容 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | -| char | 指向文本内容的指针 | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | +| char | 指向文本内容的指针 | + +**自从:** +8 + + +### OH_Drawing_TypographyHandlerPopTextStyle() -### OH_Drawing_TypographyHandlerPop() - ``` -void OH_Drawing_TypographyHandlerPop (OH_Drawing_TypographyCreate * ) +void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate * ) ``` -**Description:** +**描述:** 排版弹出 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | + +**自从:** + +8 -### OH_Drawing_TypographyHandlerPushStyle() +### OH_Drawing_TypographyHandlerPushTextStyle() + - ``` -void OH_Drawing_TypographyHandlerPushStyle (OH_Drawing_TypographyCreate * , OH_Drawing_TextStyle * ) +void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate * , OH_Drawing_TextStyle * ) ``` -**Description:** +**描述:** 设置排版风格 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | -| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | +| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针 | +| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针 | + +**自从:** + +8 ### OH_Drawing_TypographyLayout() - + ``` void OH_Drawing_TypographyLayout (OH_Drawing_Typography * , double ) ``` -**Description:** +**描述:** 排版布局 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针 | -| double | 文本最大宽度 | +| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针 | +| double | 文本最大宽度 | + +**自从:** + +8 ### OH_Drawing_TypographyPaint() - + ``` void OH_Drawing_TypographyPaint (OH_Drawing_Typography * , OH_Drawing_Canvas * , double , double ) ``` -**Description:** +**描述:** 显示文本 -\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针 | -| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针 | -| double | x坐标 | -| double | y坐标 | +| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针 | +| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针 | +| double | x坐标 | +| double | y坐标 | + +**自从:** + +8 diff --git a/zh-cn/application-dev/reference/native-apis/_hi_log.md b/zh-cn/application-dev/reference/native-apis/_hi_log.md index b35c12ae48fe6fd1623808141badf036c89f7edc..dd52859890b93c7b1f3ceb7e550eb4abe218b9c0 100644 --- a/zh-cn/application-dev/reference/native-apis/_hi_log.md +++ b/zh-cn/application-dev/reference/native-apis/_hi_log.md @@ -1,327 +1,372 @@ # HiLog -## **Overview** - -**Description:** - HiLog模块实现日志打印功能。 + 开发者可以通过使用这些接口实现日志相关功能,输出日志时可以指定日志类型、所属业务领域、日志TAG标识、日志级别等。 -\@syscap SystemCapability.HiviewDFX.HiLog -**Since:** +@syscap SystemCapability.HiviewDFX.HiLog + + +**自从:** + 8 -## **Summary** +## 汇总 -### Files +### 文件 - | File Name | Description | +| 文件名称 | 描述 | | -------- | -------- | -| [log.h](log_8h.md) | HiLog模块日志接口定义,通过这些接口实现日志打印相关功能。 | +| [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级别写日志,宏封装接口。 | +| [LOG_DOMAIN](#log_domain) 0 | 日志所对应的业务领域,用于标识业务的子系统、模块。 | +| [LOG_TAG](#log_tag) NULL | 字符串常量,标识调用所在的类或者业务。 | +| [OH_LOG_DEBUG](#oh_log_debug)(type, ...) ((void)[OH_LOG_Print](#oh_log_print)((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, \__VA_ARGS__)) | DEBUG级别写日志,宏封装接口。 | +| [OH_LOG_INFO](#oh_log_info)(type, ...) ((void)[OH_LOG_Print](#oh_log_print)((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, \__VA_ARGS__)) | INFO级别写日志,宏封装接口。 | +| [OH_LOG_WARN](#oh_log_warn)(type, ...) ((void)[OH_LOG_Print](#oh_log_print)((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, \__VA_ARGS__)) | WARN级别写日志,宏封装接口。 | +| [OH_LOG_ERROR](#oh_log_error)(type, ...) ((void)[OH_LOG_Print](#oh_log_print)((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, \__VA_ARGS__)) | ERROR级别写日志,宏封装接口。 | +| [OH_LOG_FATAL](#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 } | 日志级别。 | +| [LogType](#logtype) { LOG_APP= 0 } | 日志类型。 | +| [LogLevel](#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、级别的日志是否可以打印。 | +| [OH_LOG_Print](#oh_log_print) ([LogType](#logtype) type, [LogLevel](#loglevel) level, unsigned int domain, const char \*tag, const char \*fmt,...) \_\_attribute\_\_((\_\_format\_\_(os\_log | 写日志接口。 | +| [OH_LOG_IsLoggable](#oh_log_isloggable) (unsigned int domain, const char \*tag, [LogLevel](#loglevel) level) | 检查指定业务领域、TAG、级别的日志是否可以打印。 | -## **Details** +## 详细描述 -## **Macro Definition** +## 宏定义说明 ### LOG_DOMAIN - + ``` #define LOG_DOMAIN 0 ``` -**Description:** +**描述:** 日志所对应的业务领域,用于标识业务的子系统、模块。 16进制整数,有效范围0x0~0xFFFF,超过自动截掉高位。 +**自从:** + +8 + ### LOG_TAG - + ``` #define LOG_TAG NULL ``` -**Description:** +**描述:** 字符串常量,标识调用所在的类或者业务。 +**自从:** + +8 + ### 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 | +| Name | 描述 | | -------- | -------- | -| type | 日志类型,三方应用日志类型为LOG_APP。 | -| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | -| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | +| type | 日志类型,三方应用日志类型为LOG_APP。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | -**See also:** +**参见:** [OH_LOG_Print](#oh_log_print) +**自从:** + +8 + ### 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 | +| Name | 描述 | | -------- | -------- | -| type | 日志类型,三方应用日志类型为LOG_APP。 | -| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | -| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | +| type | 日志类型,三方应用日志类型为LOG_APP。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | -**See also:** +**参见:** [OH_LOG_Print](#oh_log_print) +**自从:** + +8 + ### 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 | +| Name | 描述 | | -------- | -------- | -| type | 日志类型,三方应用日志类型为LOG_APP。 | -| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | -| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | +| type | 日志类型,三方应用日志类型为LOG_APP。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | -**See also:** +**参见:** [OH_LOG_Print](#oh_log_print) +**自从:** + +8 + ### 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 | +| Name | 描述 | | -------- | -------- | -| type | 日志类型,三方应用日志类型为LOG_APP。 | -| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | -| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | +| type | 日志类型,三方应用日志类型为LOG_APP。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | -**See also:** +**参见:** [OH_LOG_Print](#oh_log_print) +**自从:** + +8 + + ### 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 | +| Name | 描述 | | -------- | -------- | -| type | 日志类型,三方应用日志类型为LOG_APP。 | -| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | -| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | +| type | 日志类型,三方应用日志类型为LOG_APP。 | +| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | +| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | -**See also:** +**参见:** [OH_LOG_Print](#oh_log_print) +**自从:** -## **Enumeration Type** +8 + + +## 枚举类型说明 ### LogLevel - + ``` enum LogLevel ``` -**Description:** +**描述:** 日志级别。 该枚举类型用于定义日志级别。 -各级别建议使用方式: +各级别建议使用方式: -DEBUG:比INFO级别更详细的流程记录,通过该级别的日志可以更详细地分析业务流程和定位分析问题。DEBUG级别的日志在正式发布版本中默认不会被打印,只有在调试版本或打开调试开关的情况下才会打印。 +DEBUG:比INFO级别更详细的流程记录,通过该级别的日志可以更详细地分析业务流程和定位分析问题。DEBUG级别的日志在正式发布版本中默认不会被打印,只有在调试版本或打开调试开关的情况下才会打印。 -INFO:用来记录业务关键流程节点,可以还原业务的主要运行过程;用来记录非正常情况信息,但这些情况都是可以预期的(如无网络信号、登录失败等)。这些日志都应该由该业务内处于支配地位的模块来记录,避免在多个被调用的模块或低级函数中重复记录。 +INFO:用来记录业务关键流程节点,可以还原业务的主要运行过程;用来记录非正常情况信息,但这些情况都是可以预期的(如无网络信号、登录失败等)。这些日志都应该由该业务内处于支配地位的模块来记录,避免在多个被调用的模块或低级函数中重复记录。 WARN:发生了较为严重的非预期情况,但是对用户影响不大,程序可以自动恢复或通过简单的操作就可以恢复的问题。 -ERROR:程序或功能发生了错误,该错误会影响功能的正常运行或用户的正常使用,可以恢复但恢复代价较高,如重置数据等。 +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接口打印 | +| 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接口打印 | + +**自从:** + +8 ### LogType - + ``` enum LogType ``` -**Description:** +**描述:** 日志类型。 该枚举类型用于定义应用开发者可以使用的日志类型。当前有应用日志LOG_APP。 - | Enumerator | Description | +| 枚举值 | 描述 | | -------- | -------- | -| LOG_APP | 应用日志 | +| LOG_APP | 应用日志 | + +**自从:** + +8 -## **Function** +## 函数说明 ### OH_LOG_IsLoggable() - + ``` int bool OH_LOG_IsLoggable (unsigned int domain, const char * tag, LogLevel level ) ``` -**Description:** +**描述:** 检查指定业务领域、TAG、级别的日志是否可以打印。 -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| domain | 指定日志业务领域。 | -| tag | 指定日志TAG。 | -| level | 指定日志level。 | +| domain | 指定日志业务领域。 | +| tag | 指定日志TAG。 | +| level | 指定日志level。 | -**Returns:** +**返回:** 如果指定domain、tag、level日志可以打印则返回true;否则返回false。 +**自从:** + +8 + ### 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 | +| Name | 描述 | | -------- | -------- | -| type | 日志类型,三方应用日志类型为LOG_APP。 | -| level | 日志级别,日志级别包括LOG_DEBUG、LOG_INFO、LOG_WARN、LOG_ERROR、LOG_FATAL。 | -| domain | 日志业务领域,16进制整数,范围0x0~0xFFFF。 | -| tag | 日志TAG,字符串,标识调用所在的类或者业务。 | -| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 | -| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 | +| 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表示失败。 + +**自从:** + +8 diff --git a/zh-cn/application-dev/reference/native-apis/_native___bundle.md b/zh-cn/application-dev/reference/native-apis/_native___bundle.md deleted file mode 100644 index 4322e5a5e98beea1df053a900b79442f25828e6e..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/native-apis/_native___bundle.md +++ /dev/null @@ -1,61 +0,0 @@ -# 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_vsync.md b/zh-cn/application-dev/reference/native-apis/_native_vsync.md new file mode 100644 index 0000000000000000000000000000000000000000..08fc54aaca63afcfe998947f82453547e222374a --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_native_vsync.md @@ -0,0 +1,121 @@ +# NativeVsync + + +提供NativeVsync功能。 + + +@syscap SystemCapability.Graphic.Graphic2D.NativeVsync + + +**自从:** + + +8 + + +## 汇总 + + +### 文件 + +| 文件名称 | 描述 | +| -------- | -------- | +| [native_vsync.h](native__vsync_8h.md) | 定义获取和使用NativeVsync的相关函数 | + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_NativeVSync_Create](#oh_nativevsync_create) (const char \*name, unsigned int length) | 创建一个OH_NativeVSync实例,每次调用都会产生一个新的实例 | +| [OH_NativeVSync_Destroy](#oh_nativevsync_destroy) (OH_NativeVSync \*nativeVsync) | 销毁OH_NativeVSync实例 | +| [OH_NativeVSync_RequestFrame](#oh_nativevsync_requestframe) (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | 请求下一次vsync信号,当信号到来时,调用回调函数callback | + + +## 详细描述 + + +## 函数说明 + + +### OH_NativeVSync_Create() + + +``` +OH_NativeVSync* OH_NativeVSync_Create (const char * name, unsigned int length ) +``` + +**描述:** + +创建一个OH_NativeVSync实例,每次调用都会产生一个新的实例 + +@syscap SystemCapability.Graphic.Graphic2D.NativeVsync + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| name | 参数表示一个vsync连接的名字 | +| length | 参数是name的长度 | + +**返回:** + +返回一个指向OH_NativeVSync实例的指针 + +**自从:** + +8 + + +### OH_NativeVSync_Destroy() + + +``` +void OH_NativeVSync_Destroy (OH_NativeVSync * nativeVsync) +``` + +**描述:** + +销毁OH_NativeVSync实例 + +@syscap SystemCapability.Graphic.Graphic2D.NativeVsync + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| nativeVsync | 参数是一个指向OH_NativeVSync实例的指针 | + +**自从:** + +8 + + +### OH_NativeVSync_RequestFrame() + + +``` +int OH_NativeVSync_RequestFrame (OH_NativeVSync * nativeVsync, OH_NativeVSync_FrameCallback callback, void * data ) +``` + +**描述:** + +请求下一次vsync信号,当信号到来时,调用回调函数callback + +@syscap SystemCapability.Graphic.Graphic2D.NativeVsync + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| nativeVsync | 参数是一个指向OH_NativeVSync实例的指针 | +| callback | 参数是一个OH_NativeVSync_FrameCallback类型的函数指针,当下一次vsync信号到来时会被调用 | +| data | 参数是一个指向用户自定义数据结构的指针,类型是void\* | + +**返回:** + +返回一个由GSError定义的int32_t类型的错误码 + +**自从:** + +8 diff --git a/zh-cn/application-dev/reference/native-apis/_native_window.md b/zh-cn/application-dev/reference/native-apis/_native_window.md index 7c5ae2c90a23c56f832981bf0b0e87dd1f7d09c8..4e1d2e9c9e251f034c2efeaf567239c9446f898a 100644 --- a/zh-cn/application-dev/reference/native-apis/_native_window.md +++ b/zh-cn/application-dev/reference/native-apis/_native_window.md @@ -1,339 +1,382 @@ # NativeWindow -## **Overview** - -**Description:** - 提供NativeWindow功能,主要用来和egl对接 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Since:** +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -8 -**Version:** +**自从:** -1.0 +8 -## **Summary** +## 汇总 -### Files - | File Name | Description | +### 文件 + +| 文件名称 | 描述 | | -------- | -------- | -| [external_window.h](external__window_8h.md) | 定义获取和使用NativeWindow的相关函数 | +| [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 | +| [OH_NativeWindow_CreateNativeWindowFromSurface](#oh_nativewindow_createnativewindowfromsurface) (void \*pSurface) | 创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例 | +| [OH_NativeWindow_DestroyNativeWindow](#oh_nativewindow_destroynativewindow) (struct NativeWindow \*window) | 将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉 | +| [OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer](#oh_nativewindow_createnativewindowbufferfromsurfacebuffer) (void \*pSurfaceBuffer) | 创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例 | +| [OH_NativeWindow_DestroyNativeWindowBuffer](#oh_nativewindow_destroynativewindowbuffer) (struct NativeWindowBuffer \*buffer) | 将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉 | +| [OH_NativeWindow_NativeWindowRequestBuffer](#oh_nativewindow_nativewindowrequestbuffer) (struct NativeWindow \*window, struct NativeWindowBuffer \*\*buffer, int \*fenceFd) | 通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产 | +| [OH_NativeWindow_NativeWindowFlushBuffer](#oh_nativewindow_nativewindowflushbuffer) (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer, int fenceFd, Region region) | 通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费 | +| [OH_NativeWindow_NativeWindowCancelBuffer](#oh_nativewindow_nativewindowcancelbuffer) (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer) | 通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请 | +| [OH_NativeWindow_NativeWindowHandleOpt](#oh_nativewindow_nativewindowhandleopt) (struct NativeWindow \*window, int code,...) | 设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等 | +| [OH_NativeWindow_GetBufferHandleFromNative](#oh_nativewindow_getbufferhandlefromnative) (struct NativeWindowBuffer \*buffer) | 通过NativeWindowBuffer获取该buffer的BufferHandle指针 | +| [OH_NativeWindow_NativeObjectReference](#oh_nativewindow_nativeobjectreference) (void \*obj) | 增加一个NativeObject的引用计数 | +| [OH_NativeWindow_NativeObjectUnreference](#oh_nativewindow_nativeobjectunreference) (void \*obj) | 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉 | +| [OH_NativeWindow_GetNativeObjectMagic](#oh_nativewindow_getnativeobjectmagic) (void \*obj) | 获取NativeObject的MagicId | -## **Details** +## 详细描述 -## **Function** +## 函数说明 ### OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer() - + ``` struct NativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void * pSurfaceBuffer) ``` -**Description:** +**描述:** 创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| pSurfaceBuffer | 参数是一个指向生产者buffer的指针,类型为sptr<OHOS::SurfaceBuffer> | +| pSurfaceBuffer | 参数是一个指向生产者buffer的指针,类型为sptr<OHOS::SurfaceBuffer> | -**Returns:** +**返回:** 返回一个指针,指向NativeWindowBuffer的结构体实例 +**自从:** + +8 + ### OH_NativeWindow_CreateNativeWindowFromSurface() - + ``` struct NativeWindow* OH_NativeWindow_CreateNativeWindowFromSurface (void * pSurface) ``` -**Description:** +**描述:** 创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| pSurface | 参数是一个指向生产者ProduceSurface的指针,类型为sptr<OHOS::Surface> | +| pSurface | 参数是一个指向生产者ProduceSurface的指针,类型为sptr<OHOS::Surface> | -**Returns:** +**返回:** 返回一个指针,指向NativeWindow的结构体实例 +**自从:** + +8 + ### OH_NativeWindow_DestroyNativeWindow() - + ``` void OH_NativeWindow_DestroyNativeWindow (struct NativeWindow * window) ``` -**Description:** +**描述:** 将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| window | 参数是一个NativeWindow的结构体实例的指针 | +| window | 参数是一个NativeWindow的结构体实例的指针 | + +**自从:** + +8 ### OH_NativeWindow_DestroyNativeWindowBuffer() - + ``` void OH_NativeWindow_DestroyNativeWindowBuffer (struct NativeWindowBuffer * buffer) ``` -**Description:** +**描述:** 将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | + +**自从:** + +8 ### OH_NativeWindow_GetBufferHandleFromNative() - + ``` BufferHandle* OH_NativeWindow_GetBufferHandleFromNative (struct NativeWindowBuffer * buffer) ``` -**Description:** +**描述:** 通过NativeWindowBuffer获取该buffer的BufferHandle指针 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | -**Returns:** +**返回:** BufferHandle 返回一个指针,指向BufferHandle的结构体实例 +**自从:** + +8 + ### OH_NativeWindow_GetNativeObjectMagic() - + ``` int32_t OH_NativeWindow_GetNativeObjectMagic (void * obj) ``` -**Description:** +**描述:** 获取NativeObject的MagicId -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| obj | 参数是一个NativeWindow or NativeWindowBuffer的结构体实例的指针 | +| obj | 参数是一个NativeWindow or NativeWindowBuffer的结构体实例的指针 | -**Returns:** +**返回:** MagicId 返回值为魔鬼数字,每个NativeObject唯一 +**自从:** + +8 + ### OH_NativeWindow_NativeObjectReference() - + ``` int32_t OH_NativeWindow_NativeObjectReference (void * obj) ``` -**Description:** +**描述:** 增加一个NativeObject的引用计数 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| obj | 参数是一个NativeWindow or NativeWindowBuffer的结构体实例的指针 | +| obj | 参数是一个NativeWindow or NativeWindowBuffer的结构体实例的指针 | -**Returns:** +**返回:** GSError 返回值为错误码 +**自从:** + +8 + ### OH_NativeWindow_NativeObjectUnreference() - + ``` int32_t OH_NativeWindow_NativeObjectUnreference (void * obj) ``` -**Description:** +**描述:** 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| obj | 参数是一个NativeWindow or NativeWindowBuffer的结构体实例的指针 | +| obj | 参数是一个NativeWindow or NativeWindowBuffer的结构体实例的指针 | -**Returns:** +**返回:** GSError +**自从:** + +8 + ### OH_NativeWindow_NativeWindowCancelBuffer() - + ``` int32_t OH_NativeWindow_NativeWindowCancelBuffer (struct NativeWindow * window, struct NativeWindowBuffer * buffer ) ``` -**Description:** +**描述:** 通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| window | 参数是一个NativeWindow的结构体实例的指针 | -| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | +| window | 参数是一个NativeWindow的结构体实例的指针 | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | -**Returns:** +**返回:** GSError 返回值为错误码 +**自从:** + +8 + ### 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 +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| window | 参数是一个NativeWindow的结构体实例的指针 | -| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | -| fenceFd | 参数是一个文件描述符句柄,用以同步时序 | -| region | 参数表示一块脏区域,该区域有内容更新 | +| window | 参数是一个NativeWindow的结构体实例的指针 | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 | +| fenceFd | 参数是一个文件描述符句柄,用以同步时序 | +| region | 参数表示一块脏区域,该区域有内容更新 | -**Returns:** +**返回:** GSError 返回值为错误码 +**自从:** + +8 + ### OH_NativeWindow_NativeWindowHandleOpt() - + ``` int32_t OH_NativeWindow_NativeWindowHandleOpt (struct NativeWindow * window, int code, ... ) ``` -**Description:** +**描述:** 设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| window | 参数是一个NativeWindow的结构体实例的指针 | -| code | 操作码 | +| window | 参数是一个NativeWindow的结构体实例的指针 | +| code | 操作码 | -**Returns:** +**返回:** GSError 返回值为错误码 +**自从:** + +8 + ### OH_NativeWindow_NativeWindowRequestBuffer() - + ``` int32_t OH_NativeWindow_NativeWindowRequestBuffer (struct NativeWindow * window, struct NativeWindowBuffer ** buffer, int * fenceFd ) ``` -**Description:** +**描述:** 通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产 -\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow +@syscap SystemCapability.Graphic.Graphic2D.NativeWindow -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| window | 参数是一个NativeWindow的结构体实例的指针 | -| buffer | 参数是一个NativeWindowBuffer的结构体实例的二级指针 | -| fenceFd | 参数是一个文件描述符句柄 | +| window | 参数是一个NativeWindow的结构体实例的指针 | +| buffer | 参数是一个NativeWindowBuffer的结构体实例的二级指针 | +| fenceFd | 参数是一个文件描述符句柄 | -**Returns:** +**返回:** GSError 返回值为错误码 + +**自从:** + +8 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 index bf5350217d0d00e80a19b521a2d9289c46f17085..fdfba39de3ff0fcd601a389700ab86a09ba93788 100644 --- 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 @@ -1,40 +1,31 @@ # OH_Drawing_BitmapFormat -## **Overview** - -**Related Modules:** - -[Drawing](_drawing.md) - -**Description:** +## 概述 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 -**Since:** +**自从:** 8 -**Version:** +**相关模块:** -1.0 +[Drawing](_drawing.md) -## **Summary** +## 汇总 -### Public Attributes +### 成员变量 - | Public Attribute Name | Description | + | 成员变量名称 | 描述 | | -------- | -------- | -| colorFormat | | -| alphaFormat | | - - -## **Details** +| [colorFormat](#colorformat) | 描述位图像素的透明度分量 | +| [alphaFormat](#alphaformat) | 描述位图像素的存储格式 | -## **Member Data** +## 结构体成员变量说明 ### alphaFormat @@ -44,7 +35,7 @@ OH_Drawing_AlphaFormat OH_Drawing_BitmapFormat::alphaFormat ``` -**Description:** +**描述:** 描述位图像素的透明度分量 @@ -56,6 +47,6 @@ OH_Drawing_AlphaFormat OH_Drawing_BitmapFormat::alphaFormat OH_Drawing_ColorFormat OH_Drawing_BitmapFormat::colorFormat ``` -**Description:** +**描述:** 描述位图像素的存储格式 diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_buffer.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_buffer.md new file mode 100644 index 0000000000000000000000000000000000000000..42f48deda91d5a7f547862abbec2b26c0e09298d --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_buffer.md @@ -0,0 +1,243 @@ +# OH_NativeBuffer + + +提供NativeBuffer功能 + + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + + +**自从:** + + +9 + + +## 汇总 + + +### 文件 + +| 文件名称 | 描述 | +| -------- | -------- | +| [native_buffer.h](native__buffer_8h.md) | 定义获取和使用NativeBuffer的相关函数 | + + +### 结构体 + +| 结构体名称 | 描述 | +| -------- | -------- | +| [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) | OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性 | + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_NativeBuffer_Alloc](#oh_nativebuffer_alloc) (const [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) \*config) | 通过OH_NativeBuffer_Config创建OH_NativeBuffer实例,每次调用都会产生一个新的OH_NativeBuffer实例 | +| [OH_NativeBuffer_Reference](#oh_nativebuffer_reference) (OH_NativeBuffer \*buffer) | 将OH_NativeBuffer对象的引用计数加1 | +| [OH_NativeBuffer_Unreference](#oh_nativebuffer_unreference) (OH_NativeBuffer \*buffer) | 将OH_NativeBuffer对象的引用计数减1,当引用计数为0的时候,该NativeBuffer对象会被析构掉 | +| [OH_NativeBuffer_GetConfig](#oh_nativebuffer_getconfig) (OH_NativeBuffer \*buffer, [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) \*config) | 用于获取OH_NativeBuffer的属性 | +| [OH_NativeBuffer_Map](#oh_nativebuffer_map) (OH_NativeBuffer \*buffer, void \*\*virAddr) | 将OH_NativeBuffer对应的ION内存映射到进程空间 | +| [OH_NativeBuffer_Unmap](#oh_nativebuffer_unmap) (OH_NativeBuffer \*buffer) | 将OH_NativeBuffer对应的ION内存从进程空间移除 | +| [OH_NativeBuffer_GetSeqNum](#oh_nativebuffer_getseqnum) (OH_NativeBuffer \*buffer) | 获取OH_NativeBuffer的序列号 | + + +## 详细描述 + + +## 函数说明 + + +### OH_NativeBuffer_Alloc() + + +``` +OH_NativeBuffer* OH_NativeBuffer_Alloc (const OH_NativeBuffer_Config * config) +``` + +**描述:** + +通过OH_NativeBuffer_Config创建OH_NativeBuffer实例,每次调用都会产生一个新的OH_NativeBuffer实例 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| config | 参数是一个指向OH_NativeBuffer属性的指针,类型为OH_NativeBuffer_Config | + +**返回:** + +创建成功则返回一个指向OH_NativeBuffer结构体实例的指针,否则返回NULL + +**自从:** + +9 + + +### OH_NativeBuffer_GetConfig() + + +``` +void OH_NativeBuffer_GetConfig (OH_NativeBuffer * buffer, OH_NativeBuffer_Config * config ) +``` + +**描述:** + +用于获取OH_NativeBuffer的属性 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| buffer | 参数是一个指向OH_NativeBuffer实例的指针 | +| config | 参数是一个指向OH_NativeBuffer_Config的指针,用于接收OH_NativeBuffer的属性 | + +**自从:** + +9 + + +### OH_NativeBuffer_GetSeqNum() + + +``` +uint32_t OH_NativeBuffer_GetSeqNum (OH_NativeBuffer * buffer) +``` + +**描述:** + +获取OH_NativeBuffer的序列号 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| buffer | 参数是一个指向OH_NativeBuffer实例的指针 | + +**返回:** + +返回对应OH_NativeBuffer的唯一序列号 + +**自从:** + +9 + + +### OH_NativeBuffer_Map() + + +``` +int32_t OH_NativeBuffer_Map (OH_NativeBuffer * buffer, void ** virAddr ) +``` + +**描述:** + +将OH_NativeBuffer对应的ION内存映射到进程空间 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| buffer | 参数是一个指向OH_NativeBuffer实例的指针 | +| virAddr | 参数是一个二级指针,二级指针指向虚拟内存的地址 | + +**返回:** + +返回一个由GSError定义的int32_t类型的错误码 + +**自从:** + +9 + + +### OH_NativeBuffer_Reference() + + +``` +int32_t OH_NativeBuffer_Reference (OH_NativeBuffer * buffer) +``` + +**描述:** + +将OH_NativeBuffer对象的引用计数加1 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| buffer | 参数是一个指向OH_NativeBuffer实例的指针 | + +**返回:** + +返回一个由GSError定义的int32_t类型的错误码 + +**自从:** + +9 + + +### OH_NativeBuffer_Unmap() + + +``` +int32_t OH_NativeBuffer_Unmap (OH_NativeBuffer * buffer) +``` + +**描述:** + +将OH_NativeBuffer对应的ION内存从进程空间移除 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| buffer | 参数是一个指向OH_NativeBuffer实例的指针 | + +**返回:** + +返回一个由GSError定义的int32_t类型的错误码 + +**自从:** + +9 + + +### OH_NativeBuffer_Unreference() + + +``` +int32_t OH_NativeBuffer_Unreference (OH_NativeBuffer * buffer) +``` + +**描述:** + +将OH_NativeBuffer对象的引用计数减1,当引用计数为0的时候,该NativeBuffer对象会被析构掉 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| buffer | 参数是一个指向OH_NativeBuffer实例的指针 | + +**返回:** + +返回一个由GSError定义的int32_t类型的错误码 + +**自从:** + +9 diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_buffer___config.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_buffer___config.md new file mode 100644 index 0000000000000000000000000000000000000000..10342ee5289cbf250746fe1344e7e33d67fb1ba3 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_buffer___config.md @@ -0,0 +1,27 @@ +# OH_NativeBuffer_Config + + +## 概述 + +OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性。 + +**自从:** + +9 + +**相关模块:** + +[OH_NativeBuffer](_o_h___native_buffer.md) + + +## 汇总 + + +### 成员变量 + + | 成员变量名称 | 描述 | +| -------- | -------- | +| width | 宽度(像素) | +| height | 高度(像素) | +| format | 像素格式 | +| usage | buffer的用途说明 | diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_image.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_image.md new file mode 100644 index 0000000000000000000000000000000000000000..5b9096d96d95878e03b40b07b17893fb1243a000 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_image.md @@ -0,0 +1,262 @@ +# OH_NativeImage + + +提供NativeImage功能。 + + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + + +**自从:** + + +9 + + +## 汇总 + + +### 文件 + +| 文件名称 | 描述 | +| -------- | -------- | +| [native_image.h](native__image_8h.md) | 定义获取和使用NativeImage的相关函数。 | + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_NativeImage_Create]( #oh_nativeimage_create) (uint32_t textureId, uint32_t textureTarget) | 创建一个**OH_NativeImage**实例,该实例与OPENGL ES的纹理ID和纹理目标相关联。 | +| [OH_NativeImage_AcquireNativeWindow]( #oh_nativeimage_acquirenativewindow) (OH_NativeImage \*image) | 获取与OH_NativeImage相关联的OHNativeWindow指针. 该OHNativeWindow后续不再需要时需要调用 OH_NativeWindow_DestroyNativeWindow释放。 | +| [OH_NativeImage_AttachContext]( #oh_nativeimage_attachcontext) (OH_NativeImage \*image, uint32_t textureId) | 将OH_NativeImage实例附加到当前OPENGL ES上下文, 且该OPENGL ES纹理会绑定到 GL_TEXTURE_EXTERNAL_OES, 并通过OH_NativeImage进行更新。 | +| [OH_NativeImage_DetachContext]( #oh_nativeimage_detachcontext) (OH_NativeImage \*image) | 将OH_NativeImage实例从当前OPENGL ES上下文分离。 | +| [OH_NativeImage_UpdateSurfaceImage]( #oh_nativeimage_updatesurfaceimage) (OH_NativeImage \*image) | 通过OH_NativeImage获取最新帧更新相关联的OPENGL ES纹理。 | +| [OH_NativeImage_GetTimestamp]( #oh_nativeimage_gettimestamp) (OH_NativeImage \*image) | 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的相关时间戳。 | +| [OH_NativeImage_GetTransformMatrix]( #oh_nativeimage_gettransformmatrix) (OH_NativeImage \*image, float matrix[16]) | 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的变化矩阵。 | +| [OH_NativeImage_Destroy]( #oh_nativeimage_destroy) (OH_NativeImage \*\*image) | 销毁通过OH_NativeImage_Create创建的**OH_NativeImage**实例, 销毁后该 **OH_NativeImage**指针会被赋值为空。 | + + +## 详细描述 + + +## 函数说明 + + +### OH_NativeImage_AcquireNativeWindow() + + +``` +OHNativeWindow* OH_NativeImage_AcquireNativeWindow (OH_NativeImage * image) +``` + +**描述:** + +获取与OH_NativeImage相关联的OHNativeWindow指针。该OHNativeWindow后续不再需要时需要调用 OH_NativeWindow_DestroyNativeWindow释放。 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| image | 指向<b>OH_NativeImage</b>实例的指针。 | + +**返回:** + +成功则返回一个指向OHNativeWindow实例的指针,否则返回**NULL**。 + +**自从:** + +9 + + +### OH_NativeImage_AttachContext() + + +``` +int32_t OH_NativeImage_AttachContext (OH_NativeImage * image, uint32_t textureId ) +``` + +**描述:** + +将OH_NativeImage实例附加到当前OPENGL ES上下文,且该OPENGL ES纹理会绑定到 GL_TEXTURE_EXTERNAL_OES,并通过OH_NativeImage进行更新。 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| image | 指向OH_NativeImage实例的指针。 | +| textureId | OH_NativeImage要附加到的OPENGL ES纹理的id。 | + +**返回:** + +返回一个由**SurfaceError**定义的int32_t类型的错误码。 + +**自从:** + +9 + + +### OH_NativeImage_Create() + + +``` +OH_NativeImage* OH_NativeImage_Create (uint32_t textureId, uint32_t textureTarget ) +``` + +**描述:** + +创建一个**OH_NativeImage**实例,该实例与OPENGL ES的纹理ID和纹理目标相关联。 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| textureId | OPENGL ES的纹理ID,OH_NativeImage实例会与之相关联。 | +| textureTarget | OPENGL ES的纹理目标。 | + +**返回:** + +返回一个指向**OH_NativeImage**实例的指针,否则返回**NULL**。 + +**自从:** + +9 + + +### OH_NativeImage_Destroy() + + +``` +void OH_NativeImage_Destroy (OH_NativeImage ** image) +``` + +**描述:** + +销毁通过OH_NativeImage_Create创建的**OH_NativeImage**实例, 销毁后该 **OH_NativeImage**指针会被赋值为空. + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| image | 指向OH_NativeImage实例的指针。 | + + +### OH_NativeImage_DetachContext() + + +``` +int32_t OH_NativeImage_DetachContext (OH_NativeImage * image) +``` + +**描述:** + +将OH_NativeImage实例从当前OPENGL ES上下文分离。 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| image | 指向OH_NativeImage实例的指针。 | + +**返回:** + +返回一个由**SurfaceError**定义的int32_t类型的错误码。 + +**自从:** + +9 + + +### OH_NativeImage_GetTimestamp() + + +``` +int64_t OH_NativeImage_GetTimestamp (OH_NativeImage * image) +``` + +**描述:** + +获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的相关时间戳。 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| image | 指向OH_NativeImage实例的指针。 | + +**返回:** + +返回纹理图像的相关时间戳。 + +**自从:** + +9 + + +### OH_NativeImage_GetTransformMatrix() + + +``` +int32_t OH_NativeImage_GetTransformMatrix (OH_NativeImage * image, float matrix[16] ) +``` + +**描述:** + +获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的变化矩阵。 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| image | 指向OH_NativeImage实例的指针。 | +| matrix | 用来存储要获取的4\*4的变化矩阵。 | + +**返回:** + +返回一个由**SurfaceError**定义的int32_t类型的错误码。 + +**自从:** + +9 + + +### OH_NativeImage_UpdateSurfaceImage() + + +``` +int32_t OH_NativeImage_UpdateSurfaceImage (OH_NativeImage * image) +``` + +**描述:** + +通过OH_NativeImage获取最新帧更新相关联的OPENGL ES纹理。 + +@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| image | 指向OH_NativeImage实例的指针。 | + +**返回:** + +返回一个由**SurfaceError**定义的int32_t类型的错误码。 + +**自从:** + +9 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 index 048ec090477c631f54de2848480d7413657f7f53..1e7ee5b45b35c9d40a7dcf8e7932b225b76ab635 100644 --- 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 @@ -1,575 +1,1053 @@ # Native XComponent -## **Overview** +描述ArkUI XComponent持有的surface和触摸事件,该事件可用于EGL/OpenGLES和媒体数据输入,并显示在ArkUI XComponent上。 -**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** +### 文件 + +| 文件名称 | 描述 | +| -------- | -------- | +| [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) | 声明用于访问Native XComponent的API。 | -### Files +### 结构体 - | File Name | Description | +| 结构体名称 | 描述 | | -------- | -------- | -| [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) | Declares APIs for accessing a Native XComponent. | +| [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) | 触摸事件中触摸点的信息。 | +| [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) | 触摸事件。 | +| [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) | 鼠标事件。 | +| [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) | 注册surface生命周期和触摸事件回调。 | +| [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) | 注册鼠标事件的回调。 | -### 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. | +| [OH_NativeXComponent](#oh_nativexcomponent) | 提供封装的OH_NativeXComponent实例。 | +| [OH_NativeXComponent_Callback](#oh_nativexcomponent_callback) | 注册surface生命周期和触摸事件回调。 | +| [OH_NativeXComponent_MouseEvent_Callback](#oh_nativexcomponent_mouseevent_callback) | 注册鼠标事件的回调。 | -### Macros +### 枚举 - | Macro Name and Value | Description | +| 枚举名称 | 描述 | | -------- | -------- | -| **OH_NATIVE_XCOMPONENT_OBJ**   ("__NATIVE_XCOMPONENT_OBJ__") | | +| {OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0,
OH_NATIVEXCOMPONENT_RESULT_FAILED = -1,
OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2,
OHOS_IMAGE_RESULT_SUCCESS = 0,
OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | [枚举](#anonymous-enum)API访问状态。 | +| [OH_NativeXComponent_TouchEventType](#oh_nativexcomponent_toucheventtype) {
OH_NATIVEXCOMPONENT_DOWN = 0,
OH_NATIVEXCOMPONENT_UP,
OH_NATIVEXCOMPONENT_MOVE,
OH_NATIVEXCOMPONENT_CANCEL,
OH_NATIVEXCOMPONENT_UNKNOWN } | 触摸事件类型。 | +| [OH_NativeXComponent_MouseEventAction](#oh_nativexcomponent_mouseeventaction) {
OH_NATIVEXCOMPONENT_MOUSE_NONE = 0,
OH_NATIVEXCOMPONENT_MOUSE_PRESS,
OH_NATIVEXCOMPONENT_MOUSE_RELEASE,
OH_NATIVEXCOMPONENT_MOUSE_MOVE } | 鼠标事件动作。 | +| [OH_NativeXComponent_MouseEventButton](#oh_nativexcomponent_mouseeventbutton) {
OH_NATIVEXCOMPONENT_NONE_BUTTON = 0,
OH_NATIVEXCOMPONENT_LEFT_BUTTON = 0x01,
OH_NATIVEXCOMPONENT_RIGHT_BUTTON = 0x02,
OH_NATIVEXCOMPONENT_MIDDLE_BUTTON = 0x04,
OH_NATIVEXCOMPONENT_BACK_BUTTON = 0x08,
OH_NATIVEXCOMPONENT_FORWARD_BUTTON = 0x10 } | 鼠标事件按键。 | -### 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. | +| [OH_NativeXComponent_GetXComponentId](#oh_nativexcomponent_getxcomponentid) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, char \*id, uint64_t \*size) | 获取ArkUI XComponent的id。 | +| [OH_NativeXComponent_GetXComponentSize](#oh_nativexcomponent_getxcomponentsize) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, const void \*window, uint64_t \*width, uint64_t \*height) | 获取ArkUI XComponent持有的surface的大小。 | +| [OH_NativeXComponent_GetXComponentOffset](#oh_nativexcomponent_getxcomponentoffset) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, const void \*window, double \*x, double \*y) | 获取ArkUI XComponent组件相对屏幕左上顶点的偏移量。 | +| [OH_NativeXComponent_GetTouchEvent](#oh_nativexcomponent_gettouchevent) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, const void \*window, [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) \*touchEvent) | 获取ArkUI XComponent调度的触摸事件。 | +| [OH_NativeXComponent_GetMouseEvent](#oh_nativexcomponent_getmouseevent) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, const void \*window, [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) \*mouseEvent) | 获取ArkUI XComponent调度的鼠标事件 | +| [OH_NativeXComponent_RegisterCallback](#oh_nativexcomponent_registercallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) \*callback) | 为此OH_NativeXComponent实例注册回调。 | +| [OH_NativeXComponent_RegisterMouseEventCallback](#oh_nativexcomponent_registermouseeventcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) \*callback) | 为此OH_NativeXComponent实例注册鼠标事件回调。 | -### 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 } | | +| [OH_XCOMPONENT_ID_LEN_MAX](#oh_xcomponent_id_len_max) = 128 | ArkUI XComponent的id最大长度。 | +| [OH_MAX_TOUCH_POINTS_NUMBER](#oh_max_touch_points_number) = 10 | 触摸事件中的可识别的触摸点个数最大值。 | +| [OH_NativeXComponent_TouchPoint::id](#id-12) = 0 | 手指的唯一标识符。 | +| [OH_NativeXComponent_TouchPoint::screenX](#screenx-13) = 0.0 | 触摸点相对于屏幕左边缘的x坐标。 | +| [OH_NativeXComponent_TouchPoint::screenY](#screeny-13) = 0.0 | 触摸点相对于屏幕上边缘的y坐标。 | +| [OH_NativeXComponent_TouchPoint::x](#x-13) = 0.0 | 触摸点相对于XComponent组件左边缘的x坐标。 | +| [OH_NativeXComponent_TouchPoint::y](#y-13) = 0.0 | 触摸点相对于XComponent组件上边缘的y坐标。 | +| [OH_NativeXComponent_TouchPoint::type](#type-12) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | 触摸事件的触摸类型。 | +| [OH_NativeXComponent_TouchPoint::size](#size-12) = 0.0 | 指垫和屏幕之间的接触面积。 | +| [OH_NativeXComponent_TouchPoint::force](#force-12) = 0.0 | 当前触摸事件的压力。 | +| [OH_NativeXComponent_TouchPoint::timeStamp](#timestamp-12) = 0 | 当前触摸事件的时间戳。 | +| [OH_NativeXComponent_TouchPoint::isPressed](#ispressed) = false | 当前点是否被按下。 | +| [OH_NativeXComponent_TouchEvent::id](#id-22) = 0 | 手指的唯一标识符。 | +| [OH_NativeXComponent_TouchEvent::screenX](#screenx-23) = 0.0 | 触摸点相对于屏幕左边缘的x坐标。 | +| [OH_NativeXComponent_TouchEvent::screenY](#screeny-23) = 0.0 | 触摸点相对于屏幕上边缘的y坐标。 | +| [OH_NativeXComponent_TouchEvent::x](#x-23) = 0.0 | 触摸点相对于XComponent组件左边缘的x坐标。 | +| [OH_NativeXComponent_TouchEvent::y](#y-23) = 0.0 | 触摸点相对于XComponent组件上边缘的y坐标。 | +| [OH_NativeXComponent_TouchEvent::type](#type-22) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | 触摸事件的触摸类型。 | +| [OH_NativeXComponent_TouchEvent::size](#size-22) = 0.0 | 指垫和屏幕之间的接触面积。 | +| [OH_NativeXComponent_TouchEvent::force](#force-22) = 0.0 | 当前触摸事件的压力。 | +| [OH_NativeXComponent_TouchEvent::deviceId](#deviceid) = 0 | 产生当前触摸事件的设备的ID。 | +| [OH_NativeXComponent_TouchEvent::timeStamp](#timestamp-22) = 0 | 当前触摸事件的时间戳。 | +| [OH_NativeXComponent_TouchEvent::touchPoints](#touchpoints) [OH_MAX_TOUCH_POINTS_NUMBER] | 当前触摸点的数组。 | +| [OH_NativeXComponent_TouchEvent::numPoints](#numpoints) = 0 | 当前接触点的数量。 | +| [OH_NativeXComponent_MouseEvent::x](#x-33) | 点击触点相对于当前组件左上角的x轴坐标。 | +| [OH_NativeXComponent_MouseEvent::y](#y-33) | 点击触点相对于当前组件左上角的y轴坐标。 | +| [OH_NativeXComponent_MouseEvent::screenX](#screenx-33) | 点击触点相对于屏幕左上角的x轴坐标。 | +| [OH_NativeXComponent_MouseEvent::screenY](#screeny-33) | 点击触点相对于屏幕左上角的y轴坐标。 | +| [OH_NativeXComponent_MouseEvent::timestamp](#timestamp) | 当前鼠标事件的时间戳。 | +| [OH_NativeXComponent_MouseEvent::action](#action) | 当前鼠标事件动作。 | +| [OH_NativeXComponent_MouseEvent::button](#button) | 鼠标事件按键。 | +| [OH_NativeXComponent_Callback::OnSurfaceCreated](#onsurfacecreated) )([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window) | 创建surface时调用。 | +| [OH_NativeXComponent_Callback::OnSurfaceChanged](#onsurfacechanged) )([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window) | 当surface改变时调用。 | +| [OH_NativeXComponent_Callback::OnSurfaceDestroyed](#onsurfacedestroyed) )([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window) | 当surface被破坏时调用。 | +| [OH_NativeXComponent_Callback::DispatchTouchEvent](#dispatchtouchevent) )([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window) | 当触摸事件被触发时调用。 | +| [OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent](#dispatchmouseevent) )([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window) | 当鼠标事件被触发时调用。 | +| [OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent](#dispatchhoverevent) )([OH_NativeXComponent](#oh_nativexcomponent) \*component, bool isHover) | 当悬停事件被触发时调用。 | + + +## 详细描述 + + +## 类型定义说明 -### Functions +### OH_NativeXComponent - | 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. | +``` +typedef struct OH_NativeXComponent OH_NativeXComponent +``` -## **Details** +**描述:** +提供封装的OH_NativeXComponent实例。 -## **Typedef** +**自从:** +8 + + +### OH_NativeXComponent_Callback -### OH_NativeXComponent - ``` -typedef struct OH_NativeXComponent OH_NativeXComponent +typedef struct OH_NativeXComponent_Callback OH_NativeXComponent_Callback ``` -**Description:** +**描述:** -Provides an encapsulated **OH_NativeXComponent** instance. +注册surface生命周期和触摸事件回调。 +**自从:** + +8 + + +### OH_NativeXComponent_MouseEvent_Callback -### OH_NativeXComponent_Callback - ``` -typedef struct OH_NativeXComponent_Callback OH_NativeXComponent_Callback +typedef struct OH_NativeXComponent_MouseEvent_Callback OH_NativeXComponent_MouseEvent_Callback ``` -**Description:** +**描述:** + +注册鼠标事件的回调。 -Registers the surface lifecycle and touch event callbacks. +**自从:** +9 -## **Enumeration Type** + +## 枚举类型说明 ### anonymous enum - + ``` anonymous enum ``` -**Description:** +**描述:** -Enumerates the API access states. +枚举API访问状态。 - | Enumerator | Description | +| 枚举值 | 描述 | | -------- | -------- | -| OH_NATIVEXCOMPONENT_RESULT_SUCCESS | Success result. | -| OH_NATIVEXCOMPONENT_RESULT_FAILED | Failed result. | -| OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER | Invalid parameters. | +| OH_NATIVEXCOMPONENT_RESULT_SUCCESS | 成功结果。 | +| OH_NATIVEXCOMPONENT_RESULT_FAILED | 失败结果。 | +| OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER | 无效参数。 | +| OHOS_IMAGE_RESULT_SUCCESS | 成功的结果 | +| OHOS_IMAGE_RESULT_BAD_PARAMETER | 无效值 | + +**自从:** + +8 + + +### OH_NativeXComponent_MouseEventAction + + +``` +enum OH_NativeXComponent_MouseEventAction +``` + +**描述:** + +鼠标事件动作. + +| 枚举值 | 描述 | +| -------- | -------- | +| OH_NATIVEXCOMPONENT_MOUSE_NONE | 无效鼠标事件 。 | +| OH_NATIVEXCOMPONENT_MOUSE_PRESS | 鼠标按键按下时触发鼠标事件。 | +| OH_NATIVEXCOMPONENT_MOUSE_RELEASE | 鼠标按键松开时触发鼠标事件。 | +| OH_NATIVEXCOMPONENT_MOUSE_MOVE | 鼠标在屏幕上移动时触发鼠标事件。 | + +**自从:** + +9 + + +### OH_NativeXComponent_MouseEventButton + + +``` +enum OH_NativeXComponent_MouseEventButton +``` + +**描述:** + +鼠标事件按键。 + +| 枚举值 | 描述 | +| -------- | -------- | +| OH_NATIVEXCOMPONENT_NONE_BUTTON | 鼠标无按键操作时触发鼠标事件。 | +| OH_NATIVEXCOMPONENT_LEFT_BUTTON | 按下鼠标左键时触发鼠标事件。 | +| OH_NATIVEXCOMPONENT_RIGHT_BUTTON | 按下鼠标右键时触发鼠标事件。 | +| OH_NATIVEXCOMPONENT_MIDDLE_BUTTON | 按下鼠标中键时触发鼠标事件。 | +| OH_NATIVEXCOMPONENT_BACK_BUTTON | 按下鼠标左侧后退键时触发鼠标事件。 | +| OH_NATIVEXCOMPONENT_FORWARD_BUTTON | 按下鼠标左侧前进键时触发鼠标事件。 | + +**自从:** + +9 ### 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. | +| OH_NATIVEXCOMPONENT_DOWN | 手指按下时触发触摸事件。 | +| OH_NATIVEXCOMPONENT_UP | 手指抬起时触发触摸事件。 | +| OH_NATIVEXCOMPONENT_MOVE | 手指按下状态下在屏幕上移动时触发触摸事件。 | +| OH_NATIVEXCOMPONENT_CANCEL | 触摸事件取消时触发事件。 | +| OH_NATIVEXCOMPONENT_UNKNOWN | 无效的触摸类型。 | +**自从:** + +8 + + +## 函数说明 + + +### OH_NativeXComponent_GetMouseEvent() + + +``` +int32_t OH_NativeXComponent_GetMouseEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_MouseEvent * mouseEvent ) +``` -## **Function** +**描述:** + +获取ArkUI XComponent调度的鼠标事件 + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| component | 表示指向OH_NativeXComponent实例的指针。 | +| window | 表示NativeWindow句柄。 | +| mouseEvent | 指示指向当前鼠标事件的指针。 | + +**返回:** + +返回执行的状态代码。 + +**自从:** + +9 ### 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. +获取ArkUI XComponent调度的触摸事件。 -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| component | Indicates the pointer to this **OH_NativeXComponent** instance. | -| window | Indicates the native window handler. | -| touchEvent | Indicates the pointer to the current touch event. | +| component | 表示指向OH_NativeXComponent实例的指针。 | +| window | 表示NativeWindow句柄。 | +| touchEvent | 指示指向当前触摸事件的指针。 | + +**返回:** -**Returns:** +返回执行的状态代码。 -Returns the status code of the execution. +**自从:** + +8 ### OH_NativeXComponent_GetXComponentId() - + ``` int32_t OH_NativeXComponent_GetXComponentId (OH_NativeXComponent * component, char * id, uint64_t * size ) ``` -**Description:** +**描述:** -Obtains the ID of the ArkUI XComponent. +获取ArkUI XComponent的id。 -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| 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. | +| component | 表示指向OH_NativeXComponent实例的指针。 | +| id | 指示用于保存此OH_NativeXComponent实例的ID的字符缓冲区。 请注意,空终止符将附加到字符缓冲区,因此字符缓冲区的大小应至少比真实id长度大一个单位。 建议字符缓冲区的大小为[OH_XCOMPONENT_ID_LEN_MAX + 1]。 | +| size | 指示指向id长度的指针。 | + +**返回:** + +返回执行的状态代码。 -**Returns:** +**自从:** -Returns the status code of the execution. +8 ### 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. +获取ArkUI XComponent组件相对屏幕左上顶点的偏移量。 -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| 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. | +| component | 表示指向OH_NativeXComponent实例的指针。 | +| window | 表示NativeWindow句柄。 | +| x | 指示指向当前surface的x坐标的指针。 | +| y | 指示指向当前surface的y坐标的指针。 | + +**返回:** -**Returns:** +返回执行的状态代码。 -Returns the status code of the execution. +**自从:** + +8 ### 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. +获取ArkUI XComponent持有的surface的大小。 -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| 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. | +| component | 表示指向OH_NativeXComponent实例的指针。 | +| window | 表示NativeWindow句柄。 | +| width | 指示指向当前surface宽度的指针。 | +| height | 指示指向当前surface高度的指针。 | + +**返回:** + +返回执行的状态代码。 -**Returns:** +**自从:** -Returns the status code of the execution. +8 ### OH_NativeXComponent_RegisterCallback() - + ``` int32_t OH_NativeXComponent_RegisterCallback (OH_NativeXComponent * component, OH_NativeXComponent_Callback * callback ) ``` -**Description:** +**描述:** + +为此OH_NativeXComponent实例注册回调。 + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| component | 表示指向OH_NativeXComponent实例的指针。 | +| callback | 指示指向surface生命周期和触摸事件回调的指针。 | + +**返回:** + +返回执行的状态代码。 + +**自从:** + +8 + + +### OH_NativeXComponent_RegisterMouseEventCallback() + + +``` +int32_t OH_NativeXComponent_RegisterMouseEventCallback (OH_NativeXComponent * component, OH_NativeXComponent_MouseEvent_Callback * callback ) +``` + +**描述:** -Registers a callback for this **OH_NativeXComponent** instance. +为此OH_NativeXComponent实例注册鼠标事件回调。 -**Parameters:** +**参数:** - | Name | Description | +| Name | 描述 | | -------- | -------- | -| component | Indicates the pointer to this **OH_NativeXComponent** instance. | -| callback | Indicates the pointer to a surface lifecycle and touch event callback. | +| component | 表示指向OH_NativeXComponent实例的指针。 | +| callback | 指示指向鼠标事件回调的指针。 | -**Returns:** +**返回:** -Returns the status code of the execution. +返回执行的状态代码。 + +**自从:** + +9 + + +## 变量说明 + + +### OH_XCOMPONENT_ID_LEN_MAX + + +``` +const uint32_t OH_XCOMPONENT_ID_LEN_MAX = 128 +``` + +**描述:** + +ArkUI XComponent的id最大长度。 + +**自从:** + +8 + + +### OH_MAX_TOUCH_POINTS_NUMBER + + +``` +const uint32_t OH_MAX_TOUCH_POINTS_NUMBER = 10 +``` +**描述:** -## **Variable** +触摸事件中的可识别的触摸点个数最大值。 + +**自从:** + +8 + + +### action + + +``` +OH_NativeXComponent_MouseEventAction OH_NativeXComponent_MouseEvent::action +``` + +**描述:** + +当前鼠标事件动作。 + +**自从:** + +8 + + +### button + + +``` +OH_NativeXComponent_MouseEventButton OH_NativeXComponent_MouseEvent::button +``` + +**描述:** + +鼠标事件按键 + +**自从:** + +8 ### deviceId - + ``` int64_t OH_NativeXComponent_TouchEvent::deviceId = 0 ``` -**Description:** +**描述:** + +产生当前触摸事件的设备的ID。 + +**自从:** + +8 + + +### DispatchHoverEvent + + +``` +void(* OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent) (OH_NativeXComponent *component, bool isHover) +``` + +**描述:** + +当悬停事件被触发时调用。 + +**自从:** + +8 -ID of the device where the current touch event is generated. + +### DispatchMouseEvent + + +``` +void(* OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent) (OH_NativeXComponent *component, void *window) +``` + +**描述:** + +当鼠标事件被触发时调用。 + +**自从:** + +8 ### DispatchTouchEvent - + ``` void(* OH_NativeXComponent_Callback::DispatchTouchEvent) (OH_NativeXComponent *component, void *window) ``` -**Description:** +**描述:** -Called when a touch event is triggered. +当触摸事件被触发时调用。 + +**自从:** + +8 ### force [1/2] - + ``` float OH_NativeXComponent_TouchPoint::force = 0.0 ``` -**Description:** +**描述:** + +当前触摸事件的压力。 -Pressure of the current touch event. +**自从:** + +8 ### force [2/2] - + ``` float OH_NativeXComponent_TouchEvent::force = 0.0 ``` -**Description:** +**描述:** + +当前触摸事件的压力。 + +**自从:** -Pressure of the current touch event. +8 ### id [1/2] - + ``` int32_t OH_NativeXComponent_TouchPoint::id = 0 ``` -**Description:** +**描述:** + +手指的唯一标识符。 -Unique identifier of a finger. +**自从:** + +8 ### id [2/2] - + ``` int32_t OH_NativeXComponent_TouchEvent::id = 0 ``` -**Description:** +**描述:** -Unique identifier of a finger. +手指的唯一标识符。 + +**自从:** + +8 ### isPressed - + ``` bool OH_NativeXComponent_TouchPoint::isPressed = false ``` -**Description:** +**描述:** -Whether the current point is pressed. +当前点是否被按下。 + +**自从:** + +8 ### numPoints - + ``` uint32_t OH_NativeXComponent_TouchEvent::numPoints = 0 ``` -**Description:** +**描述:** + +当前接触点的数量。 + +**自从:** -Number of current touch points. +8 ### OnSurfaceChanged - + ``` void(* OH_NativeXComponent_Callback::OnSurfaceChanged) (OH_NativeXComponent *component, void *window) ``` -**Description:** +**描述:** + +当surface改变时调用。 -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. +**自从:** + +8 ### OnSurfaceCreated - + ``` void(* OH_NativeXComponent_Callback::OnSurfaceCreated) (OH_NativeXComponent *component, void *window) ``` -**Description:** +**描述:** + +创建surface时调用。 + +**自从:** -Called when the surface is created. +8 ### OnSurfaceDestroyed - + ``` void(* OH_NativeXComponent_Callback::OnSurfaceDestroyed) (OH_NativeXComponent *component, void *window) ``` -**Description:** +**描述:** -Called when the surface is destroyed. +当surface被破坏时调用。 +**自从:** + +8 + + +### screenX [1/3] -### 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. +触摸点相对于屏幕左边缘的x坐标。 +**自从:** + +8 + + +### screenX [2/3] -### screenX [2/2] - ``` float OH_NativeXComponent_TouchEvent::screenX = 0.0 ``` -**Description:** +**描述:** + +触摸点相对于屏幕左边缘的x坐标。 + +**自从:** + +8 -X coordinate of the touch point relative to the left edge of the screen. +### screenX [3/3] + + +``` +float OH_NativeXComponent_MouseEvent::screenX +``` + +**描述:** + +点击触点相对于屏幕左上角的x轴坐标。 + +**自从:** + +8 + + +### screenY [1/3] -### screenY [1/2] - ``` float OH_NativeXComponent_TouchPoint::screenY = 0.0 ``` -**Description:** +**描述:** + +触摸点相对于屏幕上边缘的y坐标。 + +**自从:** + +8 -Y coordinate of the touch point relative to the upper edge of the screen. +### screenY [2/3] -### screenY [2/2] - ``` float OH_NativeXComponent_TouchEvent::screenY = 0.0 ``` -**Description:** +**描述:** + +触摸点相对于屏幕上边缘的y坐标。 + +**自从:** + +8 + + +### screenY [3/3] + -Y coordinate of the touch point relative to the upper edge of the screen. +``` +float OH_NativeXComponent_MouseEvent::screenY +``` + +**描述:** + +点击触点相对于屏幕左上角的y轴坐标。 + +**自从:** + +8 ### size [1/2] - + ``` double OH_NativeXComponent_TouchPoint::size = 0.0 ``` -**Description:** +**描述:** -Contact area between the finger pad and the screen. +指垫和屏幕之间的接触面积。 + +**自从:** + +8 ### size [2/2] - + ``` double OH_NativeXComponent_TouchEvent::size = 0.0 ``` -**Description:** +**描述:** -Contact area between the finger pad and the screen. +指垫和屏幕之间的接触面积。 + +**自从:** + +8 ### timeStamp [1/2] - + ``` long long OH_NativeXComponent_TouchPoint::timeStamp = 0 ``` -**Description:** +**描述:** + +当前触摸事件的时间戳。 + +**自从:** -Timestamp of the current touch event. +8 ### timeStamp [2/2] - + ``` long long OH_NativeXComponent_TouchEvent::timeStamp = 0 ``` -**Description:** +**描述:** + +当前触摸事件的时间戳。 -Timestamp of the current touch event. +**自从:** + +8 + + +### timestamp + + +``` +int64_t OH_NativeXComponent_MouseEvent::timestamp +``` + +**描述:** + +当前鼠标事件的时间戳 + +**自从:** + +8 ### touchPoints - + ``` OH_NativeXComponent_TouchPoint OH_NativeXComponent_TouchEvent::touchPoints[OH_MAX_TOUCH_POINTS_NUMBER] ``` -**Description:** +**描述:** + +当前触摸点的数组。 -Array of the current touch points. +**自从:** + +8 ### type [1/2] - + ``` OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchPoint::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN ``` -**Description:** +**描述:** + +触摸事件的触摸类型。 -Touch type of the touch event. +**自从:** + +8 ### type [2/2] - + ``` OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchEvent::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN ``` -**Description:** +**描述:** -Touch type of the touch event. +触摸事件的触摸类型。 +**自从:** + +8 + + +### x [1/3] -### x [1/2] - ``` float OH_NativeXComponent_TouchPoint::x = 0.0 ``` -**Description:** +**描述:** + +触摸点相对于XComponent组件左边缘的x坐标。 -X coordinate of the touch point relative to the left edge of the element to touch. +**自从:** +8 + + +### x [2/3] -### x [2/2] - ``` float OH_NativeXComponent_TouchEvent::x = 0.0 ``` -**Description:** +**描述:** + +触摸点相对于XComponent组件左边缘的x坐标。 -X coordinate of the touch point relative to the left edge of the element to touch. +**自从:** + +8 -### y [1/2] +### x [3/3] + + +``` +float OH_NativeXComponent_MouseEvent::x +``` + +**描述:** + +点击触点相对于当前组件左上角的x轴坐标。 + +**自从:** + +8 + + +### y [1/3] + - ``` float OH_NativeXComponent_TouchPoint::y = 0.0 ``` -**Description:** +**描述:** + +触摸点相对于XComponent组件上边缘的y坐标。 + +**自从:** + +8 -Y coordinate of the touch point relative to the upper edge of the element to touch. +### y [2/3] -### y [2/2] - ``` float OH_NativeXComponent_TouchEvent::y = 0.0 ``` -**Description:** +**描述:** + +触摸点相对于XComponent组件上边缘的y坐标。 + +**自从:** + +8 + + +### y [3/3] + + +``` +float OH_NativeXComponent_MouseEvent::y +``` + +**描述:** + +点击触点相对于当前组件左上角的y轴坐标。 -Y coordinate of the touch point relative to the upper edge of the element to touch. +**自从:** + +8 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 index 68aeeadfd598f23a99369d7d80160078ab8eb4a9..2928e5c43d3987f660473c73fdec7ececd76074d 100644 --- 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 @@ -1,29 +1,27 @@ # OH_NativeXComponent_Callback -## **Overview** +## 概述 -**Related Modules:** +注册surface生命周期和触摸事件回调。 -[Native XComponent](_o_h___native_x_component.md) +**自从:** -**Description:** +8 -Registers the surface lifecycle and touch event callbacks. +**相关模块:** + +[Native XComponent](_o_h___native_x_component.md) -**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) | | +| [OnSurfaceCreated](_o_h___native_x_component.md#onsurfacecreated) )([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window) | 创建surface时调用。 | +| [OnSurfaceChanged](_o_h___native_x_component.md#onsurfacechanged) )([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window) | 当surface改变时调用。 | +| [OnSurfaceDestroyed](_o_h___native_x_component.md#onsurfacedestroyed) )([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window) | 当surface被破坏时调用。 | +| [DispatchTouchEvent](_o_h___native_x_component.md#dispatchtouchevent) )([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window) | 当触摸事件被触发时调用。 | diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___mouse_event.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___mouse_event.md new file mode 100644 index 0000000000000000000000000000000000000000..e85c03e39ab01e42b53877fef51aa390abd0bdde --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___mouse_event.md @@ -0,0 +1,30 @@ +# OH_NativeXComponent_MouseEvent + + +## 概述 + +鼠标事件。 + +**自从:** + +9 + +**相关模块:** + +[Native XComponent](_o_h___native_x_component.md) + + +## 汇总 + + +### 成员变量 + + | 成员变量名称 | 描述 | +| -------- | -------- | +| [x](_o_h___native_x_component.md#x-33) | 点击触点相对于当前组件左上角的x轴坐标。 | +| [y](_o_h___native_x_component.md#y-33) | 点击触点相对于当前组件左上角的y轴坐标。 | +| [screenX](_o_h___native_x_component.md#screenx-33) | 点击触点相对于屏幕左上角的x轴坐标。 | +| [screenY](_o_h___native_x_component.md#screeny-33) | 点击触点相对于屏幕左上角的y轴坐标。 | +| [timestamp](_o_h___native_x_component.md#timestamp) | 当前鼠标事件的时间戳。 | +| [action](_o_h___native_x_component.md#action) | 当前鼠标事件动作。 | +| [button](_o_h___native_x_component.md#button) | 鼠标事件按键。 | diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___mouse_event___callback.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___mouse_event___callback.md new file mode 100644 index 0000000000000000000000000000000000000000..6458a218ef31ecca73f021bc220b9e9b401a0245 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component___mouse_event___callback.md @@ -0,0 +1,25 @@ +# OH_NativeXComponent_MouseEvent_Callback + + +## 概述 + +注册鼠标事件的回调。 + +**自从:** + +9 + +**相关模块:** + +[Native XComponent](_o_h___native_x_component.md) + + +## 汇总 + + +### 成员变量 + + | 成员变量名称 | 描述 | +| -------- | -------- | +| [DispatchMouseEvent](_o_h___native_x_component.md#dispatchmouseevent) )([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window) | 当鼠标事件被触发时调用。 | +| [DispatchHoverEvent](_o_h___native_x_component.md#dispatchhoverevent) )([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, bool isHover) | 当悬停事件被触发时调用。 | 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 index 2abae7c05756c3cf0b3d970b80f21c3e821cbf61..e213f61d5e5025ec32b4fe6254646f66524dbf64 100644 --- 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 @@ -1,29 +1,35 @@ # OH_NativeXComponent_TouchEvent -## **Overview** +## 概述 -**Related Modules:** +触摸事件。 + +**自从:** + +8 + +**相关模块:** [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 | | +| [id](_o_h___native_x_component.md#id-22) = 0 | 手指的唯一标识符。 | +| [screenX](_o_h___native_x_component.md#screenx-23) = 0.0 | 触摸点相对于屏幕左边缘的x坐标。 | +| [screenY](_o_h___native_x_component.md#screeny-23) = 0.0 | 触摸点相对于屏幕上边缘的y坐标。 | +| [x](_o_h___native_x_component.md#x-23) = 0.0 | 触摸点相对于XComponent组件左边缘的x坐标。 | +| [y](_o_h___native_x_component.md#y-23) = 0.0 | 触摸点相对于XComponent组件上边缘的y坐标。 | +| [type](_o_h___native_x_component.md#type-22) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | 触摸事件的触摸类型。 | +| [size](_o_h___native_x_component.md#size-22) = 0.0 | 指垫和屏幕之间的接触面积。 | +| [force](_o_h___native_x_component.md#force-22) = 0.0 | 当前触摸事件的压力。 | +| [deviceId](_o_h___native_x_component.md#deviceid) = 0 | 产生当前触摸事件的设备的ID。 | +| [timeStamp](_o_h___native_x_component.md#timestamp-22) = 0 | 当前触摸事件的时间戳。 | +| [touchPoints](_o_h___native_x_component.md#touchpoints) [OH_MAX_TOUCH_POINTS_NUMBER] | 当前触摸点的数组。 | +| [numPoints](_o_h___native_x_component.md#numpoints) = 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 index 221780a1d364ded76ab8dba5a0eb51e74e9668f0..a16bb692701dff8c0583171ae9a5588996f388e9 100644 --- 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 @@ -1,27 +1,33 @@ # OH_NativeXComponent_TouchPoint -## **Overview** +## 概述 -**Related Modules:** +触摸事件中触摸点的信息。 + +**自从:** + +8 + +**相关模块:** [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 | | +| [id](_o_h___native_x_component.md#id-12) = 0 | 手指的唯一标识符。 | +| [screenX](_o_h___native_x_component.md#screenx-13) = 0.0 | 触摸点相对于屏幕左边缘的x坐标。 | +| [screenY](_o_h___native_x_component.md#screeny-13) = 0.0 | 触摸点相对于屏幕上边缘的y坐标。 | +| [x](_o_h___native_x_component.md#x-13) = 0.0 | 触摸点相对于XComponent组件左边缘的x坐标。 | +| [y](_o_h___native_x_component.md#y-13) = 0.0 | 触摸点相对于XComponent组件上边缘的y坐标。 | +| [type](_o_h___native_x_component.md#type-12) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | 触摸事件的触摸类型。 | +| [size](_o_h___native_x_component.md#size-12) = 0.0 | 指垫和屏幕之间的接触面积。 | +| [force](_o_h___native_x_component.md#force-12) = 0.0 | 当前触摸事件的压力。 | +| [timeStamp](_o_h___native_x_component.md#timestamp-12) = 0 | 当前触摸事件的时间戳。 | +| [isPressed](_o_h___native_x_component.md#ispressed) = false | 当前点是否被按下。 | diff --git a/zh-cn/application-dev/reference/native-apis/_ohos_pixel_map_info.md b/zh-cn/application-dev/reference/native-apis/_ohos_pixel_map_info.md new file mode 100644 index 0000000000000000000000000000000000000000..72e9f6252822650952e54a946fb5d8ced2e41b2d --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/_ohos_pixel_map_info.md @@ -0,0 +1,78 @@ +# OhosPixelMapInfo + + +## 概述 + +用于定义 pixel map 的相关信息。 + +**自从:** + +8 + +**相关模块:** + +[Image](image.md) + + +## 汇总 + + +### 成员变量 + + | 成员变量名称 | 描述 | +| -------- | -------- | +| [width](#width) | 图片的高,用pixels表示。 | +| [height](#height) | Pixel的格式。 | +| [rowSize](#rowsize) | 每行的bytes数。 | +| [pixelFormat](#pixelformat) | 图片的宽,用pixels表示。 | + + +## 结构体成员变量说明 + + +### height + + +``` +uint32_t OhosPixelMapInfo::height +``` + +**描述:** + +图片的高,用pixels表示。 + + +### pixelFormat + + +``` +int32_t OhosPixelMapInfo::pixelFormat +``` + +**描述:** + +Pixel的格式。 + + +### rowSize + + +``` +uint32_t OhosPixelMapInfo::rowSize +``` + +**描述:** + +每行的bytes数。 + + +### width + + +``` +uint32_t OhosPixelMapInfo::width +``` + +**描述:** + +图片的宽,用pixels表示。 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 index 2b4212c4857865d09e097903328f787353bb03e8..e72c69ef55b51c2ef152473ac894b27c473c75e0 100644 --- a/zh-cn/application-dev/reference/native-apis/_raw_file_descriptor.md +++ b/zh-cn/application-dev/reference/native-apis/_raw_file_descriptor.md @@ -1,43 +1,34 @@ # RawFileDescriptor -## **Overview** +## 概述 -**Related Modules:** +提供rawfile文件描述符信息。 -[Rawfile](rawfile.md) - -**Description:** - -提供rawfile文件描述符信息 - -RawFileDescriptor是[OH_ResourceManager_GetRawFileDescriptor](rawfile.md#ga8313a7d4bb361a98ced485346a9be4b1)的输出参数, 涵盖了rawfile文件的文件描述符以及在HAP包中的起始位置和长度。 +RawFileDescriptor是[OH_ResourceManager_GetRawFileDescriptor()](rawfile.md#oh_resourcemanager_getrawfiledescriptor)的输出参数,涵盖了rawfile文件的文件描述符以及在HAP包中的起始位置和长度。 -**Since:** +**自从:** 8 -**Version:** +**相关模块:** -1.0 +[Rawfile](rawfile.md) -## **Summary** +## 汇总 -### Public Attributes +### 成员变量 - | Public Attribute Name | Description | + | 成员变量名称 | 描述 | | -------- | -------- | -| fd | | -| start | | -| length | | - - -## **Details** +| [fd](#fd) | rawfile文件描述符 | +| [start](#start) | rawfile在HAP包中的长度 | +| [length](#length) | rawfile在HAP包中的起始位置 | -## **Member Data** +## 结构体成员变量说明 ### fd @@ -47,7 +38,7 @@ RawFileDescriptor是[OH_ResourceManager_GetRawFileDescriptor](rawfile.md#ga8313a int RawFileDescriptor::fd ``` -**Description:** +**描述:** rawfile文件描述符 @@ -59,7 +50,7 @@ rawfile文件描述符 long RawFileDescriptor::length ``` -**Description:** +**描述:** rawfile在HAP包中的长度 @@ -71,6 +62,6 @@ rawfile在HAP包中的长度 long RawFileDescriptor::start ``` -**Description:** +**描述:** rawfile在HAP包中的起始位置 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 index 3b78678ae631f68f037a07a4a194be3cb8bcf8a6..a600f65972ccdeb01a2627097afbff1408c4034d 100644 --- a/zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md +++ b/zh-cn/application-dev/reference/native-apis/drawing__bitmap_8h.md @@ -1,38 +1,36 @@ # drawing_bitmap.h -## **Overview** +## 概述 -**Related Modules:** +文件中定义了与位图相关的功能函数。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -文件中定义了与位图相关的功能函数 +**相关模块:** + +[Drawing](_drawing.md) -**Since:** -8 -**Version:** -1.0 -## **Summary** +## 汇总 -### Classes +### 结构体 - | Classes Name | Description | +| 结构体名称 | 描述 | | -------- | -------- | -| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 | +| [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 \*
函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据 | +| [OH_Drawing_BitmapCreate](_drawing.md#oh_drawing_bitmapcreate) (void) | 函数用于创建一个位图对象。 | +| [OH_Drawing_BitmapDestroy](_drawing.md#oh_drawing_bitmapdestroy) ([OH_Drawing_Bitmap](_drawing.md#oh_drawing_bitmap) \*) | 函数用于销毁位图对象并回收该对象占有内存。 | +| [OH_Drawing_BitmapBuild](_drawing.md#oh_drawing_bitmapbuild) ([OH_Drawing_Bitmap](_drawing.md#oh_drawing_bitmap) \*, const uint32_t width, const uint32_t height, const [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) \*) | 函数用于初始化位图对象的宽度和高度,并且为该位图设置像素格式 | +| [OH_Drawing_BitmapGetWidth](_drawing.md#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](_drawing.md#oh_drawing_bitmap) \*) | 该函数用于获取指定位图的宽度 | +| [OH_Drawing_BitmapGetHeight](_drawing.md#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](_drawing.md#oh_drawing_bitmap) \*) | 函数用于获取指定位图的高度 | +| [OH_Drawing_BitmapGetPixels](_drawing.md#oh_drawing_bitmapgetpixels) ([OH_Drawing_Bitmap](_drawing.md#oh_drawing_bitmap) \*) | 函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据 | 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 index 6d656d795ce3f5a6a350b66165784712b482a5f4..4b852f041bef55d3a6de05eca95d6c6b54f51069 100644 --- a/zh-cn/application-dev/reference/native-apis/drawing__brush_8h.md +++ b/zh-cn/application-dev/reference/native-apis/drawing__brush_8h.md @@ -1,31 +1,29 @@ # drawing_brush.h -## **Overview** +## 概述 -**Related Modules:** +文件中定义了与画刷相关的功能函数。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -文件中定义了与画刷相关的功能函数 +**相关模块:** + +[Drawing](_drawing.md) -**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)的变量表示 | +| [OH_Drawing_BrushCreate](_drawing.md#oh_drawing_brushcreate) (void) | 函数用于创建一个画刷对象 | +| [OH_Drawing_BrushDestroy](_drawing.md#oh_drawing_brushdestroy) ([OH_Drawing_Brush](_drawing.md#oh_drawing_brush) \*) | 函数用于销毁画刷对象并回收该对象占有的内存。 | +| [OH_Drawing_BrushIsAntiAlias](_drawing.md#oh_drawing_brushisantialias) (const [OH_Drawing_Brush](_drawing.md#oh_drawing_brush) \*) | 函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| [OH_Drawing_BrushSetAntiAlias](_drawing.md#oh_drawing_brushsetantialias) ([OH_Drawing_Brush](_drawing.md#oh_drawing_brush) \*, bool) | 函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| [OH_Drawing_BrushGetColor](_drawing.md#oh_drawing_brushgetcolor) (const [OH_Drawing_Brush](_drawing.md#oh_drawing_brush) \*) | 函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 | +| [OH_Drawing_BrushSetColor](_drawing.md#oh_drawing_brushsetcolor) ([OH_Drawing_Brush](_drawing.md#oh_drawing_brush) \*, uint32_t color) | 函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个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 index 1e68afc0ebbe1c094dbba3be7007ae21642715bb..a5383fdc03f96465947862b15e356c35c95f4b02 100644 --- a/zh-cn/application-dev/reference/native-apis/drawing__canvas_8h.md +++ b/zh-cn/application-dev/reference/native-apis/drawing__canvas_8h.md @@ -1,37 +1,35 @@ # drawing_canvas.h -## **Overview** +## 概述 -**Related Modules:** +文件中定义了与画布相关的功能函数。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -文件中定义了与画布相关的功能函数 +**相关模块:** + +[Drawing](_drawing.md) -**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
函数用于使用指定颜色去清空画布 | +| [OH_Drawing_CanvasCreate](_drawing.md#oh_drawing_canvascreate) (void) | 函数用于创建一个画布对象 | +| [OH_Drawing_CanvasDestroy](_drawing.md#oh_drawing_canvasdestroy) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*) | 函数用于销毁画布对象并回收该对象占有的内存 | +| [OH_Drawing_CanvasBind](_drawing.md#oh_drawing_canvasbind) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](_drawing.md#oh_drawing_bitmap) \*) | 函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染) | +| [OH_Drawing_CanvasAttachPen](_drawing.md#oh_drawing_canvasattachpen) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*, const [OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*) | 函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓 | +| [OH_Drawing_CanvasDetachPen](_drawing.md#oh_drawing_canvasdetachpen) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*) | 函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓 | +| [OH_Drawing_CanvasAttachBrush](_drawing.md#oh_drawing_canvasattachbrush) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*, const [OH_Drawing_Brush](_drawing.md#oh_drawing_brush) \*) | 函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状 | +| [OH_Drawing_CanvasDetachBrush](_drawing.md#oh_drawing_canvasdetachbrush) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*) | 函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状 | +| [OH_Drawing_CanvasSave](_drawing.md#oh_drawing_canvassave) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*) | 函数用于保存当前画布的状态(画布矩阵)到一个栈顶 | +| [OH_Drawing_CanvasRestore](_drawing.md#oh_drawing_canvasrestore) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*) | 函数用于恢复保存在栈顶的画布状态(画布矩阵) | +| [OH_Drawing_CanvasDrawLine](_drawing.md#oh_drawing_canvasdrawline) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*, float x1, float y1, float x2, float y2) | 函数用于画一条直线段 | +| [OH_Drawing_CanvasDrawPath](_drawing.md#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*, const [OH_Drawing_Path](_drawing.md#oh_drawing_path) \*) | 函数用于画一个自定义路径 | +| [OH_Drawing_CanvasClear](_drawing.md#oh_drawing_canvasclear) ([OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*, uint32_t color) | 函数用于使用指定颜色去清空画布 | 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 index 5f156e592784fa8a2fddf1e56ec90343d9f2c598..6dee765d24bb2272a0ccd784a5f6ec5184fae215 100644 --- a/zh-cn/application-dev/reference/native-apis/drawing__color_8h.md +++ b/zh-cn/application-dev/reference/native-apis/drawing__color_8h.md @@ -1,26 +1,24 @@ # drawing_color.h -## **Overview** +## 概述 -**Related Modules:** +文件中定义了与颜色相关的功能函数。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -文件中定义了与颜色相关的功能函数 +**相关模块:** + +[Drawing](_drawing.md) -**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)变量 | +| [OH_Drawing_ColorSetArgb](_drawing.md#oh_drawing_colorsetargb) (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | 函数用于将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 index 111f5d88e9a4a83ce50bfb148dff9718eb47575d..6d18482ee179277bf2d432f37238284b6dff8e39 100644 --- 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 @@ -1,27 +1,25 @@ # drawing_font_collection.h -## **Overview** +## 概述 -**Related Modules:** +定义绘制模块中与fontCollection相关的函数。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -定义绘制模块中与fontCollection相关的函数 +**相关模块:** + +[Drawing](_drawing.md) -**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对象占据的内存 | +| [OH_Drawing_CreateFontCollection](_drawing.md#oh_drawing_createfontcollection) (void) | 创建OH_Drawing_FontCollection | +| [OH_Drawing_DestroyFontCollection](_drawing.md#oh_drawing_destroyfontcollection) ([OH_Drawing_FontCollection](_drawing.md#oh_drawing_fontcollection) \*) | 释放被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 index 7f2639ed4d90c34aca6e68995b7d0097e9c0a3ed..e8bae392c7073942be180aae7d38f3ca241e2a6d 100644 --- a/zh-cn/application-dev/reference/native-apis/drawing__path_8h.md +++ b/zh-cn/application-dev/reference/native-apis/drawing__path_8h.md @@ -1,34 +1,32 @@ # drawing_path.h -## **Overview** +## 概述 -**Related Modules:** +文件中定义了与自定义路径相关的功能函数。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -文件中定义了与自定义路径相关的功能函数 +**相关模块:** + +[Drawing](_drawing.md) -**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
函数用于重置自定义路径数据 | +| [OH_Drawing_PathCreate](_drawing.md#oh_drawing_pathcreate) (void) | 函数用于创建一个路径对象 | +| [OH_Drawing_PathDestroy](_drawing.md#oh_drawing_pathdestroy) ([OH_Drawing_Path](_drawing.md#oh_drawing_path) \*) | 函数用于销毁路径对象并回收该对象占有的内存 | +| [OH_Drawing_PathMoveTo](_drawing.md#oh_drawing_pathmoveto) ([OH_Drawing_Path](_drawing.md#oh_drawing_path) \*, float x, float y) | 函数用于设置自定义路径的起始点位置 | +| [OH_Drawing_PathLineTo](_drawing.md#oh_drawing_pathlineto) ([OH_Drawing_Path](_drawing.md#oh_drawing_path) \*, float x, float y) | 函数用于添加一条从路径的最后点位置到目标点位置的线段 | +| [OH_Drawing_PathArcTo](_drawing.md#oh_drawing_patharcto) ([OH_Drawing_Path](_drawing.md#oh_drawing_path) \*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg) | 函数用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段 | +| [OH_Drawing_PathQuadTo](_drawing.md#oh_drawing_pathquadto) ([OH_Drawing_Path](_drawing.md#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线 | +| [OH_Drawing_PathCubicTo](_drawing.md#oh_drawing_pathcubicto) ([OH_Drawing_Path](_drawing.md#oh_drawing_path) \*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY) | 函数用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线 | +| [OH_Drawing_PathClose](_drawing.md#oh_drawing_pathclose) ([OH_Drawing_Path](_drawing.md#oh_drawing_path) \*) | 函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段 | +| [OH_Drawing_PathReset](_drawing.md#oh_drawing_pathreset) ([OH_Drawing_Path](_drawing.md#oh_drawing_path) \*) | 函数用于重置自定义路径数据 | 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 index 2174b6e957b6a582057ab1ed2635e080b0bc3e55..a6eb94092e1052dd1fba9d399be406bda20895eb 100644 --- a/zh-cn/application-dev/reference/native-apis/drawing__pen_8h.md +++ b/zh-cn/application-dev/reference/native-apis/drawing__pen_8h.md @@ -1,47 +1,45 @@ # drawing_pen.h -## **Overview** +## 概述 -**Related Modules:** +文件中定义了与画笔相关的功能函数。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -文件中定义了与画笔相关的功能函数 +**相关模块:** + +[Drawing](_drawing.md) -**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) } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式 | +| [OH_Drawing_PenLineCapStyle](_drawing.md#oh_drawing_penlinecapstyle) { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式 | +| [OH_Drawing_PenLineJoinStyle](_drawing.md#oh_drawing_penlinejoinstyle) { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式 | -### 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
函数用于设置画笔绘制转角的样式 | +| [OH_Drawing_PenCreate](_drawing.md#oh_drawing_pencreate) (void) | 函数用于创建一个画笔对象 | +| [OH_Drawing_PenDestroy](_drawing.md#oh_drawing_pendestroy) ([OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*) | 函数用于销毁画笔对象并回收该对象占有的内存 | +| [OH_Drawing_PenIsAntiAlias](_drawing.md#oh_drawing_penisantialias) (const [OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*) | 函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| [OH_Drawing_PenSetAntiAlias](_drawing.md#oh_drawing_pensetantialias) ([OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*, bool) | 函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理 | +| [OH_Drawing_PenGetColor](_drawing.md#oh_drawing_pengetcolor) (const [OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*) | 函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 | +| [OH_Drawing_PenSetColor](_drawing.md#oh_drawing_pensetcolor) ([OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*, uint32_t color) | 函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 | +| [OH_Drawing_PenGetWidth](_drawing.md#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*) | 函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 | +| [OH_Drawing_PenSetWidth](_drawing.md#oh_drawing_pensetwidth) ([OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*, float width) | 函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 | +| [OH_Drawing_PenGetMiterLimit](_drawing.md#oh_drawing_pengetmiterlimit) (const [OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*) | 函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 | +| [OH_Drawing_PenSetMiterLimit](_drawing.md#oh_drawing_pensetmiterlimit) ([OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*, float miter) | 函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 | +| [OH_Drawing_PenGetCap](_drawing.md#oh_drawing_pengetcap) (const [OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*) | 函数用于获取画笔笔帽的样式 | +| [OH_Drawing_PenSetCap](_drawing.md#oh_drawing_pensetcap) ([OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*, [OH_Drawing_PenLineCapStyle](_drawing.md#oh_drawing_penlinecapstyle)) | 函数用于设置画笔笔帽样式 | +| [OH_Drawing_PenGetJoin](_drawing.md#oh_drawing_pengetjoin) (const [OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*) | 函数用于获取画笔绘制折线转角的样式 | +| [OH_Drawing_PenSetJoin](_drawing.md#oh_drawing_pensetjoin) ([OH_Drawing_Pen](_drawing.md#oh_drawing_pen) \*, [OH_Drawing_PenLineJoinStyle](_drawing.md#oh_drawing_penlinejoinstyle)) | 函数用于设置画笔绘制转角的样式 | 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 index 873019b493774bcd5a21ce218a920caeadad300c..e75c8bef3d4eeb2ba479dae634ecc629bae4d489 100644 --- 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 @@ -1,30 +1,28 @@ # drawing_text_declaration.h -## **Overview** +## 概述 -**Related Modules:** +提供2d drawing文本相关的数据结构声明。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -提供2d drawing文本相关的数据结构声明 +**相关模块:** + +[Drawing](_drawing.md) -**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. | +| [OH_Drawing_FontCollection](_drawing.md#oh_drawing_fontcollection) | OH_Drawing_FontCollection用于加载字体 | +| [OH_Drawing_Typography](_drawing.md#oh_drawing_typography) | OH_Drawing_Typography用于管理排版的布局和显示等 | +| [OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) | OH_Drawing_TextStyle用于管理字体颜色、装饰等 | +| [OH_Drawing_TypographyStyle](_drawing.md#oh_drawing_typographystyle) | OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等 | +| [OH_Drawing_TypographyCreate](_drawing.md#oh_drawing_typographycreate) | 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 index 193e657f5dafc2e52a3d70a18cf9e6bbda4354de..1acfce63d823b0bb39d9268d1800c0b011cde02e 100644 --- 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 @@ -1,63 +1,61 @@ # drawing_text_typography.h -## **Overview** +## 概述 -**Related Modules:** +定义绘制模块中排版相关的函数。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -定义绘制模块中排版相关的函数 +**相关模块:** + +[Drawing](_drawing.md) -**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) } | 区分字体是否为斜体 | +| [OH_Drawing_TextDirection](_drawing.md#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | 文字方向 | +| [OH_Drawing_TextAlign](_drawing.md#oh_drawing_textalign) { TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY, TEXT_ALIGN_START, TEXT_ALIGN_END } | 文字对齐方式 | +| [OH_Drawing_FontWeight](_drawing.md#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](_drawing.md#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | 基线位置 | +| [OH_Drawing_TextDecoration](_drawing.md#oh_drawing_textdecoration) { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } | 文本装饰 | +| [OH_Drawing_FontStyle](_drawing.md#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC } | 区分字体是否为斜体 | -### 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
显示文本 | +| [OH_Drawing_CreateTypographyStyle](_drawing.md#oh_drawing_createtypographystyle) (void) | 创建OH_Drawing_TypographyStyle | +| [OH_Drawing_DestroyTypographyStyle](_drawing.md#oh_drawing_destroytypographystyle) ([OH_Drawing_TypographyStyle](_drawing.md#oh_drawing_typographystyle) \*) | 释放被OH_Drawing_TypographyStyle对象占据的内存 | +| [OH_Drawing_SetTypographyTextDirection](_drawing.md#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](_drawing.md#oh_drawing_typographystyle) \*, int) | 设置文本方向 | +| [OH_Drawing_SetTypographyTextAlign](_drawing.md#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](_drawing.md#oh_drawing_typographystyle) \*, int) | 设置文本对齐方式 | +| [OH_Drawing_SetTypographyTextMaxLines](_drawing.md#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](_drawing.md#oh_drawing_typographystyle) \*, int) | 设置文本最大行数 | +| [OH_Drawing_CreateTextStyle](_drawing.md#oh_drawing_createtextstyle) (void) | 创建OH_Drawing_TextStyle | +| [OH_Drawing_DestroyTextStyle](_drawing.md#oh_drawing_destroytextstyle) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*) | 释放被OH_Drawing_TextStyle对象占据的内存 | +| [OH_Drawing_SetTextStyleColor](_drawing.md#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, uint32_t) | 设置文本颜色 | +| [OH_Drawing_SetTextStyleFontSize](_drawing.md#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, double) | 设置字号 | +| [OH_Drawing_SetTextStyleFontWeight](_drawing.md#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, int) | 设置字重 | +| [OH_Drawing_SetTextStyleBaseLine](_drawing.md#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, int) | 设置字体基线位置 | +| [OH_Drawing_SetTextStyleDecoration](_drawing.md#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, int) | 设置装饰 | +| [OH_Drawing_SetTextStyleDecorationColor](_drawing.md#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, uint32_t) | 设置装饰颜色 | +| [OH_Drawing_SetTextStyleFontHeight](_drawing.md#oh_drawing_settextstylefontheight) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, double) | 设置字体高度 | +| [OH_Drawing_SetTextStyleFontFamilies](_drawing.md#oh_drawing_settextstylefontfamilies) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, int, const char \*fontFamilies[]) | 设置字体类型 | +| [OH_Drawing_SetTextStyleFontStyle](_drawing.md#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, int) | 设置字体风格 | +| [OH_Drawing_SetTextStyleLocale](_drawing.md#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*, const char \*) | 设置语言区域 | +| [OH_Drawing_CreateTypographyHandler](_drawing.md#oh_drawing_createtypographyhandler) ([OH_Drawing_TypographyStyle](_drawing.md#oh_drawing_typographystyle) \*, [OH_Drawing_FontCollection](_drawing.md#oh_drawing_fontcollection) \*) | 创建指向OH_Drawing_TypographyCreate对象的指针 | +| [OH_Drawing_DestroyTypographyHandler](_drawing.md#oh_drawing_destroytypographyhandler) ([OH_Drawing_TypographyCreate](_drawing.md#oh_drawing_typographycreate) \*) | 释放被OH_Drawing_TypographyCreate对象占据的内存 | +| [OH_Drawing_TypographyHandlerPushTextStyle](_drawing.md#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](_drawing.md#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](_drawing.md#oh_drawing_textstyle) \*) | 设置排版风格 | +| [OH_Drawing_TypographyHandlerAddText](_drawing.md#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](_drawing.md#oh_drawing_typographycreate) \*, const char \*) | 设置文本内容 | +| [OH_Drawing_TypographyHandlerPopTextStyle](_drawing.md#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](_drawing.md#oh_drawing_typographycreate) \*) | 排版弹出 | +| [OH_Drawing_CreateTypography](_drawing.md#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](_drawing.md#oh_drawing_typographycreate) \*) | 创建OH_Drawing_Typography | +| [OH_Drawing_DestroyTypography](_drawing.md#oh_drawing_destroytypography) ([OH_Drawing_Typography](_drawing.md#oh_drawing_typography) \*) | 释放OH_Drawing_Typography对象占据的内存 | +| [OH_Drawing_TypographyLayout](_drawing.md#oh_drawing_typographylayout) ([OH_Drawing_Typography](_drawing.md#oh_drawing_typography) \*, double) | 排版布局 | +| [OH_Drawing_TypographyPaint](_drawing.md#oh_drawing_typographypaint) ([OH_Drawing_Typography](_drawing.md#oh_drawing_typography) \*, [OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) \*, double, double) | 显示文本 | 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 index b17a49f0425f4d7368c5909dc7145bf1d2225ec8..cbf626910e94c5eb4542fae171449b72e4feddb8 100644 --- a/zh-cn/application-dev/reference/native-apis/drawing__types_8h.md +++ b/zh-cn/application-dev/reference/native-apis/drawing__types_8h.md @@ -1,38 +1,36 @@ # drawing_types.h -## **Overview** +## 概述 -**Related Modules:** +文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径。 -[Drawing](_drawing.md) +**自从:** -**Description:** +8 -文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径 +**相关模块:** + +[Drawing](_drawing.md) -**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定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据 | +| [OH_Drawing_Canvas](_drawing.md#oh_drawing_canvas) | OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字 | +| [OH_Drawing_Pen](_drawing.md#oh_drawing_pen) | OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色 | +| [OH_Drawing_Brush](_drawing.md#oh_drawing_brush) | OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色 | +| [OH_Drawing_Path](_drawing.md#oh_drawing_path) | OH_Drawing_Path定义为路径,路径用于自定义各种形状 | +| [OH_Drawing_Bitmap](_drawing.md#oh_drawing_bitmap) | 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用于描述位图像素的透明度分量 | +| [OH_Drawing_ColorFormat](_drawing.md#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](_drawing.md#oh_drawing_alphaformat) { ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL } | 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 index bbfe0b179a2a769879fde1f35a4f6cba9832d075..9539c6187832a29c715bf3e85c99ffad3aff1d00 100644 --- a/zh-cn/application-dev/reference/native-apis/external__window_8h.md +++ b/zh-cn/application-dev/reference/native-apis/external__window_8h.md @@ -1,37 +1,35 @@ # external_window.h -## **Overview** +## 概述 -**Related Modules:** +定义获取和使用NativeWindow的相关函数。 -[NativeWindow](_native_window.md) +**自从:** -**Description:** +8 -定义获取和使用NativeWindow的相关函数 +**相关模块:** + +[NativeWindow](_native_window.md) -**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 | +| [OH_NativeWindow_CreateNativeWindowFromSurface](_native_window.md#oh_nativewindow_createnativewindowfromsurface) (void \*pSurface) | 创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例 | +| [OH_NativeWindow_DestroyNativeWindow](_native_window.md#oh_nativewindow_destroynativewindow) (struct NativeWindow \*window) | 将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉 | +| [OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer](_native_window.md#oh_nativewindow_createnativewindowbufferfromsurfacebuffer) (void \*pSurfaceBuffer) | 创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例 | +| [OH_NativeWindow_DestroyNativeWindowBuffer](_native_window.md#oh_nativewindow_destroynativewindowbuffer) (struct NativeWindowBuffer \*buffer) | 将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉 | +| [OH_NativeWindow_NativeWindowRequestBuffer](_native_window.md#oh_nativewindow_nativewindowrequestbuffer) (struct NativeWindow \*window, struct NativeWindowBuffer \*\*buffer, int \*fenceFd) | 通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产 | +| [OH_NativeWindow_NativeWindowFlushBuffer](_native_window.md#oh_nativewindow_nativewindowflushbuffer) (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer, int fenceFd, Region region) | 通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费 | +| [OH_NativeWindow_NativeWindowCancelBuffer](_native_window.md#oh_nativewindow_nativewindowcancelbuffer) (struct NativeWindow \*window, struct NativeWindowBuffer \*buffer) | 通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请 | +| [OH_NativeWindow_NativeWindowHandleOpt](_native_window.md#oh_nativewindow_nativewindowhandleopt) (struct NativeWindow \*window, int code,...) | 设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等 | +| [OH_NativeWindow_GetBufferHandleFromNative](_native_window.md#oh_nativewindow_getbufferhandlefromnative) (struct NativeWindowBuffer \*buffer) | 通过NativeWindowBuffer获取该buffer的BufferHandle指针 | +| [OH_NativeWindow_NativeObjectReference](_native_window.md#oh_nativewindow_nativeobjectreference) (void \*obj) | 增加一个NativeObject的引用计数 | +| [OH_NativeWindow_NativeObjectUnreference](_native_window.md#oh_nativewindow_nativeobjectunreference) (void \*obj) | 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉 | +| [OH_NativeWindow_GetNativeObjectMagic](_native_window.md#oh_nativewindow_getnativeobjectmagic) (void \*obj) | 获取NativeObject的MagicId | diff --git a/zh-cn/application-dev/reference/native-apis/image.md b/zh-cn/application-dev/reference/native-apis/image.md new file mode 100644 index 0000000000000000000000000000000000000000..446307efe5d0d1cb0e0d95c5e96fc8e615c53039 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/image.md @@ -0,0 +1,199 @@ +# Image + + +提供获取pixelmap的数据和信息的接口方法。 + + +@Syscap SystemCapability.Multimedia.Image + + +**自从:** + + +8 + + +## 汇总 + + +### 文件 + +| 文件名称 | 描述 | +| -------- | -------- | +| [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | 声明可以锁定并访问pixelmap数据的方法,声明解锁的方法。 | + + +### 结构体 + +| 结构体名称 | 描述 | +| -------- | -------- | +| [OhosPixelMapInfo](_ohos_pixel_map_info.md) | 用于定义 pixel map 的相关信息。 | + + +### 枚举 + +| 枚举名称 | 描述 | +| -------- | -------- | +| { OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0,
OH_NATIVEXCOMPONENT_RESULT_FAILED = -1,
OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2,
OHOS_IMAGE_RESULT_SUCCESS = 0,
OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | 函数方法返回值的错误码的[枚举](#anonymous-enum)。 | +| { OHOS_PIXEL_MAP_FORMAT_NONE = 0,
OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3,
OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | pixel 格式的[枚举](#anonymous-enum-1)。 | + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_GetImageInfo](#oh_getimageinfo) (napi_env env, napi_value value, [OhosPixelMapInfo](_ohos_pixel_map_info.md) \*info) | 获取 **PixelMap** 的信息,并记录信息到[OhosPixelMapInfo](_ohos_pixel_map_info.md)结构中。 | +| [OH_AccessPixels](#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | 获取**PixelMap**对象数据的内存地址,并锁定该内存。 | +| [OH_UnAccessPixels](#oh_unaccesspixels) (napi_env env, napi_value value) | 释放**PixelMap**对象数据的内存锁, 用于匹配方法[OH_AccessPixels](#oh_accesspixels)。 | + + +## 详细描述 + + +## 枚举类型说明 + + +### anonymous enum + + +``` +anonymous enum +``` + +**描述:** + +函数方法返回值的错误码的枚举。 + +| 枚举值 | 描述 | +| -------- | -------- | +| OH_NATIVEXCOMPONENT_RESULT_SUCCESS | 成功结果。 | +| OH_NATIVEXCOMPONENT_RESULT_FAILED | 失败结果。 | +| OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER | 无效参数。 | +| OHOS_IMAGE_RESULT_SUCCESS | 成功的结果。 | +| OHOS_IMAGE_RESULT_BAD_PARAMETER | 无效值。 | + +**自从:** + +8 + + +### anonymous enum + + +``` +anonymous enum +``` + +**描述:** + +pixel 格式的枚举。 + +| 枚举值 | 描述 | +| -------- | -------- | +| OHOS_PIXEL_MAP_FORMAT_NONE | 未知的格式。 | +| OHOS_PIXEL_MAP_FORMAT_RGBA_8888 | 32-bit RGBA。由 R, G, B组成,包括 A 都需要占用 8 bits。存储顺序是从高位到低位。 | +| OHOS_PIXEL_MAP_FORMAT_RGB_565 | 16-bit RGB。仅由 R, G, B 组成。存储顺序是从高位到低位: 红色占用5 bits,绿色占用6 bits,蓝色占用5 bits。 | + +**自从:** + +8 + + +## 函数说明 + + +### OH_AccessPixels() + + +``` +int32_t OH_AccessPixels (napi_env env, napi_value value, void ** addrPtr ) +``` + +**描述:** + +获取**PixelMap**对象数据的内存地址,并锁定该内存。 + +函数执行成功后,**\*addrPtr**就是获取的待访问的内存地址。访问操作完成后,必须要使用[OH_UnAccessPixels](#oh_unaccesspixels)来释放锁, 否则的话资源无法被释放。待解锁后,内存地址就不可以再被访问和操作。 + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| env | napi的环境指针。 | +| value | 应用层的 **PixelMap** 对象。 | +| addrPtr | 用于指向的内存地址的双指针对象。 | + +**参见:** + +[OH_UnAccessPixels](#oh_unaccesspixels) + +**返回:** + +操作成功则返回OHOS_IMAGE_RESULT_SUCCESS; 如果操作失败,则返回错误码。 + +**自从:** + +8 + + +### OH_GetImageInfo() + + +``` +int32_t OH_GetImageInfo (napi_env env, napi_value value, OhosPixelMapInfo * info ) +``` + +**描述:** + +获取 **PixelMap** 的信息,并记录信息到[OhosPixelMapInfo](_ohos_pixel_map_info.md)结构中。 + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| env | napi的环境指针。 | +| value | 应用层的 **PixelMap** 对象。 | +| info | 用于保存信息的指针对象。更多细节, 参看 [OhosPixelMapInfo](_ohos_pixel_map_info.md)。 | + +**返回:** + +如果获取并保存信息成功,则返回**0**; 如果操作失败,则返回错误码。 + +**参见:** + +[OhosPixelMapInfo](_ohos_pixel_map_info.md) + +**自从:** + +8 + + +### OH_UnAccessPixels() + + +``` +int32_t OH_UnAccessPixels (napi_env env, napi_value value ) +``` + +**描述:** + +释放**PixelMap**对象数据的内存锁, 用于匹配方法[OH_AccessPixels](#oh_accesspixels)。 + +**参数:** + +| Name | 描述 | +| -------- | -------- | +| env | napi的环境指针。 | +| value | 应用层的 **PixelMap** 对象。 | + +**返回:** + +操作成功则返回OHOS_IMAGE_RESULT_SUCCESS; 如果操作失败,则返回错误码。 + +**参见:** + +AccessPixels + +**自从:** + +8 diff --git a/zh-cn/application-dev/reference/native-apis/image__pixel__map__napi_8h.md b/zh-cn/application-dev/reference/native-apis/image__pixel__map__napi_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..238b28132f479803995d641db8dd81eb87bcc9eb --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/image__pixel__map__napi_8h.md @@ -0,0 +1,41 @@ +# image_pixel_map_napi.h + + +## 概述 + +声明可以锁定并访问pixelmap数据的方法,声明解锁的方法。 + +**自从:** + +8 + +**相关模块:** + +[Image](image.md) + + +## 汇总 + + +### 结构体 + +| 结构体名称 | 描述 | +| -------- | -------- | +| [OhosPixelMapInfo](_ohos_pixel_map_info.md) | 用于定义 pixel map 的相关信息。 | + + +### 枚举 + +| 枚举名称 | 描述 | +| -------- | -------- | +| { OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0,
OH_NATIVEXCOMPONENT_RESULT_FAILED = -1,
OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2,
OHOS_IMAGE_RESULT_SUCCESS = 0,
OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | 函数方法返回值的错误码的[枚举](image.md#anonymous-enum)。 | +| { OHOS_PIXEL_MAP_FORMAT_NONE = 0,
OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3,
OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | pixel 格式的[枚举](image.md#anonymous-enum-1)。 | + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_GetImageInfo](image.md#oh_getimageinfo) (napi_env env, napi_value value, [OhosPixelMapInfo](_ohos_pixel_map_info.md) \*info) | 获取 **PixelMap** 的信息,并记录信息到[OhosPixelMapInfo](_ohos_pixel_map_info.md)结构中。 | +| [OH_AccessPixels](image.md#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | 获取**PixelMap**对象数据的内存地址,并锁定该内存。 | +| [OH_UnAccessPixels](image.md#oh_unaccesspixels) (napi_env env, napi_value value) | 释放**PixelMap**对象数据的内存锁, 用于匹配方法[OH_AccessPixels](image.md#oh_accesspixels)。 | diff --git a/zh-cn/application-dev/reference/native-apis/log_8h.md b/zh-cn/application-dev/reference/native-apis/log_8h.md index 2eea0fb831a908493fc92953d85a465273e06bc2..5c24372e04d02df296b1d7bcef844611ae3781b3 100644 --- a/zh-cn/application-dev/reference/native-apis/log_8h.md +++ b/zh-cn/application-dev/reference/native-apis/log_8h.md @@ -1,48 +1,84 @@ # log.h -## **Overview** +## 概述 -**Related Modules:** +HiLog模块日志接口定义,通过这些接口实现日志打印相关功能。 -[HiLog](_hi_log.md) +用户输出日志时,先定义日志所属业务领域、日志TAG,然后按照类型、级别选择对应API,指定参数隐私标识输出日志内容。 -**Description:** +业务领域:指定日志所对应的业务领域,用户自定义使用,用于标识业务的子系统、模块。16进制整数,范围0x0~0xFFFF。 -HiLog模块日志接口定义,通过这些接口实现日志打印相关功能。 +日志TAG:字符串常量,用于标识调用所在的类或者业务。 + +日志级别:DEBUG、INFO、WARN、ERROR、FATAL。 + +参数格式:类printf的方式,包括格式字符串(包括参数类型标识)和变参。 + +隐私参数标识:在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 + +注意:每个参数未指定隐私标识时,缺省为隐私。 + +使用示例: + +定义业务领域、TAG: + + +``` +#define LOG_DOMAIN 0x0201 +#define LOG_TAG "MY_TAG" +``` -用户输出日志时,先定义日志所属业务领域、日志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. +日志打印: + + +``` +HILOG_WARN(LOG_APP, "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 , reason:503. +``` + +**自从:** -**Since:** 8 -## **Summary** +**相关模块:** + +[HiLog](_hi_log.md) + + +## 汇总 -### 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级别写日志,宏封装接口。 | +| [LOG_DOMAIN](_hi_log.md#log_domain) 0 | 日志所对应的业务领域,用于标识业务的子系统、模块。 | +| [LOG_TAG](_hi_log.md#log_tag) NULL | 字符串常量,标识调用所在的类或者业务。 | +| [OH_LOG_DEBUG](_hi_log.md#oh_log_debug)(type, ...) ((void)[OH_LOG_Print](_hi_log.md#oh_log_print)((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_)) | DEBUG级别写日志,宏封装接口。 | +| [OH_LOG_INFO](_hi_log.md#oh_log_info)(type, ...) ((void)[OH_LOG_Print](_hi_log.md#oh_log_print)((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_)) | INFO级别写日志,宏封装接口。 | +| [OH_LOG_WARN](_hi_log.md#oh_log_warn)(type, ...) ((void)[OH_LOG_Print](_hi_log.md#oh_log_print)((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_)) | WARN级别写日志,宏封装接口。 | +| [OH_LOG_ERROR](_hi_log.md#oh_log_error)(type, ...) ((void)[OH_LOG_Print](_hi_log.md#oh_log_print)((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_)) | ERROR级别写日志,宏封装接口。 | +| [OH_LOG_FATAL](_hi_log.md#oh_log_fatal)(type, ...) ((void)HiLogPrint((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_s)) | 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 } | 日志级别。 | +| [LogType](_hi_log.md#logtype) { LOG_APP= 0 } | 日志类型。 | +| [LogLevel](_hi_log.md#loglevel) { LOG_DEBUG = 3, LOG_INFO = 4, LOG_WARN = 5, LOG_ERROR = 6, LOG_FATAL =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、级别的日志是否可以打印。 | +| [OH_LOG_Print](_hi_log.md#oh_log_print) ([LogType](_hi_log.md#logtype) type, [LogLevel](_hi_log.md#loglevel) level, unsigned int domain, const char \*tag, const char \*fmt,...) __attribute__((__format__(os_log | 写日志接口。 | +| [OH_LOG_IsLoggable](_hi_log.md#oh_log_isloggable) (unsigned int domain, const char \*tag, [LogLevel](_hi_log.md#loglevel) level) | 检查指定业务领域、TAG、级别的日志是否可以打印。 | diff --git a/zh-cn/application-dev/reference/native-apis/native__buffer_8h.md b/zh-cn/application-dev/reference/native-apis/native__buffer_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..ed6c7c55523f9766316266a0cf34d1639d6a98e2 --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/native__buffer_8h.md @@ -0,0 +1,37 @@ +# native_buffer.h + + +## 概述 + +定义获取和使用NativeBuffer的相关函数。 + +**自从:** + +9 + +**相关模块:** + +[OH_NativeBuffer](_o_h___native_buffer.md) + + +## 汇总 + + +### 结构体 + +| 结构体名称 | 描述 | +| -------- | -------- | +| [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) | OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性。 | + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_NativeBuffer_Alloc](_o_h___native_buffer.md#oh_nativebuffer_alloc) (const [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) \*config) | 通过OH_NativeBuffer_Config创建OH_NativeBuffer实例,每次调用都会产生一个新的OH_NativeBuffer实例。 | +| [OH_NativeBuffer_Reference](_o_h___native_buffer.md#oh_nativebuffer_reference) (OH_NativeBuffer \*buffer) | 将OH_NativeBuffer对象的引用计数加1。 | +| [OH_NativeBuffer_Unreference](_o_h___native_buffer.md#oh_nativebuffer_unreference) (OH_NativeBuffer \*buffer) | 将OH_NativeBuffer对象的引用计数减1,当引用计数为0的时候,该NativeBuffer对象会被析构掉。 | +| [OH_NativeBuffer_GetConfig](_o_h___native_buffer.md#oh_nativebuffer_getconfig) (OH_NativeBuffer \*buffer, [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) \*config) | 用于获取OH_NativeBuffer的属性。 | +| [OH_NativeBuffer_Map](_o_h___native_buffer.md#oh_nativebuffer_map) (OH_NativeBuffer \*buffer, void \*\*virAddr) | 将OH_NativeBuffer对应的ION内存映射到进程空间。 | +| [OH_NativeBuffer_Unmap](_o_h___native_buffer.md#oh_nativebuffer_unmap) (OH_NativeBuffer \*buffer) | 将OH_NativeBuffer对应的ION内存从进程空间移除。 | +| [OH_NativeBuffer_GetSeqNum](_o_h___native_buffer.md#oh_nativebuffer_getseqnum) (OH_NativeBuffer \*buffer) | 获取OH_NativeBuffer的序列号。 | diff --git a/zh-cn/application-dev/reference/native-apis/native__image_8h.md b/zh-cn/application-dev/reference/native-apis/native__image_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..caea888e50505ae86500995cbf20286c2e7b09dc --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/native__image_8h.md @@ -0,0 +1,31 @@ +# native_image.h + + +## 概述 + +定义获取和使用NativeImage的相关函数。 + +**自从:** + +9 + +**相关模块:** + +[OH_NativeImage](_o_h___native_image.md) + + +## 汇总 + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_NativeImage_Create](_o_h___native_image.md#oh_nativeimage_create) (uint32_t textureId, uint32_t textureTarget) | 创建一个**OH_NativeImage**实例,该实例与OPENGL ES的纹理ID和纹理目标相关联. | +| [OH_NativeImage_AcquireNativeWindow](_o_h___native_image.md#oh_nativeimage_acquirenativewindow) (OH_NativeImage \*image) | 获取与OH_NativeImage相关联的OHNativeWindow指针. 该OHNativeWindow后续不再需要时需要调用 OH_NativeWindow_DestroyNativeWindow释放. | +| [OH_NativeImage_AttachContext](_o_h___native_image.md#oh_nativeimage_attachcontext) (OH_NativeImage \*image, uint32_t textureId) | 将OH_NativeImage实例附加到当前OPENGL ES上下文, 且该OPENGL ES纹理会绑定到 GL_TEXTURE_EXTERNAL_OES, 并通过OH_NativeImage进行更新. | +| [OH_NativeImage_DetachContext](_o_h___native_image.md#oh_nativeimage_detachcontext) (OH_NativeImage \*image) | 将OH_NativeImage实例从当前OPENGL ES上下文分离. | +| [OH_NativeImage_UpdateSurfaceImage](_o_h___native_image.md#oh_nativeimage_updatesurfaceimage) (OH_NativeImage \*image) | 通过OH_NativeImage获取最新帧更新相关联的OPENGL ES纹理. | +| [OH_NativeImage_GetTimestamp](_o_h___native_image.md#oh_nativeimage_gettimestamp) (OH_NativeImage \*image) | 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的相关时间戳. | +| [OH_NativeImage_GetTransformMatrix](_o_h___native_image.md#oh_nativeimage_gettransformmatrix) (OH_NativeImage \*image, float matrix[16]) | 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的变化矩阵. | +| [OH_NativeImage_Destroy](_o_h___native_image.md#oh_nativeimage_destroy) (OH_NativeImage \*\*image) | 销毁通过OH_NativeImage_Create创建的**OH_NativeImage**实例, 销毁后该 **OH_NativeImage**指针会被赋值为空. | 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 deleted file mode 100644 index f1ce9e42275c16106f00e76c95620530cd5714b2..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/native-apis/native__interface__bundle_8h.md +++ /dev/null @@ -1,26 +0,0 @@ -# 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 index ba93772b7ad31530121af3f533c315fdf674756c..828299dc0d15d21c86eac9ac0708a1cb1d1ace10 100644 --- 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 @@ -1,62 +1,68 @@ # native_interface_xcomponent.h -## **Overview** +## 概述 -**Related Modules:** +声明用于访问Native XComponent的API。 -[Native XComponent](_o_h___native_x_component.md) +**自从:** -**Description:** +8 -Declares APIs for accessing a Native XComponent. +**相关模块:** + +[Native XComponent](_o_h___native_x_component.md) -**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. | +| [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) | 触摸事件中触摸点的信息。 | +| [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) | 触摸事件。 | +| [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) | 鼠标事件。 | +| [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) | 注册surface生命周期和触摸事件回调。 | +| [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) | 注册鼠标事件的回调。 | -### Macros +### 类型定义 - | Macro Name and Value | Description | +| 类型定义名称 | 描述 | | -------- | -------- | -| **OH_NATIVE_XCOMPONENT_OBJ**   ("__NATIVE_XCOMPONENT_OBJ__") | | +| [OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) | 提供封装的OH_NativeXComponent实例。 | +| [OH_NativeXComponent_Callback](_o_h___native_x_component.md#oh_nativexcomponent_callback) | 注册surface生命周期和触摸事件回调。 | +| [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component.md#oh_nativexcomponent_mouseevent_callback) | 注册鼠标事件的回调。 | -### 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. | +| { OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0,
OH_NATIVEXCOMPONENT_RESULT_FAILED = -1,
OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2,
OHOS_IMAGE_RESULT_SUCCESS = 0,
OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | [枚举](_o_h___native_x_component.md#anonymous-enum)API访问状态。 | +| [OH_NativeXComponent_TouchEventType](_o_h___native_x_component.md#oh_nativexcomponent_toucheventtype) {
OH_NATIVEXCOMPONENT_DOWN = 0,
OH_NATIVEXCOMPONENT_UP,
OH_NATIVEXCOMPONENT_MOVE,
OH_NATIVEXCOMPONENT_CANCEL,
OH_NATIVEXCOMPONENT_UNKNOWN } | 触摸事件类型。 | +| [OH_NativeXComponent_MouseEventAction](_o_h___native_x_component.md#oh_nativexcomponent_mouseeventaction) {
OH_NATIVEXCOMPONENT_MOUSE_NONE = 0,
OH_NATIVEXCOMPONENT_MOUSE_PRESS,
OH_NATIVEXCOMPONENT_MOUSE_RELEASE,
OH_NATIVEXCOMPONENT_MOUSE_MOVE } | 鼠标事件动作。 | +| [OH_NativeXComponent_MouseEventButton](_o_h___native_x_component.md#oh_nativexcomponent_mouseeventbutton) {
OH_NATIVEXCOMPONENT_NONE_BUTTON = 0,
OH_NATIVEXCOMPONENT_LEFT_BUTTON = 0x01,
OH_NATIVEXCOMPONENT_RIGHT_BUTTON = 0x02,
OH_NATIVEXCOMPONENT_MIDDLE_BUTTON = 0x04,
OH_NATIVEXCOMPONENT_BACK_BUTTON = 0x08,
OH_NATIVEXCOMPONENT_FORWARD_BUTTON = 0x10 } | 鼠标事件按键。 | -### 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) } | | +| [OH_NativeXComponent_GetXComponentId](_o_h___native_x_component.md#oh_nativexcomponent_getxcomponentid) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, char \*id, uint64_t \*size) | 获取ArkUI XComponent的id。 | +| [OH_NativeXComponent_GetXComponentSize](_o_h___native_x_component.md#oh_nativexcomponent_getxcomponentsize) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, const void \*window, uint64_t \*width, uint64_t \*height) | 获取ArkUI XComponent持有的surface的大小。 | +| [OH_NativeXComponent_GetXComponentOffset](_o_h___native_x_component.md#oh_nativexcomponent_getxcomponentoffset) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, const void \*window, double \*x, double \*y) | 获取ArkUI XComponent组件相对屏幕左上顶点的偏移量。 | +| [OH_NativeXComponent_GetTouchEvent](_o_h___native_x_component.md#oh_nativexcomponent_gettouchevent) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, const void \*window, [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) \*touchEvent) | 获取ArkUI XComponent调度的触摸事件。 | +| [OH_NativeXComponent_GetMouseEvent](_o_h___native_x_component.md#oh_nativexcomponent_getmouseevent) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, const void \*window, [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) \*mouseEvent) | 获取ArkUI XComponent调度的鼠标事件 | +| [OH_NativeXComponent_RegisterCallback](_o_h___native_x_component.md#oh_nativexcomponent_registercallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) \*callback) | 为此OH_NativeXComponent实例注册回调。 | +| [OH_NativeXComponent_RegisterMouseEventCallback](_o_h___native_x_component.md#oh_nativexcomponent_registermouseeventcallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) \*callback) | 为此OH_NativeXComponent实例注册鼠标事件回调。 | -### 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. | +| **OH_XCOMPONENT_ID_LEN_MAX** = 128 | ArkUI XComponent的id的最大长度。 | +| **OH_MAX_TOUCH_POINTS_NUMBER** = 10 | 触摸事件中的可识别的触摸点个数最大值。 | diff --git a/zh-cn/application-dev/reference/native-apis/native__vsync_8h.md b/zh-cn/application-dev/reference/native-apis/native__vsync_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..498cb8e9c30f1c486de37a3b8f95f7bf66dfcdab --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/native__vsync_8h.md @@ -0,0 +1,26 @@ +# native_vsync.h + + +## 概述 + +定义获取和使用NativeVsync的相关函数。 + +**自从:** + +8 + +**相关模块:** + +[NativeVsync](_native_vsync.md) + + +## 汇总 + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_NativeVSync_Create](_native_vsync.md#oh_nativevsync_create) (const char \*name, unsigned int length) | 创建一个OH_NativeVSync实例,每次调用都会产生一个新的实例。 | +| [OH_NativeVSync_Destroy](_native_vsync.md#oh_nativevsync_destroy) (OH_NativeVSync \*nativeVsync) | 销毁OH_NativeVSync实例。 | +| [OH_NativeVSync_RequestFrame](_native_vsync.md#oh_nativevsync_requestframe) (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | 请求下一次vsync信号,当信号到来时,调用回调函数callback。 | 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 index 62fa049bd1558ba59b75b178d0b0dc939f22728e..a574686576bf57790583b4713cc893d4fa32a3ad 100644 --- a/zh-cn/application-dev/reference/native-apis/raw__dir_8h.md +++ b/zh-cn/application-dev/reference/native-apis/raw__dir_8h.md @@ -1,37 +1,35 @@ # raw_dir.h -## **Overview** +## 概述 -**Related Modules:** +提供rawfile目录相关功能。 -[Rawfile](rawfile.md) +功能包括遍历和关闭rawfile目录。 -**Description:** +**自从:** -提供rawfile目录相关功能 +8 -功能包括遍历和关闭rawfile目录 +**相关模块:** + +[Rawfile](rawfile.md) -**Since:** -8 -**Version:** -1.0 -## **Summary** +## 汇总 -### Typedefs +### 类型定义 - | Typedef Name | Description | +| 类型定义名称 | 描述 | | -------- | -------- | -| [RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3) | typedef struct [RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)
提供对rawfile目录的访问 | +| [RawDir](rawfile.md#rawdir) | 提供对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)并释放所有相关联资源 | +| [OH_ResourceManager_GetRawFileName](rawfile.md#oh_resourcemanager_getrawfilename) ([RawDir](rawfile.md#rawdir) \*rawDir, int index) | 通过索引获取rawfile文件名称 | +| [OH_ResourceManager_GetRawFileCount](rawfile.md#oh_resourcemanager_getrawfilecount) ([RawDir](rawfile.md#rawdir) \*rawDir) | 获取[RawDir](rawfile.md#rawdir)中的rawfile数量 | +| [OH_ResourceManager_CloseRawDir](rawfile.md#oh_resourcemanager_closerawdir) ([RawDir](rawfile.md#rawdir) \*rawDir) | 关闭已打开的[RawDir](rawfile.md#rawdir)并释放所有相关联资源 | 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 index a59adf879bd1e1a6e803f63bd7d40cb5fbc12a6d..1cb2a8dd654212642731247d0723a6a01d421678 100644 --- a/zh-cn/application-dev/reference/native-apis/raw__file_8h.md +++ b/zh-cn/application-dev/reference/native-apis/raw__file_8h.md @@ -1,48 +1,46 @@ # raw_file.h -## **Overview** +## 概述 -**Related Modules:** +提供rawfile文件相关功能。 -[Rawfile](rawfile.md) +功能包括搜索、读取和关闭rawfile文件。 -**Description:** +**自从:** -提供rawfile文件相关功能 +8 -功能包括搜索、读取和关闭rawfile文件 +**相关模块:** + +[Rawfile](rawfile.md) -**Since:** -8 -**Version:** -1.0 -## **Summary** +## 汇总 -### Classes +### 结构体 - | Classe Name | Description | +| 结构体名称 | 描述 | | -------- | -------- | -| [RawFileDescriptor](_raw_file_descriptor.md) | 提供rawfile文件描述符信息 | +| [RawFileDescriptor](_raw_file_descriptor.md) | 提供rawfile文件描述符信息 | -### Typedefs +### 类型定义 - | Typedef Name | Description | +| 类型定义名称 | 描述 | | -------- | -------- | -| [RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) | typedef struct [RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)
提供对rawfile的访问功能 | +| [RawFile](rawfile.md#rawfile) | 提供对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文件描述符 | +| [OH_ResourceManager_ReadRawFile](rawfile.md#oh_resourcemanager_readrawfile) (const [RawFile](rawfile.md#rawfile) \*rawFile, void \*buf, size_t length) | 读取rawfile | +| [OH_ResourceManager_SeekRawFile](rawfile.md#oh_resourcemanager_seekrawfile) (const [RawFile](rawfile.md#rawfile) \*rawFile, long offset, int whence) | 基于指定的offset,在rawfile文件内搜索读写数据的位置 | +| [OH_ResourceManager_GetRawFileSize](rawfile.md#oh_resourcemanager_getrawfilesize) ([RawFile](rawfile.md#rawfile) \*rawFile) | 获取rawfile长度,单位为int32_t | +| [OH_ResourceManager_CloseRawFile](rawfile.md#oh_resourcemanager_closerawfile) ([RawFile](rawfile.md#rawfile) \*rawFile) | 关闭已打开的[RawFile](rawfile.md#rawfile) 以及释放所有相关联资源 | +| [OH_ResourceManager_GetRawFileOffset](rawfile.md#oh_resourcemanager_getrawfileoffset) (const [RawFile](rawfile.md#rawfile) \*rawFile) | 获取rawfile当前的offset,单位为int32_t | +| [OH_ResourceManager_GetRawFileDescriptor](rawfile.md#oh_resourcemanager_getrawfiledescriptor) (const [RawFile](rawfile.md#rawfile) \*rawFile, [RawFileDescriptor](_raw_file_descriptor.md) &descriptor) | 基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符 | +| [OH_ResourceManager_ReleaseRawFileDescriptor](rawfile.md#oh_resourcemanager_releaserawfiledescriptor) (const [RawFileDescriptor](_raw_file_descriptor.md) &descriptor) | 关闭rawfile文件描述符 | diff --git a/zh-cn/application-dev/reference/native-apis/raw__file__manager_8h.md b/zh-cn/application-dev/reference/native-apis/raw__file__manager_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..405a8d1efc18b27d8b38f8da08c9d6895b05781d --- /dev/null +++ b/zh-cn/application-dev/reference/native-apis/raw__file__manager_8h.md @@ -0,0 +1,36 @@ +# raw_file_manager.h + + +## 概述 + +提供资源管理rawfile相关功能。 + +可以使用resource manager打开rawfile来进行后续相关操作,像搜索和读取等。 + +**自从:** + +8 + +**相关模块:** + +[Rawfile](rawfile.md) + + +## 汇总 + + +### 类型定义 + +| 类型定义名称 | 描述 | +| -------- | -------- | +| [NativeResourceManager](rawfile.md#nativeresourcemanager) | 代表resource manager | + + +### 函数 + +| 函数名称 | 描述 | +| -------- | -------- | +| [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager) (napi_env env, napi_value jsResMgr) | 基于JavaScipt resource manager获取native resource manager | +| [OH_ResourceManager_ReleaseNativeResourceManager](rawfile.md#oh_resourcemanager_releasenativeresourcemanager) ([NativeResourceManager](rawfile.md#nativeresourcemanager) \*resMgr) | 释放native resource manager | +| [OH_ResourceManager_OpenRawDir](rawfile.md#oh_resourcemanager_openrawdir) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*dirName) | 打开rawfile目录 | +| [OH_ResourceManager_OpenRawFile](rawfile.md#oh_resourcemanager_openrawfile) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*fileName) | 打开rawfile文件 | diff --git a/zh-cn/application-dev/reference/native-apis/rawfile.md b/zh-cn/application-dev/reference/native-apis/rawfile.md index dce330b2c62b451213e64396cee40fbda40763a8..b169a109787483b3ca1156828462b59b37915b4f 100644 --- a/zh-cn/application-dev/reference/native-apis/rawfile.md +++ b/zh-cn/application-dev/reference/native-apis/rawfile.md @@ -1,74 +1,70 @@ # Rawfile -## **Overview** +提供操作rawfile目录和rawfile文件的功能。 -**Description:** -提供操作rawfile目录和rawfile文件的功能 +功能包括遍历、打开、搜索、读取和关闭rawfile。 -功能包括遍历、打开、搜索、读取和关闭rawfile -**Since:** +**自从:** -8 - -**Version:** -1.0 +8 -## **Summary** +## 汇总 -### Files +### 文件 - | File Name | Description | + | 文件名称 | 描述 | | -------- | -------- | -| [raw_dir.h](raw__dir_8h.md) | 提供rawfile目录相关功能 | -| [raw_file.h](raw__file_8h.md) | 提供rawfile文件相关功能 | +| [raw_dir.h](raw__dir_8h.md) | 提供rawfile目录相关功能。 | +| [raw_file.h](raw__file_8h.md) | 提供rawfile文件相关功能。 | +| [raw_file_manager.h](raw__file__manager_8h.md) | 提供资源管理rawfile相关功能。 | -### Classes +### 结构体 - | Classe Name | Description | + | 结构体名称 | 描述 | | -------- | -------- | -| [RawFileDescriptor](_raw_file_descriptor.md) | 提供rawfile文件描述符信息 | +| [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 | +| [RawDir](#rawdir) | 提供对rawfile目录的访问。 | +| [RawFile](#rawfile) | 提供对rawfile的访问功能。 | +| [NativeResourceManager](#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文件 | +| [OH_ResourceManager_GetRawFileName](#oh_resourcemanager_getrawfilename) ([RawDir](#rawdir) \*rawDir, int index) | 通过索引获取rawfile文件名称。 | +| [OH_ResourceManager_GetRawFileCount](#oh_resourcemanager_getrawfilecount) ([RawDir](#rawdir) \*rawDir) | 获取[RawDir](#rawdir)中的rawfile数量。 | +| [OH_ResourceManager_CloseRawDir](#oh_resourcemanager_closerawdir) ([RawDir](#rawdir) \*rawDir) | 关闭已打开的[RawDir](#rawdir)并释放所有相关联资源。 | +| [OH_ResourceManager_ReadRawFile](#oh_resourcemanager_readrawfile) (const [RawFile](#rawfile) \*rawFile, void \*buf, size_t length) | 读取rawfile。 | +| [OH_ResourceManager_SeekRawFile](#oh_resourcemanager_seekrawfile) (const [RawFile](#rawfile) \*rawFile, long offset, int whence) | 基于指定的offset,在rawfile文件内搜索读写数据的位置。 | +| [OH_ResourceManager_GetRawFileSize](#oh_resourcemanager_getrawfilesize) ([RawFile](#rawfile) \*rawFile) | 获取rawfile长度,单位为int32_t。 | +| [OH_ResourceManager_CloseRawFile](#oh_resourcemanager_closerawfile) ([RawFile](#rawfile) \*rawFile) | 关闭已打开的[RawFile](#rawfile) 以及释放所有相关联资源。 | +| [OH_ResourceManager_GetRawFileOffset](#oh_resourcemanager_getrawfileoffset) (const [RawFile](#rawfile) \*rawFile) | 获取rawfile当前的offset,单位为int32_t。 | +| [OH_ResourceManager_GetRawFileDescriptor](#oh_resourcemanager_getrawfiledescriptor) (const [RawFile](#rawfile) \*rawFile, [RawFileDescriptor](_raw_file_descriptor.md) &descriptor) | 基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符。 | +| [OH_ResourceManager_ReleaseRawFileDescriptor](#oh_resourcemanager_releaserawfiledescriptor) (const [RawFileDescriptor](_raw_file_descriptor.md) &descriptor) | 关闭rawfile文件描述符。 | +| [OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager) (napi_env env, napi_value jsResMgr) | 基于JavaScipt resource manager获取native resource manager。 | +| [OH_ResourceManager_ReleaseNativeResourceManager](#oh_resourcemanager_releasenativeresourcemanager) ([NativeResourceManager](#nativeresourcemanager) \*resMgr) | 释放native resource manager。 | +| [OH_ResourceManager_OpenRawDir](#oh_resourcemanager_openrawdir) (const [NativeResourceManager](#nativeresourcemanager) \*mgr, const char \*dirName) | 打开rawfile目录。 | +| [OH_ResourceManager_OpenRawFile](#oh_resourcemanager_openrawfile) (const [NativeResourceManager](#nativeresourcemanager) \*mgr, const char \*fileName) | 打开rawfile文件。 | -## **Details** +## 详细描述 -## **Typedef** +## 类型定义说明 ### NativeResourceManager @@ -78,11 +74,15 @@ typedef struct NativeResourceManager NativeResourceManager ``` -**Description:** +**描述:** -代表resource manager +代表resource manager。 -此类封装了JavaScript resource manager的native实现 **ResourceManager**指针可以通过调用OH_ResourceManager_InitNativeResourceManager方法获取 +此类封装了JavaScript resource manager的native实现 **ResourceManager**指针可以通过调用[OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager)方法获取 + +**自从:** + +8 ### RawDir @@ -92,9 +92,13 @@ typedef struct NativeResourceManager NativeResourceManager typedef struct RawDir RawDir ``` -**Description:** +**描述:** + +提供对rawfile目录的访问。 -提供对rawfile目录的访问 +**自从:** + +8 ### RawFile @@ -104,12 +108,16 @@ typedef struct RawDir RawDir typedef struct RawFile RawFile ``` -**Description:** +**描述:** -提供对rawfile的访问功能 +提供对rawfile的访问功能。 +**自从:** + +8 -## **Function** + +## 函数说明 ### OH_ResourceManager_CloseRawDir() @@ -119,19 +127,23 @@ typedef struct RawFile RawFile void OH_ResourceManager_CloseRawDir (RawDir * rawDir) ``` -**Description:** +**描述:** -关闭已打开的RawDir并释放所有相关联资源 +关闭已打开的[RawDir](#rawdir)并释放所有相关联资源。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| rawDir | 表示指向RawDir的指针 | +| rawDir | 表示指向[RawDir](#rawdir)的指针。 | + +**参见:** -**See also:** +[OH_ResourceManager_OpenRawDir](#oh_resourcemanager_openrawdir) -OH_ResourceManager_OpenRawDir +**自从:** + +8 ### OH_ResourceManager_CloseRawFile() @@ -141,19 +153,23 @@ OH_ResourceManager_OpenRawDir void OH_ResourceManager_CloseRawFile (RawFile * rawFile) ``` -**Description:** +**描述:** -关闭已打开的RawFile 以及释放所有相关联资源 +关闭已打开的[RawFile](#rawfile) 以及释放所有相关联资源。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| rawFile | 表示指向RawFile的指针 | +| rawFile | 表示指向[RawFile](#rawfile)的指针。 | + +**参见:** -**See also:** +[OH_ResourceManager_OpenRawFile](#oh_resourcemanager_openrawfile) -OH_ResourceManager_OpenRawFile +**自从:** + +8 ### OH_ResourceManager_GetRawFileCount() @@ -163,21 +179,25 @@ OH_ResourceManager_OpenRawFile int OH_ResourceManager_GetRawFileCount (RawDir * rawDir) ``` -**Description:** +**描述:** -获取RawDir中的rawfile数量 +获取[RawDir](#rawdir)中的rawfile数量。 -通过此方法可以获取OH_ResourceManager_GetRawFileName中可用的索引 +通过此方法可以获取[OH_ResourceManager_GetRawFileName](#oh_resourcemanager_getrawfilename)中可用的索引。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| rawDir | 表示指向RawDir的指针 | +| rawDir | 表示指向[RawDir](#rawdir)的指针。 | -**See also:** +**参见:** -OH_ResourceManager_GetRawFileName +[OH_ResourceManager_GetRawFileName](#oh_resourcemanager_getrawfilename) + +**自从:** + +8 ### OH_ResourceManager_GetRawFileDescriptor() @@ -187,22 +207,26 @@ OH_ResourceManager_GetRawFileName bool OH_ResourceManager_GetRawFileDescriptor (const RawFile * rawFile, RawFileDescriptor & descriptor ) ``` -**Description:** +**描述:** -基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符 +基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符。 -打开的文件描述符被用于读取rawfile +打开的文件描述符被用于读取rawfile。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| rawFile | 表示指向RawFile的指针 | -| descriptor | 显示rawfile文件描述符,以及在HAP包中的起始位置和长度 | +| rawFile | 表示指向[RawFile](#rawfile)的指针。 | +| descriptor | 显示rawfile文件描述符,以及在HAP包中的起始位置和长度。 | -**Returns:** +**返回:** -返回true表示打开rawfile文件描述符成功,返回false表示rawfile不允许被访问 +返回true表示打开rawfile文件描述符成功,返回false表示rawfile不允许被访问。 + +**自从:** + +8 ### OH_ResourceManager_GetRawFileName() @@ -212,26 +236,30 @@ bool OH_ResourceManager_GetRawFileDescriptor (const RawFile * rawFile, RawFileDe const char* OH_ResourceManager_GetRawFileName (RawDir * rawDir, int index ) ``` -**Description:** +**描述:** -通过索引获取rawfile文件名称 +通过索引获取rawfile文件名称。 -可以使用此方法遍历rawfile目录 +可以使用此方法遍历rawfile目录。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| rawDir | 表示指向RawDir的指针 | -| index | 表示文件在RawDir中的索引位置 | +| rawDir | 表示指向[RawDir](#rawdir)的指针。 | +| index | 表示文件在[RawDir](#rawdir)中的索引位置。 | -**Returns:** +**返回:** -通过索引返回文件名称,此返回值可以作为OH_ResourceManager_OpenRawFile的输入参数, 如果遍历完所有文件仍未找到,则返回**NULL** +通过索引返回文件名称,此返回值可以作为[OH_ResourceManager_OpenRawFile](#oh_resourcemanager_openrawfile)的输入参数, 如果遍历完所有文件仍未找到,则返回**NULL**。 -**See also:** +**参见:** -OH_ResourceManager_OpenRawFile +[OH_ResourceManager_OpenRawFile](#oh_resourcemanager_openrawfile) + +**自从:** + +8 ### OH_ResourceManager_GetRawFileOffset() @@ -241,21 +269,25 @@ OH_ResourceManager_OpenRawFile long OH_ResourceManager_GetRawFileOffset (const RawFile * rawFile) ``` -**Description:** +**描述:** -获取rawfile当前的offset,单位为int32_t +获取rawfile当前的offset,单位为int32_t。 -rawfile当前的offset +rawfile当前的offset。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| rawFile | 表示指向RawFile的指针 | +| rawFile | 表示指向[RawFile](#rawfile)的指针。 | -**Returns:** +**返回:** -返回rawfile当前的offset +返回rawfile当前的offset。 + +**自从:** + +8 ### OH_ResourceManager_GetRawFileSize() @@ -265,19 +297,23 @@ rawfile当前的offset long OH_ResourceManager_GetRawFileSize (RawFile * rawFile) ``` -**Description:** +**描述:** -获取rawfile长度,单位为int32_t +获取rawfile长度,单位为int32_t。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| rawFile | 表示指向RawFile的指针 | +| rawFile | 表示指向[RawFile](#rawfile)的指针。 | -**Returns:** +**返回:** -Returns rawfile整体长度 +Returns rawfile整体长度。 + +**自从:** + +8 ### OH_ResourceManager_InitNativeResourceManager() @@ -287,22 +323,26 @@ Returns rawfile整体长度 NativeResourceManager* OH_ResourceManager_InitNativeResourceManager (napi_env env, napi_value jsResMgr ) ``` -**Description:** +**描述:** -基于JavaScipt resource manager获取native resource manager +基于JavaScipt resource manager获取native resource manager。 -通过获取resource manager来完成rawfile相关功能 +通过获取resource manager来完成rawfile相关功能。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| env | 表示JavaScipt Native Interface (napi)环境指针 | -| jsResMgr | 表示JavaScipt resource manager | +| env | 表示JavaScipt Native Interface (napi)环境指针。 | +| jsResMgr | 表示JavaScipt resource manager。 | + +**返回:** -**Returns:** +返回[NativeResourceManager](#nativeresourcemanager)指针。 -返回NativeResourceManager指针 +**自从:** + +8 ### OH_ResourceManager_OpenRawDir() @@ -312,28 +352,32 @@ NativeResourceManager* OH_ResourceManager_InitNativeResourceManager (napi_env en RawDir* OH_ResourceManager_OpenRawDir (const NativeResourceManager * mgr, const char * dirName ) ``` -**Description:** +**描述:** -打开rawfile目录 +打开rawfile目录。 -打开rawfile目录后,可以遍历对应目录下的rawfile文件 +打开rawfile目录后,可以遍历对应目录下的rawfile文件。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| mgr | 表示指向NativeResourceManager的指针,此指针是通过调用 OH_ResourceManager_InitNativeResourceManager方法获取的 | -| dirName | 表示要打开的rawfile目录名称,当传递一个空字符串时表示打开rawfile根目录 | +| mgr | 表示指向[NativeResourceManager](#nativeresourcemanager)的指针,此指针是通过调用 [OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager)方法获取的。 | +| dirName | 表示要打开的rawfile目录名称,当传递一个空字符串时表示打开rawfile根目录。 | -**Returns:** +**返回:** -返回RawDir指针。使用完此指针后,调用OH_ResourceManager_CloseRawDir释放。 +返回[RawDir](#rawdir)指针。使用完此指针后,调用[OH_ResourceManager_CloseRawDir](#oh_resourcemanager_closerawdir)释放。 -**See also:** +**参见:** -OH_ResourceManager_InitNativeResourceManager +[OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager) -OH_ResourceManager_CloseRawDir +[OH_ResourceManager_CloseRawDir](#oh_resourcemanager_closerawdir) + +**自从:** + +8 ### OH_ResourceManager_OpenRawFile() @@ -343,28 +387,32 @@ OH_ResourceManager_CloseRawDir RawFile* OH_ResourceManager_OpenRawFile (const NativeResourceManager * mgr, const char * fileName ) ``` -**Description:** +**描述:** -打开rawfile文件 +打开rawfile文件。 -当打开rawfile以后,可以读取它的数据 +当打开rawfile以后,可以读取它的数据。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| mgr | 表示指向NativeResourceManager的指针,此指针是通过调用 OH_ResourceManager_InitNativeResourceManager方法获取的 | -| fileName | 表示基于rawfile根目录的相对路径下的文件名称 | +| mgr | 表示指向[NativeResourceManager](#nativeresourcemanager)的指针,此指针是通过调用 [OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager)方法获取的。 | +| fileName | 表示基于rawfile根目录的相对路径下的文件名称。 | + +**返回:** -**Returns:** +返回[RawFile](#rawfile)指针。当使用完此指针,调用[OH_ResourceManager_CloseRawFile](#oh_resourcemanager_closerawfile)释放。 -返回RawFile指针。当使用完此指针,调用OH_ResourceManager_CloseRawFile释放。 +**参见:** -**See also:** +[OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager) -OH_ResourceManager_InitNativeResourceManager +[OH_ResourceManager_CloseRawFile](#oh_resourcemanager_closerawfile) -OH_ResourceManager_CloseRawFile +**自从:** + +8 ### OH_ResourceManager_ReadRawFile() @@ -374,23 +422,27 @@ OH_ResourceManager_CloseRawFile int OH_ResourceManager_ReadRawFile (const RawFile * rawFile, void * buf, size_t length ) ``` -**Description:** +**描述:** -读取rawfile +读取rawfile。 -从当前位置读取**指定长度**的数据 +从当前位置读取**指定长度**的数据。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| rawFile | 表示指向RawFile的指针 | -| buf | 用于接收读取数据的缓冲区指针 | -| length | 读取数据的字节长度 | +| rawFile | 表示指向[RawFile](#rawfile)的指针。 | +| buf | 用于接收读取数据的缓冲区指针。 | +| length | 读取数据的字节长度。 | + +**返回:** -**Returns:** +返回读取的字节数,如果读取长度超过文件末尾长度,则返回**0**。 -返回读取的字节数,如果读取长度超过文件末尾长度,则返回**0** +**自从:** + +8 ### OH_ResourceManager_ReleaseNativeResourceManager() @@ -400,15 +452,19 @@ int OH_ResourceManager_ReadRawFile (const RawFile * rawFile, void * buf, size_t void OH_ResourceManager_ReleaseNativeResourceManager (NativeResourceManager * resMgr) ``` -**Description:** +**描述:** -释放native resource manager +释放native resource manager。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| resMgr | 表示NativeResourceManager指针 | +| resMgr | 表示[NativeResourceManager](#nativeresourcemanager)指针。 | + +**自从:** + +8 ### OH_ResourceManager_ReleaseRawFileDescriptor() @@ -418,21 +474,25 @@ void OH_ResourceManager_ReleaseNativeResourceManager (NativeResourceManager * re bool OH_ResourceManager_ReleaseRawFileDescriptor (const RawFileDescriptor & descriptor) ``` -**Description:** +**描述:** -关闭rawfile文件描述符 +关闭rawfile文件描述符。 -已打开的文件描述符在使用完以后必须释放,防止文件描述符泄露 +已打开的文件描述符在使用完以后必须释放,防止文件描述符泄露。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| descriptor | 包含rawfile文件描述符,以及在HAP包中的起始位置和长度 | +| descriptor | 包含rawfile文件描述符,以及在HAP包中的起始位置和长度。 | -**Returns:** +**返回:** -返回true表示关闭文件描述符成功,返回false表示关闭文件描述符失败 +返回true表示关闭文件描述符成功,返回false表示关闭文件描述符失败。 + +**自从:** + +8 ### OH_ResourceManager_SeekRawFile() @@ -442,18 +502,22 @@ bool OH_ResourceManager_ReleaseRawFileDescriptor (const RawFileDescriptor & desc int OH_ResourceManager_SeekRawFile (const RawFile * rawFile, long offset, int whence ) ``` -**Description:** +**描述:** -基于指定的offset,在rawfile文件内搜索读写数据的位置 +基于指定的offset,在rawfile文件内搜索读写数据的位置。 -**Parameters:** +**参数:** - | Name | Description | + | Name | 描述 | | -------- | -------- | -| rawFile | 表示指向RawFile的指针 | -| offset | 表示指定的offset | -| whence | 读写位置,有以下场景: **0**: 读写位置为**offset1**: 读写位置为当前位置加上**offset2**: 读写位置为文件末尾(EOF)加上**offset** | +| rawFile | 表示指向[RawFile](#rawfile)的指针。 | +| offset | 表示指定的offset。 | +| whence | 读写位置,有以下场景:
**0**: 读写位置为**offset**
**1**: 读写位置为当前位置加上**offset2**: 读写位置为文件末尾(EOF)加上**offset**。 | -**Returns:** +**返回:** -如果搜索成功返回新的读写位置,如果发生错误返回 **(long) -1** +如果搜索成功返回新的读写位置,如果发生错误返回 **(long) -1**。 + +**自从:** + +8 diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md index 3fb27c5a9c9b5e5b4d6688084c7ecea7bf247bae..07ee5b65181a2f9f6aa85acc9c30949d09158be9 100644 --- a/zh-cn/application-dev/website.md +++ b/zh-cn/application-dev/website.md @@ -938,10 +938,11 @@ - 接口参考(Native API) - 模块 - [Native XComponent](reference/native-apis/_o_h___native_x_component.md) - - [Native_Bundle](reference/native-apis/_native___bundle.md) - [HiLog](reference/native-apis/_hi_log.md) - [NativeWindow](reference/native-apis/_native_window.md) - [Drawing](reference/native-apis/_drawing.md) + - [OH_NativeImage](reference/native-apis/_o_h___native_image.md) + - [NativeVsync](reference/native-apis/_native_vsync.md) - [Rawfile](reference/native-apis/rawfile.md) - 头文件 - [drawing_bitmap.h](reference/native-apis/drawing__bitmap_8h.md) @@ -955,16 +956,24 @@ - [drawing_text_typography.h](reference/native-apis/drawing__text__typography_8h.md) - [drawing_types.h](reference/native-apis/drawing__types_8h.md) - [external_window.h](reference/native-apis/external__window_8h.md) + - [image_pixel_map_napi.h](reference/native-apis/image__pixel__map__napi_8h.md) - [log.h](reference/native-apis/log_8h.md) - - [native_interface_bundle.h](reference/native-apis/native__interface__bundle_8h.md) + - [native_buffer.h](reference/native-apis/native__buffer_8h.md) + - [native_image.h](reference/native-apis/native__image_8h.md) - [native_interface_xcomponent.h](reference/native-apis/native__interface__xcomponent_8h.md) + - [native_vsync.h](reference/native-apis/native__vsync_8h.md) - [raw_dir.h](reference/native-apis/raw__dir_8h.md) + - [raw_file_manager.h](reference/native-apis/raw__file__manager_8h.md) - [raw_file.h](reference/native-apis/raw__file_8h.md) - 结构体 - [OH_Drawing_BitmapFormat](reference/native-apis/_o_h___drawing___bitmap_format.md) + - [OH_NativeBuffer_Config](reference/native-apis/_o_h___native_buffer___config.md) - [OH_NativeXComponent_Callback](reference/native-apis/_o_h___native_x_component___callback.md) + - [OH_NativeXComponent_MouseEvent](reference/native-apis/_o_h___native_x_component___mouse_event.md) + - [OH_NativeXComponent_MouseEvent_Callback](reference/native-apis/_o_h___native_x_component___mouse_event___callback.md) - [OH_NativeXComponent_TouchEvent](reference/native-apis/_o_h___native_x_component___touch_event.md) - [OH_NativeXComponent_TouchPoint](reference/native-apis/_o_h___native_x_component___touch_point.md) + - [OhosPixelMapInfo](reference/native-apis/_ohos_pixel_map_info.md) - [RawFileDescriptor](reference/native-apis/_raw_file_descriptor.md) - 标准库 - [Node_API](reference/native-lib/third_party_napi/napi.md)