未验证 提交 ad40db27 编写于 作者: O openharmony_ci 提交者: Gitee

!3153 新增Native API

Merge pull request !3153 from zengyawen/master
# Native API
- MyProject
- [Native XComponent](_o_h___native_x_component.md)
- [Native_Bundle](_native___bundle.md)
- [HiLog](_hi_log.md)
- [NativeWindow](_native_window.md)
- [Drawing](_drawing.md)
- [Rawfile](rawfile.md)
- 头文件和结构体
- 头文件
- [drawing_bitmap.h](drawing__bitmap_8h.md)
- [drawing_brush.h](drawing__brush_8h.md)
- [drawing_canvas.h](drawing__canvas_8h.md)
- [drawing_color.h](drawing__color_8h.md)
- [drawing_font_collection.h](drawing__font__collection_8h.md)
- [drawing_path.h](drawing__path_8h.md)
- [drawing_pen.h](drawing__pen_8h.md)
- [drawing_text_declaration.h](drawing__text__declaration_8h.md)
- [drawing_text_typography.h](drawing__text__typography_8h.md)
- [drawing_types.h](drawing__types_8h.md)
- [external_window.h](external__window_8h.md)
- [log.h](log_8h.md)
- [native_interface_bundle.h](native__interface__bundle_8h.md)
- [native_interface_xcomponent.h](native__interface__xcomponent_8h.md)
- [raw_dir.h](raw__dir_8h.md)
- [raw_file.h](raw__file_8h.md)
- 结构体
- [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)
- [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)
- [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md)
- [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md)
- [RawFileDescriptor](_raw_file_descriptor.md)
此差异已折叠。
# HiLog
## **Overview**
**Description:**
HiLog模块实现日志打印功能。
开发者可以通过使用这些接口实现日志相关功能,输出日志时可以指定日志类型、所属业务领域、日志TAG标识、日志级别等。
\@syscap SystemCapability.HiviewDFX.HiLog
**Since:**
8
## **Summary**
### Files
| File Name | Description |
| -------- | -------- |
| [log.h](log_8h.md) | HiLog模块日志接口定义,通过这些接口实现日志打印相关功能。 |
### Macros
| Macro Name and Value | Description |
| -------- | -------- |
| LOG_DOMAIN   0 | 日志所对应的业务领域,用于标识业务的子系统、模块。 |
| LOG_TAG   NULL | 字符串常量,标识调用所在的类或者业务。 |
| OH_LOG_DEBUG(type, ...)   ((void)OH_LOG_Print((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | DEBUG级别写日志,宏封装接口。 |
| OH_LOG_INFO(type, ...)   ((void)OH_LOG_Print((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | INFO级别写日志,宏封装接口。 |
| OH_LOG_WARN(type, ...)   ((void)OH_LOG_Print((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | WARN级别写日志,宏封装接口。 |
| OH_LOG_ERROR(type, ...)   ((void)OH_LOG_Print((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | ERROR级别写日志,宏封装接口。 |
| OH_LOG_FATAL(type, ...)   ((void)HiLogPrint((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) | FATAL级别写日志,宏封装接口。 |
### Enumerations
| Enumeration Name | Description |
| -------- | -------- |
| LogType { LOG_APP = 0 } | 日志类型。 |
| LogLevel {   LOG_DEBUG = 3, LOG_INFO = 4, LOG_WARN = 5, LOG_ERROR = 6,   LOG_FATAL = 7 } | 日志级别。 |
### Functions
| Function | Description |
| -------- | -------- |
| OH_LOG_Print&nbsp;(LogType&nbsp;type,&nbsp;LogLevel&nbsp;level,&nbsp;unsigned&nbsp;int&nbsp;domain,&nbsp;const&nbsp;char&nbsp;\*tag,&nbsp;const&nbsp;char&nbsp;\*fmt,...)&nbsp;__attribute__((__format__(os_log | int<br/>写日志接口。 |
| OH_LOG_IsLoggable&nbsp;(unsigned&nbsp;int&nbsp;domain,&nbsp;const&nbsp;char&nbsp;\*tag,&nbsp;LogLevel&nbsp;level) | int&nbsp;bool<br/>检查指定业务领域、TAG、级别的日志是否可以打印。 |
## **Details**
## **Macro Definition**
### LOG_DOMAIN
```
#define LOG_DOMAIN 0
```
**Description:**
日志所对应的业务领域,用于标识业务的子系统、模块。
16进制整数,有效范围0x0~0xFFFF,超过自动截掉高位。
### LOG_TAG
```
#define LOG_TAG NULL
```
**Description:**
字符串常量,标识调用所在的类或者业务。
### OH_LOG_DEBUG
```
#define OH_LOG_DEBUG( type, ... ) ((void)OH_LOG_Print((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, __VA_ARGS__))
```
**Description:**
DEBUG级别写日志,宏封装接口。
使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。
**Parameters:**
| Name | Description |
| -------- | -------- |
| type | 日志类型,三方应用日志类型为[ERROR:Invalid&nbsp;link:zh-cn_topic_0000001232471312.xml#xref1241690359110741,link:zh-cn_topic_0000001232471312.xml#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5](#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5)。 |
| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 |
| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 |
**See also:**
[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1236273882110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946)
### OH_LOG_ERROR
```
#define OH_LOG_ERROR( type, ... ) ((void)OH_LOG_Print((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, __VA_ARGS__))
```
**Description:**
ERROR级别写日志,宏封装接口。
使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。
**Parameters:**
| Name | Description |
| -------- | -------- |
| type | 日志类型,三方应用日志类型为[ERROR:Invalid&nbsp;link:zh-cn_topic_0000001232471312.xml#xref1238901741110741,link:zh-cn_topic_0000001232471312.xml#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5](#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5)。 |
| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 |
| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 |
**See also:**
[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1115878060110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946)
### OH_LOG_FATAL
```
#define OH_LOG_FATAL( type, ... ) ((void)HiLogPrint((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, __VA_ARGS__))
```
**Description:**
FATAL级别写日志,宏封装接口。
使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。
**Parameters:**
| Name | Description |
| -------- | -------- |
| type | 日志类型,三方应用日志类型为LOG_APP。 |
| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 |
| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 |
**See also:**
[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1089905568110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946)
### OH_LOG_INFO
```
#define OH_LOG_INFO( type, ... ) ((void)OH_LOG_Print((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, __VA_ARGS__))
```
**Description:**
INFO级别写日志,宏封装接口。
使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。
**Parameters:**
| Name | Description |
| -------- | -------- |
| type | 日志类型,三方应用日志类型为LOG_APP。 |
| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 |
| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 |
**See also:**
[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref871872876110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946)
### OH_LOG_WARN
```
#define OH_LOG_WARN( type, ... ) ((void)OH_LOG_Print((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, __VA_ARGS__))
```
**Description:**
WARN级别写日志,宏封装接口。
使用时需要先定义日志业务领域、日志TAG,一般在源文件起始处统一定义一次。
**Parameters:**
| Name | Description |
| -------- | -------- |
| type | 日志类型,三方应用日志类型为LOG_APP。 |
| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 |
| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 |
**See also:**
[ERROR:Invalid link:zh-cn_topic_0000001232471312.xml#xref1438124158110741,link:zh-cn_topic_0000001232471312.xml#gaed4b343058326b7f5dbcac6799025946](#gaed4b343058326b7f5dbcac6799025946)
## **Enumeration Type**
### LogLevel
```
enum LogLevel
```
**Description:**
日志级别。
该枚举类型用于定义日志级别。各级别建议使用方式: DEBUG:比INFO级别更详细的流程记录,通过该级别的日志可以更详细地分析业务流程和定位分析问题。DEBUG级别的日志在正式发布版本中默认不会被打印,只有在调试版本或打开调试开关的情况下才会打印。 INFO:用来记录业务关键流程节点,可以还原业务的主要运行过程;用来记录非正常情况信息,但这些情况都是可以预期的(如无网络信号、登录失败等)。这些日志都应该由该业务内处于支配地位的模块来记录,避免在多个被调用的模块或低级函数中重复记录。 WARN:发生了较为严重的非预期情况,但是对用户影响不大,程序可以自动恢复或通过简单的操作就可以恢复的问题。 ERROR:程序或功能发生了错误,该错误会影响功能的正常运行或用户的正常使用,可以恢复但恢复代价较高,如重置数据等。 FATAL:重大致命异常,表明程序或功能即将崩溃,故障无法恢复。
| Enumerator | Description |
| -------- | -------- |
| LOG_DEBUG | DEBUG日志级别,使用OH_LOG_DEBUG接口打印 |
| LOG_INFO | INFO日志级别,使用OH_LOG_INFO接口打印 |
| LOG_WARN | WARN日志级别,使用OH_LOG_WARN接口打印 |
| LOG_ERROR | ERROR日志级别,使用OH_LOG_ERROR接口打印 |
| LOG_FATAL | FATAL日志级别,使用OH_LOG_FATAL接口打印 |
### LogType
```
enum LogType
```
**Description:**
日志类型。
该枚举类型用于定义应用开发者可以使用的日志类型。当前有应用日志LOG_APP。
| Enumerator | Description |
| -------- | -------- |
| LOG_APP | 应用日志 |
## **Function**
### OH_LOG_IsLoggable()
```
int bool OH_LOG_IsLoggable (unsigned int domain, const char * tag, LogLevel level )
```
**Description:**
检查指定业务领域、TAG、级别的日志是否可以打印。
**Parameters:**
| Name | Description |
| -------- | -------- |
| domain | 指定日志业务领域。 |
| tag | 指定日志TAG。 |
| level | 指定日志level。 |
**Returns:**
如果指定domain、tag、level日志可以打印则返回true;否则返回false。
### OH_LOG_Print()
```
int OH_LOG_Print (LogType type, LogLevel level, unsigned int domain, const char * tag, const char * fmt, ... )
```
**Description:**
写日志接口。
指定日志类型、日志级别、业务领域、TAG,按照类printf格式类型和隐私指示确定需要输出的变参。
**Parameters:**
| Name | Description |
| -------- | -------- |
| type | 日志类型,三方应用日志类型为LOG_APP。 |
| level | 日志级别,日志级别包括LOG_DEBUG、LOG_INFO、LOG_WARN、LOG_ERROR、LOG_FATAL。 |
| domain | 日志业务领域,16进制整数,范围0x0~0xFFFF。 |
| tag | 日志TAG,字符串,标识调用所在的类或者业务。 |
| fmt | 格式化字符串,基于类printf格式的增强,支持隐私参数标识,即在格式字符串每个参数中符号后类型前增加{public}、{private}标识。 |
| ... | 与格式字符串里参数类型对应的参数列表,参数数目、参数类型必须与格式字符串中的标识一一对应。 |
**Returns:**
大于等于0表示成功;小于0表示失败。
# Native_Bundle
## **Overview**
**Description:**
Describes the Native Bundle.
**Since:**
9
**Version:**
1.0
## **Summary**
### Files
| File&nbsp;Name | Description |
| -------- | -------- |
| [native_interface_bundle.h](native__interface__bundle_8h.md) | Declares&nbsp;the&nbsp;**Bundle**-specific&nbsp;function,&nbsp;including&nbsp;function&nbsp;for&nbsp;obtaining&nbsp;application&nbsp;ID. |
### Functions
| Function | Description |
| -------- | -------- |
| OH_NativeBundle_GetAppIdByBundleName&nbsp;(const&nbsp;char&nbsp;\*bundleName) | char&nbsp;\*<br/>Obtains&nbsp;the&nbsp;application&nbsp;ID&nbsp;based&nbsp;on&nbsp;the&nbsp;given&nbsp;bundle&nbsp;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&nbsp;the&nbsp;bundle&nbsp;name&nbsp;of&nbsp;the&nbsp;application. |
**Returns:**
Returns the application ID pointer if successfully obtained and needs to be freed; returns nullptr otherwise.
# NativeWindow
## **Overview**
**Description:**
提供NativeWindow功能,主要用来和egl对接
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Since:**
8
**Version:**
1.0
## **Summary**
### Files
| File&nbsp;Name | Description |
| -------- | -------- |
| [external_window.h](external__window_8h.md) | 定义获取和使用NativeWindow的相关函数 |
### Functions
| Function | Description |
| -------- | -------- |
| OH_NativeWindow_CreateNativeWindowFromSurface&nbsp;(void&nbsp;\*pSurface) | struct&nbsp;NativeWindow&nbsp;\*<br/>创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例 |
| OH_NativeWindow_DestroyNativeWindow&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window) | void<br/>将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉 |
| OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer&nbsp;(void&nbsp;\*pSurfaceBuffer) | struct&nbsp;NativeWindowBuffer&nbsp;\*<br/>创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例 |
| OH_NativeWindow_DestroyNativeWindowBuffer&nbsp;(struct&nbsp;NativeWindowBuffer&nbsp;\*buffer) | void<br/>将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉 |
| OH_NativeWindow_NativeWindowRequestBuffer&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;struct&nbsp;NativeWindowBuffer&nbsp;\*\*buffer,&nbsp;int&nbsp;\*fenceFd) | int32_t<br/>通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产 |
| OH_NativeWindow_NativeWindowFlushBuffer&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;struct&nbsp;NativeWindowBuffer&nbsp;\*buffer,&nbsp;int&nbsp;fenceFd,&nbsp;Region&nbsp;region) | int32_t<br/>通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费 |
| OH_NativeWindow_NativeWindowCancelBuffer&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;struct&nbsp;NativeWindowBuffer&nbsp;\*buffer) | int32_t<br/>通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请 |
| OH_NativeWindow_NativeWindowHandleOpt&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;int&nbsp;code,...) | int32_t<br/>设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等 |
| OH_NativeWindow_GetBufferHandleFromNative&nbsp;(struct&nbsp;NativeWindowBuffer&nbsp;\*buffer) | BufferHandle&nbsp;\*<br/>通过NativeWindowBuffer获取该buffer的BufferHandle指针 |
| OH_NativeWindow_NativeObjectReference&nbsp;(void&nbsp;\*obj) | int32_t<br/>增加一个NativeObject的引用计数 |
| OH_NativeWindow_NativeObjectUnreference&nbsp;(void&nbsp;\*obj) | int32_t<br/>减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉 |
| OH_NativeWindow_GetNativeObjectMagic&nbsp;(void&nbsp;\*obj) | int32_t<br/>获取NativeObject的MagicId |
## **Details**
## **Function**
### OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer()
```
struct NativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void * pSurfaceBuffer)
```
**Description:**
创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| pSurfaceBuffer | 参数是一个指向生产者buffer的指针,类型为sptr&lt;OHOS::SurfaceBuffer&gt; |
**Returns:**
返回一个指针,指向NativeWindowBuffer的结构体实例
### OH_NativeWindow_CreateNativeWindowFromSurface()
```
struct NativeWindow* OH_NativeWindow_CreateNativeWindowFromSurface (void * pSurface)
```
**Description:**
创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| pSurface | 参数是一个指向生产者ProduceSurface的指针,类型为sptr&lt;OHOS::Surface&gt; |
**Returns:**
返回一个指针,指向NativeWindow的结构体实例
### OH_NativeWindow_DestroyNativeWindow()
```
void OH_NativeWindow_DestroyNativeWindow (struct NativeWindow * window)
```
**Description:**
将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| window | 参数是一个NativeWindow的结构体实例的指针 |
### OH_NativeWindow_DestroyNativeWindowBuffer()
```
void OH_NativeWindow_DestroyNativeWindowBuffer (struct NativeWindowBuffer * buffer)
```
**Description:**
将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 |
### OH_NativeWindow_GetBufferHandleFromNative()
```
BufferHandle* OH_NativeWindow_GetBufferHandleFromNative (struct NativeWindowBuffer * buffer)
```
**Description:**
通过NativeWindowBuffer获取该buffer的BufferHandle指针
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 |
**Returns:**
BufferHandle 返回一个指针,指向BufferHandle的结构体实例
### OH_NativeWindow_GetNativeObjectMagic()
```
int32_t OH_NativeWindow_GetNativeObjectMagic (void * obj)
```
**Description:**
获取NativeObject的MagicId
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| obj | 参数是一个NativeWindow&nbsp;or&nbsp;NativeWindowBuffer的结构体实例的指针 |
**Returns:**
MagicId 返回值为魔鬼数字,每个NativeObject唯一
### OH_NativeWindow_NativeObjectReference()
```
int32_t OH_NativeWindow_NativeObjectReference (void * obj)
```
**Description:**
增加一个NativeObject的引用计数
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| obj | 参数是一个NativeWindow&nbsp;or&nbsp;NativeWindowBuffer的结构体实例的指针 |
**Returns:**
GSError 返回值为错误码
### OH_NativeWindow_NativeObjectUnreference()
```
int32_t OH_NativeWindow_NativeObjectUnreference (void * obj)
```
**Description:**
减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| obj | 参数是一个NativeWindow&nbsp;or&nbsp;NativeWindowBuffer的结构体实例的指针 |
**Returns:**
GSError
### OH_NativeWindow_NativeWindowCancelBuffer()
```
int32_t OH_NativeWindow_NativeWindowCancelBuffer (struct NativeWindow * window, struct NativeWindowBuffer * buffer )
```
**Description:**
通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| window | 参数是一个NativeWindow的结构体实例的指针 |
| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 |
**Returns:**
GSError 返回值为错误码
### OH_NativeWindow_NativeWindowFlushBuffer()
```
int32_t OH_NativeWindow_NativeWindowFlushBuffer (struct NativeWindow * window, struct NativeWindowBuffer * buffer, int fenceFd, Region region )
```
**Description:**
通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| window | 参数是一个NativeWindow的结构体实例的指针 |
| buffer | 参数是一个NativeWindowBuffer的结构体实例的指针 |
| fenceFd | 参数是一个文件描述符句柄,用以同步时序 |
| region | 参数表示一块脏区域,该区域有内容更新 |
**Returns:**
GSError 返回值为错误码
### OH_NativeWindow_NativeWindowHandleOpt()
```
int32_t OH_NativeWindow_NativeWindowHandleOpt (struct NativeWindow * window, int code, ... )
```
**Description:**
设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| window | 参数是一个NativeWindow的结构体实例的指针 |
| code | 操作码 |
**Returns:**
GSError 返回值为错误码
### OH_NativeWindow_NativeWindowRequestBuffer()
```
int32_t OH_NativeWindow_NativeWindowRequestBuffer (struct NativeWindow * window, struct NativeWindowBuffer ** buffer, int * fenceFd )
```
**Description:**
通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产
\@syscap SystemCapability.Graphic.Graphic2D.NativeWindow
**Parameters:**
| Name | Description |
| -------- | -------- |
| window | 参数是一个NativeWindow的结构体实例的指针 |
| buffer | 参数是一个NativeWindowBuffer的结构体实例的二级指针 |
| fenceFd | 参数是一个文件描述符句柄 |
**Returns:**
GSError 返回值为错误码
# OH_Drawing_BitmapFormat
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
结构体用于描述位图像素的格式,包括颜色类型和透明度类型
**Since:**
8
**Version:**
1.0
## **Summary**
### Public Attributes
| Public&nbsp;Attribute&nbsp;Name | Description |
| -------- | -------- |
| colorFormat | |
| alphaFormat | |
## **Details**
## **Member Data**
### alphaFormat
```
OH_Drawing_AlphaFormat OH_Drawing_BitmapFormat::alphaFormat
```
**Description:**
描述位图像素的透明度分量
### colorFormat
```
OH_Drawing_ColorFormat OH_Drawing_BitmapFormat::colorFormat
```
**Description:**
描述位图像素的存储格式
# Native XComponent
## **Overview**
**Description:**
Describes the surface and touch event held by the ArkUI XComponent, which can be used for the EGL/OpenGLES and media data input and displayed on the ArkUI XComponent.
**Since:**
8
**Version:**
1.0
## **Summary**
### Files
| File&nbsp;Name | Description |
| -------- | -------- |
| [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) | Declares&nbsp;APIs&nbsp;for&nbsp;accessing&nbsp;a&nbsp;Native&nbsp;XComponent. |
### Classes
| Classe&nbsp;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&nbsp;the&nbsp;surface&nbsp;lifecycle&nbsp;and&nbsp;touch&nbsp;event&nbsp;callbacks. |
### Macros
| Macro&nbsp;Name&nbsp;and&nbsp;Value | Description |
| -------- | -------- |
| **OH_NATIVE_XCOMPONENT_OBJ**&nbsp;&nbsp;&nbsp;("__NATIVE_XCOMPONENT_OBJ__") | |
### Typedefs
| Typedef&nbsp;Name | Description |
| -------- | -------- |
| OH_NativeXComponent | typedef&nbsp;struct&nbsp;OH_NativeXComponent<br/>Provides&nbsp;an&nbsp;encapsulated&nbsp;**OH_NativeXComponent**&nbsp;instance. |
| OH_NativeXComponent_Callback | typedef&nbsp;struct&nbsp;OH_NativeXComponent_Callback<br/>Registers&nbsp;the&nbsp;surface&nbsp;lifecycle&nbsp;and&nbsp;touch&nbsp;event&nbsp;callbacks. |
### Enumerations
| Enumeration&nbsp;Name | Description |
| -------- | -------- |
| {&nbsp;OH_NATIVEXCOMPONENT_RESULT_SUCCESS&nbsp;=&nbsp;0,&nbsp;OH_NATIVEXCOMPONENT_RESULT_FAILED&nbsp;=&nbsp;-1,&nbsp;OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER&nbsp;=&nbsp;-2&nbsp;} | Enumerates&nbsp;the&nbsp;API&nbsp;access&nbsp;states. |
| OH_NativeXComponent_TouchEventType&nbsp;{&nbsp;&nbsp;&nbsp;OH_NATIVEXCOMPONENT_DOWN&nbsp;=&nbsp;0,&nbsp;OH_NATIVEXCOMPONENT_UP,&nbsp;OH_NATIVEXCOMPONENT_MOVE,&nbsp;OH_NATIVEXCOMPONENT_CANCEL,&nbsp;&nbsp;&nbsp;OH_NATIVEXCOMPONENT_UNKNOWN&nbsp;} | |
### Functions
| Function | Description |
| -------- | -------- |
| OH_NativeXComponent_GetXComponentId&nbsp;(OH_NativeXComponent&nbsp;\*component,&nbsp;char&nbsp;\*id,&nbsp;uint64_t&nbsp;\*size) | int32_t<br/>Obtains&nbsp;the&nbsp;ID&nbsp;of&nbsp;the&nbsp;ArkUI&nbsp;XComponent. |
| OH_NativeXComponent_GetXComponentSize&nbsp;(OH_NativeXComponent&nbsp;\*component,&nbsp;const&nbsp;void&nbsp;\*window,&nbsp;uint64_t&nbsp;\*width,&nbsp;uint64_t&nbsp;\*height) | int32_t<br/>Obtains&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;surface&nbsp;held&nbsp;by&nbsp;the&nbsp;ArkUI&nbsp;XComponent. |
| OH_NativeXComponent_GetXComponentOffset&nbsp;(OH_NativeXComponent&nbsp;\*component,&nbsp;const&nbsp;void&nbsp;\*window,&nbsp;double&nbsp;\*x,&nbsp;double&nbsp;\*y) | int32_t<br/>Obtains&nbsp;the&nbsp;offset&nbsp;of&nbsp;the&nbsp;surface&nbsp;held&nbsp;by&nbsp;the&nbsp;ArkUI&nbsp;XComponent. |
| OH_NativeXComponent_GetTouchEvent&nbsp;(OH_NativeXComponent&nbsp;\*component,&nbsp;const&nbsp;void&nbsp;\*window,&nbsp;OH_NativeXComponent_TouchEvent&nbsp;\*touchEvent) | int32_t<br/>Obtains&nbsp;the&nbsp;touch&nbsp;event&nbsp;dispatched&nbsp;by&nbsp;the&nbsp;ArkUI&nbsp;XComponent. |
| OH_NativeXComponent_RegisterCallback&nbsp;(OH_NativeXComponent&nbsp;\*component,&nbsp;OH_NativeXComponent_Callback&nbsp;\*callback) | int32_t<br/>Registers&nbsp;a&nbsp;callback&nbsp;for&nbsp;this&nbsp;**OH_NativeXComponent**&nbsp;instance. |
## **Details**
## **Typedef**
### OH_NativeXComponent
```
typedef struct OH_NativeXComponent OH_NativeXComponent
```
**Description:**
Provides an encapsulated **OH_NativeXComponent** instance.
### OH_NativeXComponent_Callback
```
typedef struct OH_NativeXComponent_Callback OH_NativeXComponent_Callback
```
**Description:**
Registers the surface lifecycle and touch event callbacks.
## **Enumeration Type**
### anonymous enum
```
anonymous enum
```
**Description:**
Enumerates the API access states.
| Enumerator | Description |
| -------- | -------- |
| OH_NATIVEXCOMPONENT_RESULT_SUCCESS | Success&nbsp;result. |
| OH_NATIVEXCOMPONENT_RESULT_FAILED | Failed&nbsp;result. |
| OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER | Invalid&nbsp;parameters. |
### OH_NativeXComponent_TouchEventType
```
enum OH_NativeXComponent_TouchEventType
```
| Enumerator | Description |
| -------- | -------- |
| OH_NATIVEXCOMPONENT_DOWN | Trigger&nbsp;a&nbsp;touch&nbsp;event&nbsp;when&nbsp;a&nbsp;finger&nbsp;is&nbsp;pressed. |
| OH_NATIVEXCOMPONENT_UP | Trigger&nbsp;a&nbsp;touch&nbsp;event&nbsp;when&nbsp;a&nbsp;finger&nbsp;is&nbsp;lifted. |
| OH_NATIVEXCOMPONENT_MOVE | Trigger&nbsp;a&nbsp;touch&nbsp;event&nbsp;when&nbsp;a&nbsp;finger&nbsp;moves&nbsp;on&nbsp;the&nbsp;screen&nbsp;in&nbsp;pressed&nbsp;state. |
| OH_NATIVEXCOMPONENT_CANCEL | Trigger&nbsp;an&nbsp;event&nbsp;when&nbsp;a&nbsp;touch&nbsp;event&nbsp;is&nbsp;canceled. |
| OH_NATIVEXCOMPONENT_UNKNOWN | Invalid&nbsp;touch&nbsp;type. |
## **Function**
### OH_NativeXComponent_GetTouchEvent()
```
int32_t OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_TouchEvent * touchEvent )
```
**Description:**
Obtains the touch event dispatched by the ArkUI XComponent.
**Parameters:**
| Name | Description |
| -------- | -------- |
| component | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;this&nbsp;**OH_NativeXComponent**&nbsp;instance. |
| window | Indicates&nbsp;the&nbsp;native&nbsp;window&nbsp;handler. |
| touchEvent | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;the&nbsp;current&nbsp;touch&nbsp;event. |
**Returns:**
Returns the status code of the execution.
### OH_NativeXComponent_GetXComponentId()
```
int32_t OH_NativeXComponent_GetXComponentId (OH_NativeXComponent * component, char * id, uint64_t * size )
```
**Description:**
Obtains the ID of the ArkUI XComponent.
**Parameters:**
| Name | Description |
| -------- | -------- |
| component | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;this&nbsp;**OH_NativeXComponent**&nbsp;instance. |
| id | Indicates&nbsp;the&nbsp;char&nbsp;buffer&nbsp;to&nbsp;keep&nbsp;the&nbsp;ID&nbsp;of&nbsp;this&nbsp;**OH_NativeXComponent**&nbsp;instance.&nbsp;Note&nbsp;that&nbsp;a&nbsp;null-terminator&nbsp;will&nbsp;be&nbsp;appended&nbsp;to&nbsp;the&nbsp;char&nbsp;buffer,&nbsp;so&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;char&nbsp;buffer&nbsp;should&nbsp;be&nbsp;at&nbsp;least&nbsp;as&nbsp;large&nbsp;as&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;real&nbsp;id&nbsp;length&nbsp;plus&nbsp;1.&nbsp;It&nbsp;is&nbsp;recommended&nbsp;that&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;char&nbsp;buffer&nbsp;be&nbsp;[OH_XCOMPONENT_ID_LEN_MAX&nbsp;+&nbsp;1]. |
| size | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;the&nbsp;length&nbsp;of&nbsp;**id**,&nbsp;which&nbsp;you&nbsp;can&nbsp;set&nbsp;and&nbsp;receive. |
**Returns:**
Returns the status code of the execution.
### OH_NativeXComponent_GetXComponentOffset()
```
int32_t OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent * component, const void * window, double * x, double * y )
```
**Description:**
Obtains the offset of the surface held by the ArkUI XComponent.
**Parameters:**
| Name | Description |
| -------- | -------- |
| component | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;this&nbsp;**OH_NativeXComponent**&nbsp;instance. |
| window | Indicates&nbsp;the&nbsp;native&nbsp;window&nbsp;handler. |
| x | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;the&nbsp;x&nbsp;coordinate&nbsp;of&nbsp;the&nbsp;current&nbsp;surface. |
| y | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;the&nbsp;y&nbsp;coordinate&nbsp;of&nbsp;the&nbsp;current&nbsp;surface. |
**Returns:**
Returns the status code of the execution.
### OH_NativeXComponent_GetXComponentSize()
```
int32_t OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent * component, const void * window, uint64_t * width, uint64_t * height )
```
**Description:**
Obtains the size of the surface held by the ArkUI XComponent.
**Parameters:**
| Name | Description |
| -------- | -------- |
| component | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;this&nbsp;**OH_NativeXComponent**&nbsp;instance. |
| window | Indicates&nbsp;the&nbsp;native&nbsp;window&nbsp;handler. |
| width | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;the&nbsp;width&nbsp;of&nbsp;the&nbsp;current&nbsp;surface. |
| height | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;the&nbsp;height&nbsp;of&nbsp;the&nbsp;current&nbsp;surface. |
**Returns:**
Returns the status code of the execution.
### OH_NativeXComponent_RegisterCallback()
```
int32_t OH_NativeXComponent_RegisterCallback (OH_NativeXComponent * component, OH_NativeXComponent_Callback * callback )
```
**Description:**
Registers a callback for this **OH_NativeXComponent** instance.
**Parameters:**
| Name | Description |
| -------- | -------- |
| component | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;this&nbsp;**OH_NativeXComponent**&nbsp;instance. |
| callback | Indicates&nbsp;the&nbsp;pointer&nbsp;to&nbsp;a&nbsp;surface&nbsp;lifecycle&nbsp;and&nbsp;touch&nbsp;event&nbsp;callback. |
**Returns:**
Returns the status code of the execution.
## **Variable**
### deviceId
```
int64_t OH_NativeXComponent_TouchEvent::deviceId = 0
```
**Description:**
ID of the device where the current touch event is generated.
### DispatchTouchEvent
```
void(* OH_NativeXComponent_Callback::DispatchTouchEvent) (OH_NativeXComponent *component, void *window)
```
**Description:**
Called when a touch event is triggered.
### force [1/2]
```
float OH_NativeXComponent_TouchPoint::force = 0.0
```
**Description:**
Pressure of the current touch event.
### force [2/2]
```
float OH_NativeXComponent_TouchEvent::force = 0.0
```
**Description:**
Pressure of the current touch event.
### id [1/2]
```
int32_t OH_NativeXComponent_TouchPoint::id = 0
```
**Description:**
Unique identifier of a finger.
### id [2/2]
```
int32_t OH_NativeXComponent_TouchEvent::id = 0
```
**Description:**
Unique identifier of a finger.
### isPressed
```
bool OH_NativeXComponent_TouchPoint::isPressed = false
```
**Description:**
Whether the current point is pressed.
### numPoints
```
uint32_t OH_NativeXComponent_TouchEvent::numPoints = 0
```
**Description:**
Number of current touch points.
### OnSurfaceChanged
```
void(* OH_NativeXComponent_Callback::OnSurfaceChanged) (OH_NativeXComponent *component, void *window)
```
**Description:**
Called when the surface is changed. This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
### OnSurfaceCreated
```
void(* OH_NativeXComponent_Callback::OnSurfaceCreated) (OH_NativeXComponent *component, void *window)
```
**Description:**
Called when the surface is created.
### OnSurfaceDestroyed
```
void(* OH_NativeXComponent_Callback::OnSurfaceDestroyed) (OH_NativeXComponent *component, void *window)
```
**Description:**
Called when the surface is destroyed.
### screenX [1/2]
```
float OH_NativeXComponent_TouchPoint::screenX = 0.0
```
**Description:**
X coordinate of the touch point relative to the left edge of the screen.
### screenX [2/2]
```
float OH_NativeXComponent_TouchEvent::screenX = 0.0
```
**Description:**
X coordinate of the touch point relative to the left edge of the screen.
### screenY [1/2]
```
float OH_NativeXComponent_TouchPoint::screenY = 0.0
```
**Description:**
Y coordinate of the touch point relative to the upper edge of the screen.
### screenY [2/2]
```
float OH_NativeXComponent_TouchEvent::screenY = 0.0
```
**Description:**
Y coordinate of the touch point relative to the upper edge of the screen.
### size [1/2]
```
double OH_NativeXComponent_TouchPoint::size = 0.0
```
**Description:**
Contact area between the finger pad and the screen.
### size [2/2]
```
double OH_NativeXComponent_TouchEvent::size = 0.0
```
**Description:**
Contact area between the finger pad and the screen.
### timeStamp [1/2]
```
long long OH_NativeXComponent_TouchPoint::timeStamp = 0
```
**Description:**
Timestamp of the current touch event.
### timeStamp [2/2]
```
long long OH_NativeXComponent_TouchEvent::timeStamp = 0
```
**Description:**
Timestamp of the current touch event.
### touchPoints
```
OH_NativeXComponent_TouchPoint OH_NativeXComponent_TouchEvent::touchPoints[OH_MAX_TOUCH_POINTS_NUMBER]
```
**Description:**
Array of the current touch points.
### type [1/2]
```
OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchPoint::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN
```
**Description:**
Touch type of the touch event.
### type [2/2]
```
OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchEvent::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN
```
**Description:**
Touch type of the touch event.
### x [1/2]
```
float OH_NativeXComponent_TouchPoint::x = 0.0
```
**Description:**
X coordinate of the touch point relative to the left edge of the element to touch.
### x [2/2]
```
float OH_NativeXComponent_TouchEvent::x = 0.0
```
**Description:**
X coordinate of the touch point relative to the left edge of the element to touch.
### y [1/2]
```
float OH_NativeXComponent_TouchPoint::y = 0.0
```
**Description:**
Y coordinate of the touch point relative to the upper edge of the element to touch.
### y [2/2]
```
float OH_NativeXComponent_TouchEvent::y = 0.0
```
**Description:**
Y coordinate of the touch point relative to the upper edge of the element to touch.
# OH_NativeXComponent_Callback
## **Overview**
**Related Modules:**
[Native XComponent](_o_h___native_x_component.md)
**Description:**
Registers the surface lifecycle and touch event callbacks.
**Since:**
8
**Version:**
1.0
## **Summary**
### Public Attributes
| Public&nbsp;Attribute&nbsp;Name | Description |
| -------- | -------- |
| [OnSurfaceCreated](_o_h___native_x_component.md#ga8beefd4b2359680a3106b28227e47d00)&nbsp;)([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)&nbsp;\*component,&nbsp;void&nbsp;\*window) | |
| [OnSurfaceChanged](_o_h___native_x_component.md#ga7d84244e13477d91cfdade8d9ff8565b)&nbsp;)([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)&nbsp;\*component,&nbsp;void&nbsp;\*window) | |
| [OnSurfaceDestroyed](_o_h___native_x_component.md#gad32bd08c749422d807ac87c558af6a44)&nbsp;)([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)&nbsp;\*component,&nbsp;void&nbsp;\*window) | |
| [DispatchTouchEvent](_o_h___native_x_component.md#ga3d40ca63aba381a63435f71f679e1f26)&nbsp;)([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)&nbsp;\*component,&nbsp;void&nbsp;\*window) | |
# OH_NativeXComponent_TouchEvent
## **Overview**
**Related Modules:**
[Native XComponent](_o_h___native_x_component.md)
## **Summary**
### Public Attributes
| Public&nbsp;Attribute&nbsp;Name | Description |
| -------- | -------- |
| [id](_o_h___native_x_component.md#gac986c10f386a0b55bd813caec06fe190)&nbsp;=&nbsp;0 | |
| [screenX](_o_h___native_x_component.md#ga68fe9ff656e74ae14254523443d85bb1)&nbsp;=&nbsp;0.0 | |
| [screenY](_o_h___native_x_component.md#ga7696e0e1a81787400e187058a1e332f2)&nbsp;=&nbsp;0.0 | |
| [x](_o_h___native_x_component.md#ga9688a76d25bede284e36b7226ec8ad3a)&nbsp;=&nbsp;0.0 | |
| [y](_o_h___native_x_component.md#ga0136d85dae638fbe9baaa69cf67a9833)&nbsp;=&nbsp;0.0 | |
| [type](_o_h___native_x_component.md#ga22f67143e6acdefa5c7fd4ba23f7c2b6)&nbsp;=&nbsp;[OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182aff39d23c1412b3b110a19df4893651d3) | |
| [size](_o_h___native_x_component.md#ga723601b60610b546fbdaf29e87575ca2)&nbsp;=&nbsp;0.0 | |
| [force](_o_h___native_x_component.md#ga7c0a450a47231bd55994a970b3750d3f)&nbsp;=&nbsp;0.0 | |
| [deviceId](_o_h___native_x_component.md#ga00660bb31b05cebe8964ba221c24f966)&nbsp;=&nbsp;0 | |
| [timeStamp](_o_h___native_x_component.md#gadd872bda25d5af9327d12d06a70149fd)&nbsp;=&nbsp;0 | |
| [touchPoints](_o_h___native_x_component.md#gab3514bf8d2fa3de8191d4898ee739053)&nbsp;[OH_MAX_TOUCH_POINTS_NUMBER] | |
| [numPoints](_o_h___native_x_component.md#gad8c19c6c2bbb367fa18fffa813e21cc6)&nbsp;=&nbsp;0 | |
# OH_NativeXComponent_TouchPoint
## **Overview**
**Related Modules:**
[Native XComponent](_o_h___native_x_component.md)
## **Summary**
### Public Attributes
| Public&nbsp;Attribute&nbsp;Name | Description |
| -------- | -------- |
| [id](_o_h___native_x_component.md#gafc435f3e8b5acf462b28bae69180d971)&nbsp;=&nbsp;0 | |
| [screenX](_o_h___native_x_component.md#gae96f097ddffb119b824bcd9f59857ea4)&nbsp;=&nbsp;0.0 | |
| [screenY](_o_h___native_x_component.md#ga8fb126875104358f84e17ddd66dbbf60)&nbsp;=&nbsp;0.0 | |
| [x](_o_h___native_x_component.md#ga04e0e65a35a652d86460c82bf0ca02e3)&nbsp;=&nbsp;0.0 | |
| [y](_o_h___native_x_component.md#ga13d254769a362f049243505e84df8fa4)&nbsp;=&nbsp;0.0 | |
| [type](_o_h___native_x_component.md#gac2b852641112bce8de71f080a21a118a)&nbsp;=&nbsp;[OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182aff39d23c1412b3b110a19df4893651d3) | |
| [size](_o_h___native_x_component.md#ga9e5a0e118ab61a889126a985be7947dd)&nbsp;=&nbsp;0.0 | |
| [force](_o_h___native_x_component.md#gaf3d4f92022552678d5d81d2396900595)&nbsp;=&nbsp;0.0 | |
| [timeStamp](_o_h___native_x_component.md#gad090e826a0e33a4054f468109a5a729d)&nbsp;=&nbsp;0 | |
| [isPressed](_o_h___native_x_component.md#ga527c92deb88977ae842ffe6fee50d571)&nbsp;=&nbsp;false | |
# RawFileDescriptor
## **Overview**
**Related Modules:**
[Rawfile](rawfile.md)
**Description:**
提供rawfile文件描述符信息
RawFileDescriptor是[OH_ResourceManager_GetRawFileDescriptor](rawfile.md#ga8313a7d4bb361a98ced485346a9be4b1)的输出参数, 涵盖了rawfile文件的文件描述符以及在HAP包中的起始位置和长度。
**Since:**
8
**Version:**
1.0
## **Summary**
### Public Attributes
| Public&nbsp;Attribute&nbsp;Name | Description |
| -------- | -------- |
| fd | |
| start | |
| length | |
## **Details**
## **Member Data**
### fd
```
int RawFileDescriptor::fd
```
**Description:**
rawfile文件描述符
### length
```
long RawFileDescriptor::length
```
**Description:**
rawfile在HAP包中的长度
### start
```
long RawFileDescriptor::start
```
**Description:**
rawfile在HAP包中的起始位置
# 结构体
- **[OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)**
- **[OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)**
- **[OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md)**
- **[OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md)**
- **[RawFileDescriptor](_raw_file_descriptor.md)**
\ No newline at end of file
# drawing_bitmap.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
文件中定义了与位图相关的功能函数
**Since:**
8
**Version:**
1.0
## **Summary**
### Classes
| Classe&nbsp;Name | Description |
| -------- | -------- |
| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 |
### Functions
| Function | Description |
| -------- | -------- |
| [OH_Drawing_BitmapCreate](_drawing.md#gac2d33ba4b18e71eca8c41c136004ba48)&nbsp;(void) | [OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb)&nbsp;\*<br/>函数用于创建一个位图对象。 |
| [OH_Drawing_BitmapDestroy](_drawing.md#ga5c31becccf1d3ad5df5f6bc7d9007b8f)&nbsp;([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb)&nbsp;\*) | void<br/>函数用于销毁位图对象并回收该对象占有内存。 |
| [OH_Drawing_BitmapBuild](_drawing.md#ga699afe9c4d2665cdd21b5d9b6dfed2ec)&nbsp;([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb)&nbsp;\*,&nbsp;const&nbsp;uint32_t&nbsp;width,&nbsp;const&nbsp;uint32_t&nbsp;height,&nbsp;const&nbsp;[OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)&nbsp;\*) | void<br/>函数用于初始化位图对象的宽度和高度,并且为该位图设置像素格式 |
| [OH_Drawing_BitmapGetWidth](_drawing.md#ga67b83650847ab1f6e79ca122905d55a3)&nbsp;([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb)&nbsp;\*) | uint32_t<br/>该函数用于获取指定位图的宽度 |
| [OH_Drawing_BitmapGetHeight](_drawing.md#gace471d69bec5b152bd4de5fa8504f7fd)&nbsp;([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb)&nbsp;\*) | uint32_t<br/>函数用于获取指定位图的高度 |
| [OH_Drawing_BitmapGetPixels](_drawing.md#gaf007f52cfbcbc63cd02971c6480c55fb)&nbsp;([OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb)&nbsp;\*) | void&nbsp;\*<br/>函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据 |
# drawing_brush.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
文件中定义了与画刷相关的功能函数
**Since:**
8
**Version:**
1.0
## **Summary**
### Functions
| Function | Description |
| -------- | -------- |
| [OH_Drawing_BrushCreate](_drawing.md#ga75e2193d23cf75878c7b2c78d6b23b35)&nbsp;(void) | [OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711)&nbsp;\*<br/>函数用于创建一个画刷对象 |
| [OH_Drawing_BrushDestroy](_drawing.md#ga9dc1d4aa465d06f2d847feddae1558b5)&nbsp;([OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711)&nbsp;\*) | void<br/>函数用于销毁画刷对象并回收该对象占有的内存。 |
| [OH_Drawing_BrushIsAntiAlias](_drawing.md#ga4c861e23b8c0a3fb84d906d81bea5335)&nbsp;(const&nbsp;[OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711)&nbsp;\*) | bool<br/>函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 |
| [OH_Drawing_BrushSetAntiAlias](_drawing.md#ga41735fc7a2776fbe41c77b3f4637e1c5)&nbsp;([OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711)&nbsp;\*,&nbsp;bool) | void<br/>函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理 |
| [OH_Drawing_BrushGetColor](_drawing.md#ga29dc1e2442cea7e958a5e037c4cc9f59)&nbsp;(const&nbsp;[OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711)&nbsp;\*) | uint32_t<br/>函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 |
| [OH_Drawing_BrushSetColor](_drawing.md#ga4b62aa574623c1a75e14f612a831531b)&nbsp;([OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711)&nbsp;\*,&nbsp;uint32_t&nbsp;color) | void<br/>函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 |
# drawing_canvas.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
文件中定义了与画布相关的功能函数
**Since:**
8
**Version:**
1.0
## **Summary**
### Functions
| Function | Description |
| -------- | -------- |
| [OH_Drawing_CanvasCreate](_drawing.md#ga1bfe881a0b018a982678906f3522d4df)&nbsp;(void) | [OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*<br/>函数用于创建一个画布对象 |
| [OH_Drawing_CanvasDestroy](_drawing.md#ga1a3023ccc48a381cc0b4ae09e2d85c38)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*) | void<br/>函数用于销毁画布对象并回收该对象占有的内存 |
| [OH_Drawing_CanvasBind](_drawing.md#ga666595bb182a5e31733f4144c1515cae)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*,&nbsp;[OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb)&nbsp;\*) | void<br/>函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染) |
| [OH_Drawing_CanvasAttachPen](_drawing.md#gaaec6db563bd7153dc95d0bfab71a4ed1)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*,&nbsp;const&nbsp;[OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*) | void<br/>函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓 |
| [OH_Drawing_CanvasDetachPen](_drawing.md#ga79321b669f2b5dc0460ca929f00dfc47)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*) | void<br/>函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓 |
| [OH_Drawing_CanvasAttachBrush](_drawing.md#ga1b238c829ea5f2ff627766a3e50feaa6)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*,&nbsp;const&nbsp;[OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711)&nbsp;\*) | void<br/>函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状 |
| [OH_Drawing_CanvasDetachBrush](_drawing.md#ga7a6b5e56d2492b5641b8b3f634b096fe)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*) | void<br/>函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状 |
| [OH_Drawing_CanvasSave](_drawing.md#ga4ebc55405e00ad4b8609303fefc6997a)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*) | void<br/>函数用于保存当前画布的状态(画布矩阵)到一个栈顶 |
| [OH_Drawing_CanvasRestore](_drawing.md#gadd632be64ccc2601def753ecc1e53944)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*) | void<br/>函数用于恢复保存在栈顶的画布状态(画布矩阵) |
| [OH_Drawing_CanvasDrawLine](_drawing.md#gadf6bae5efd20587612596f8e78a16144)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*,&nbsp;float&nbsp;x1,&nbsp;float&nbsp;y1,&nbsp;float&nbsp;x2,&nbsp;float&nbsp;y2) | void<br/>函数用于画一条直线段 |
| [OH_Drawing_CanvasDrawPath](_drawing.md#ga99ebc73abdc27599f4bcc1c1045cb75e)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*,&nbsp;const&nbsp;[OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*) | void<br/>函数用于画一个自定义路径 |
| [OH_Drawing_CanvasClear](_drawing.md#ga7f07cc6f0b223d9b343c133fbb2503f6)&nbsp;([OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*,&nbsp;uint32_t&nbsp;color) | void<br/>函数用于使用指定颜色去清空画布 |
# drawing_color.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
文件中定义了与颜色相关的功能函数
**Since:**
8
**Version:**
1.0
## **Summary**
### Functions
| Function | Description |
| -------- | -------- |
| [OH_Drawing_ColorSetArgb](_drawing.md#ga9137935b970e49ffd813157ebd8bbfb7)&nbsp;(uint32_t&nbsp;alpha,&nbsp;uint32_t&nbsp;red,&nbsp;uint32_t&nbsp;green,&nbsp;uint32_t&nbsp;blue) | uint32_t<br/>函数用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量 |
# drawing_font_collection.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
定义绘制模块中与fontCollection相关的函数
**Since:**
8
**Version:**
1.0
## **Summary**
### Functions
| Function | Description |
| -------- | -------- |
| [OH_Drawing_CreateFontCollection](_drawing.md#gab54c68359a650cde36b82f021f06c814)&nbsp;(void) | [OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7)&nbsp;\*<br/>创建OH_Drawing_FontCollection |
| [OH_Drawing_DestroyFontCollection](_drawing.md#ga4791ce4ddfaa3545a797c2ce144c819d)&nbsp;([OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7)&nbsp;\*) | void<br/>释放被OH_Drawing_FontCollection对象占据的内存 |
# drawing_path.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
文件中定义了与自定义路径相关的功能函数
**Since:**
8
**Version:**
1.0
## **Summary**
### Functions
| Function | Description |
| -------- | -------- |
| [OH_Drawing_PathCreate](_drawing.md#ga379fcebc6b43c3b90e0933d928d7c890)&nbsp;(void) | [OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*<br/>函数用于创建一个路径对象 |
| [OH_Drawing_PathDestroy](_drawing.md#gaa5961e76fd8d2aacdd1fe94ad354ba51)&nbsp;([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*) | void<br/>函数用于销毁路径对象并回收该对象占有的内存 |
| [OH_Drawing_PathMoveTo](_drawing.md#ga3934f53ce94644feaa79fb96bc7fbcc9)&nbsp;([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*,&nbsp;float&nbsp;x,&nbsp;float&nbsp;y) | void<br/>函数用于设置自定义路径的起始点位置 |
| [OH_Drawing_PathLineTo](_drawing.md#ga4da6ed28d5db091be54af8efe661eb18)&nbsp;([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*,&nbsp;float&nbsp;x,&nbsp;float&nbsp;y) | void<br/>函数用于添加一条从路径的最后点位置到目标点位置的线段 |
| [OH_Drawing_PathArcTo](_drawing.md#ga33c44796dfe8050dad3e6306f66ba0d3)&nbsp;([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*,&nbsp;float&nbsp;x1,&nbsp;float&nbsp;y1,&nbsp;float&nbsp;x2,&nbsp;float&nbsp;y2,&nbsp;float&nbsp;startDeg,&nbsp;float&nbsp;sweepDeg) | void<br/>函数用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆,&nbsp;然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段 |
| [OH_Drawing_PathQuadTo](_drawing.md#ga5f69a50c045822c5d5d4896bc120318b)&nbsp;([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*,&nbsp;float&nbsp;ctrlX,&nbsp;float&nbsp;ctrlY,&nbsp;float&nbsp;endX,&nbsp;float&nbsp;endY) | void<br/>函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线 |
| [OH_Drawing_PathCubicTo](_drawing.md#ga6a84a20af7911dc504696402c357f1be)&nbsp;([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*,&nbsp;float&nbsp;ctrlX1,&nbsp;float&nbsp;ctrlY1,&nbsp;float&nbsp;ctrlX2,&nbsp;float&nbsp;ctrlY2,&nbsp;float&nbsp;endX,&nbsp;float&nbsp;endY) | void<br/>函数用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线 |
| [OH_Drawing_PathClose](_drawing.md#ga7a3be11857364cdf2e6ca1af70917816)&nbsp;([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*) | void<br/>函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段 |
| [OH_Drawing_PathReset](_drawing.md#gaf907c525b05dbd1355d16dc13b4ccda9)&nbsp;([OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)&nbsp;\*) | void<br/>函数用于重置自定义路径数据 |
# drawing_pen.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
文件中定义了与画笔相关的功能函数
**Since:**
8
**Version:**
1.0
## **Summary**
### Enumerations
| Enumeration&nbsp;Name | Description |
| -------- | -------- |
| [OH_Drawing_PenLineCapStyle](_drawing.md#gafa9d815d933e0fd6aa7549d12080fa8f)&nbsp;{&nbsp;[LINE_FLAT_CAP](_drawing.md#ggafa9d815d933e0fd6aa7549d12080fa8fa99c48cc6172088f1a86e8688e347933a),&nbsp;[LINE_SQUARE_CAP](_drawing.md#ggafa9d815d933e0fd6aa7549d12080fa8fac9929c30114c046b75b844e459f1e69f),&nbsp;[LINE_ROUND_CAP](_drawing.md#ggafa9d815d933e0fd6aa7549d12080fa8fa0efe3fb7b56d7407737c42aebe5b91e5)&nbsp;} | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式 |
| [OH_Drawing_PenLineJoinStyle](_drawing.md#gad10001f23f6c42f97a392cba30011460)&nbsp;{&nbsp;[LINE_MITER_JOIN](_drawing.md#ggad10001f23f6c42f97a392cba30011460a126e5fbae0f63b8431d3a6763035d488),&nbsp;[LINE_ROUND_JOIN](_drawing.md#ggad10001f23f6c42f97a392cba30011460aa2bfcc7c744ab7a56c047942060ad3ba),&nbsp;[LINE_BEVEL_JOIN](_drawing.md#ggad10001f23f6c42f97a392cba30011460a8ad7df33f8ff73c5c080fcf159631fde)&nbsp;} | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式 |
### Functions
| Function | Description |
| -------- | -------- |
| [OH_Drawing_PenCreate](_drawing.md#gae52fe4132b90726d813661750948e2dd)&nbsp;(void) | [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*<br/>函数用于创建一个画笔对象 |
| [OH_Drawing_PenDestroy](_drawing.md#ga907538d02a50836e8033a3f7bf12c80e)&nbsp;([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*) | void<br/>函数用于销毁画笔对象并回收该对象占有的内存 |
| [OH_Drawing_PenIsAntiAlias](_drawing.md#ga31dee499a3d1dd81e526bcc1dd620961)&nbsp;(const&nbsp;[OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*) | bool<br/>函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 |
| [OH_Drawing_PenSetAntiAlias](_drawing.md#ga93dbc44cf424038a17ae311920550283)&nbsp;([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*,&nbsp;bool) | void<br/>函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理 |
| [OH_Drawing_PenGetColor](_drawing.md#ga8a8db886ecf41a729e40a1f760338220)&nbsp;(const&nbsp;[OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*) | uint32_t<br/>函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 |
| [OH_Drawing_PenSetColor](_drawing.md#ga6e5b065f521dd9c41d5e7f2af5c379cb)&nbsp;([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*,&nbsp;uint32_t&nbsp;color) | void<br/>函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 |
| [OH_Drawing_PenGetWidth](_drawing.md#ga3d898184f61b685d724e6d272fb12168)&nbsp;(const&nbsp;[OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*) | float<br/>函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 |
| [OH_Drawing_PenSetWidth](_drawing.md#ga562b5102bf599e640a94e104480df0f4)&nbsp;([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*,&nbsp;float&nbsp;width) | void<br/>函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 |
| [OH_Drawing_PenGetMiterLimit](_drawing.md#ga8f8a512b3930d8883dff59916eaaa72a)&nbsp;(const&nbsp;[OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*) | float<br/>函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 |
| [OH_Drawing_PenSetMiterLimit](_drawing.md#ga73a96e3e9ca95a82f0de2076cb03ffba)&nbsp;([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*,&nbsp;float&nbsp;miter) | void<br/>函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 |
| [OH_Drawing_PenGetCap](_drawing.md#ga7db0d5ac28ac24db29fc49c113affc32)&nbsp;(const&nbsp;[OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*) | [OH_Drawing_PenLineCapStyle](_drawing.md#gafa9d815d933e0fd6aa7549d12080fa8f)<br/>函数用于获取画笔笔帽的样式 |
| [OH_Drawing_PenSetCap](_drawing.md#gaa0d8f5e75ec5fbc776c4e5e780e29af3)&nbsp;([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*,&nbsp;[OH_Drawing_PenLineCapStyle](_drawing.md#gafa9d815d933e0fd6aa7549d12080fa8f)) | void<br/>函数用于设置画笔笔帽样式 |
| [OH_Drawing_PenGetJoin](_drawing.md#ga35b26a60ebf70c207f1e8fb8659a9103)&nbsp;(const&nbsp;[OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*) | [OH_Drawing_PenLineJoinStyle](_drawing.md#gad10001f23f6c42f97a392cba30011460)<br/>函数用于获取画笔绘制折线转角的样式 |
| [OH_Drawing_PenSetJoin](_drawing.md#ga65e9826c39a847b22825e99af65afbb7)&nbsp;([OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)&nbsp;\*,&nbsp;[OH_Drawing_PenLineJoinStyle](_drawing.md#gad10001f23f6c42f97a392cba30011460)) | void<br/>函数用于设置画笔绘制转角的样式 |
# drawing_text_declaration.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
提供2d drawing文本相关的数据结构声明
**Since:**
8
**Version:**
1.0
## **Summary**
### Typedefs
| Typedef&nbsp;Name | Description |
| -------- | -------- |
| [OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7) | typedef&nbsp;struct&nbsp;[OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7)<br/>OH_Drawing_FontCollection用于加载字体 |
| [OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007) | typedef&nbsp;struct&nbsp;[OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007)<br/>OH_Drawing_Typography用于管理排版的布局和显示等 |
| [OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528) | typedef&nbsp;struct&nbsp;[OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)<br/>OH_Drawing_TextStyle用于管理字体颜色、装饰等 |
| [OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9) | typedef&nbsp;struct&nbsp;[OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9)<br/>OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等 |
| [OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9) | typedef&nbsp;struct&nbsp;[OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9)<br/>OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography. |
# drawing_text_typography.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
定义绘制模块中排版相关的函数
**Since:**
8
**Version:**
1.0
## **Summary**
### Enumerations
| Enumeration&nbsp;Name | Description |
| -------- | -------- |
| [OH_Drawing_TextDirection](_drawing.md#ga7dc9803407c3fea32075122c7605ffb2)&nbsp;{&nbsp;[TEXT_DIRECTION_RTL](_drawing.md#gga7dc9803407c3fea32075122c7605ffb2a7b4debd0a116bc438085a43efa3824cf),&nbsp;[TEXT_DIRECTION_LTR](_drawing.md#gga7dc9803407c3fea32075122c7605ffb2a81d702a35ec4d3482ea5ff10edd8cab7)&nbsp;} | 文字方向 |
| [OH_Drawing_TextAlign](_drawing.md#ga3fee1a3916c2376e62e7957be15a1b02)&nbsp;{&nbsp;&nbsp;&nbsp;[TEXT_ALIGN_LEFT](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a3b85bc4d8cfda6b273b534eb2e1cebfc),&nbsp;[TEXT_ALIGN_RIGHT](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02abc81ce8623a972fc7b97f497189c494b),&nbsp;[TEXT_ALIGN_CENTER](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a4da3c85cde615e7442df8ef17d0753ba),&nbsp;[TEXT_ALIGN_JUSTIFY](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a3e3185762a0ae703ae1eab769eb3191d),&nbsp;&nbsp;&nbsp;[TEXT_ALIGN_START](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a72f2441e221a61374bd891dc2b75bcb0),&nbsp;[TEXT_ALIGN_END](_drawing.md#gga3fee1a3916c2376e62e7957be15a1b02a17b99fff762deffd75c0de66cd27d219)&nbsp;} | 文字对齐方式 |
| [OH_Drawing_FontWeight](_drawing.md#ga7a1d4dd0ce9dd97bf3bbbad3b87f7f21)&nbsp;{&nbsp;&nbsp;&nbsp;[FONT_WEIGHT_100](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a23b26a36963095342fe2e0697910a6e6),&nbsp;[FONT_WEIGHT_200](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a4f29ce93f64a0085ca2154ee25d9e138),&nbsp;[FONT_WEIGHT_300](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a093d1106fec67eebea0dbcb2ebbe9a64),&nbsp;[FONT_WEIGHT_400](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a62367da70683540c34ddaf2a519f22a3),&nbsp;&nbsp;&nbsp;[FONT_WEIGHT_500](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21aef238378a2c00c698e269b052d31d904),&nbsp;[FONT_WEIGHT_600](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21a63eebceda71bb1ffdae4a5503d63bbd9),&nbsp;[FONT_WEIGHT_700](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21ae6abaa1dc57d487006cbe6c8e0f87bc6),&nbsp;[FONT_WEIGHT_800](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21ad34b21ce514a03d6d98b75341bb5726e),&nbsp;&nbsp;&nbsp;[FONT_WEIGHT_900](_drawing.md#gga7a1d4dd0ce9dd97bf3bbbad3b87f7f21ac3f4c8f2d6a6922780166cc08df83461)&nbsp;} | 字重 |
| [OH_Drawing_TextBaseline](_drawing.md#ga23be0106a439e7498cbbb1d048733ec5)&nbsp;{&nbsp;[TEXT_BASELINE_ALPHABETIC](_drawing.md#gga23be0106a439e7498cbbb1d048733ec5ad436b9da96a5246e75e785a0585963f9),&nbsp;[TEXT_BASELINE_IDEOGRAPHIC](_drawing.md#gga23be0106a439e7498cbbb1d048733ec5a723ba0ba56cd7106deb97c95f51febcf)&nbsp;} | 基线位置 |
| [OH_Drawing_TextDecoration](_drawing.md#ga11b405dddb93d91c3a5b4482d8a9165b)&nbsp;{&nbsp;[TEXT_DECORATION_NONE](_drawing.md#gga11b405dddb93d91c3a5b4482d8a9165ba2b42614c2c9b73ffecf31769cfd60f28)&nbsp;=&nbsp;0x0,&nbsp;[TEXT_DECORATION_UNDERLINE](_drawing.md#gga11b405dddb93d91c3a5b4482d8a9165ba0fc17108b6c8a91d840889336c669dda)&nbsp;=&nbsp;0x1,&nbsp;[TEXT_DECORATION_OVERLINE](_drawing.md#gga11b405dddb93d91c3a5b4482d8a9165bad8415c121f9b656cd5c6cab927d78802)&nbsp;=&nbsp;0x2,&nbsp;[TEXT_DECORATION_LINE_THROUGH](_drawing.md#gga11b405dddb93d91c3a5b4482d8a9165ba25692d42e0a907af878d99a0a31f7f47)&nbsp;=&nbsp;0x4&nbsp;} | 文本装饰 |
| [OH_Drawing_FontStyle](_drawing.md#ga9cd0177d2561ccef51adbae0f8a42eec)&nbsp;{&nbsp;[FONT_STYLE_NORMAL](_drawing.md#gga9cd0177d2561ccef51adbae0f8a42eeca307e676fb5de5c785e856272b2f0e8ce),&nbsp;[FONT_STYLE_ITALIC](_drawing.md#gga9cd0177d2561ccef51adbae0f8a42eeca6054e24016c46486668dd42e4b86c036)&nbsp;} | 区分字体是否为斜体 |
### Functions
| Function | Description |
| -------- | -------- |
| [OH_Drawing_CreateTypographyStyle](_drawing.md#ga19561093a2d5ec17f2c73b40f0d97376)&nbsp;(void) | [OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9)&nbsp;\*<br/>创建OH_Drawing_TypographyStyle |
| [OH_Drawing_DestroyTypographyStyle](_drawing.md#ga9bd838c0d86136e16faca0ada643d87e)&nbsp;([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9)&nbsp;\*) | void<br/>释放被OH_Drawing_TypographyStyle对象占据的内存 |
| [OH_Drawing_SetTypographyTextDirection](_drawing.md#ga9e96b89ffc3f06f50ab38f05689e766e)&nbsp;([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9)&nbsp;\*,&nbsp;int) | void<br/>设置文本方向 |
| [OH_Drawing_SetTypographyTextAlign](_drawing.md#gaa1a8b20a882ae6aa4e2ad442a18423da)&nbsp;([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9)&nbsp;\*,&nbsp;int) | void<br/>设置文本对齐方式 |
| [OH_Drawing_SetTypographyTextMaxLines](_drawing.md#gab74fd8ef23005bf584f87357147fa379)&nbsp;([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9)&nbsp;\*,&nbsp;int) | void<br/>设置文本最大行数 |
| [OH_Drawing_CreateTextStyle](_drawing.md#ga9041c35231647ed34306ef26f21037f9)&nbsp;(void) | [OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*<br/>创建OH_Drawing_TextStyle |
| [OH_Drawing_DestroyTextStyle](_drawing.md#ga2550946ac8d3c8c9ddc548e128175020)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*) | void<br/>释放被OH_Drawing_TextStyle对象占据的内存 |
| [OH_Drawing_SetTextStyleColor](_drawing.md#ga4c03826dd970defade08b67ed1861fc8)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;uint32_t) | void<br/>设置文本颜色 |
| [OH_Drawing_SetTextStyleFontSize](_drawing.md#ga4f435be1d8b20bd0abac441ac91bb81d)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;double) | void<br/>设置字号 |
| [OH_Drawing_SetTextStyleFontWeight](_drawing.md#ga751dd287f984367c18de6ca3a3a304ec)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;int) | void<br/>设置字重 |
| [OH_Drawing_SetTextStyleBaseLine](_drawing.md#gacb93fa7c791e719cf9c5d218981f61ee)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;int) | void<br/>设置字体基线位置 |
| [OH_Drawing_SetTextStyleDecoration](_drawing.md#ga2f029e23749fcd121aaae6e233202ded)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;int) | void<br/>设置装饰 |
| [OH_Drawing_SetTextStyleDecorationColor](_drawing.md#ga22304942171ce4548b50057bd7d606be)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;uint32_t) | void<br/>设置装饰颜色 |
| [OH_Drawing_SetTextStyleFontHeight](_drawing.md#gab96b5567c05f34e6ba7d48a4dd75eab4)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;double) | void<br/>设置字体高度 |
| [OH_Drawing_SetTextStyleFontFamilies](_drawing.md#ga3f46d90176575f24040828264ce18a90)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;int,&nbsp;const&nbsp;char&nbsp;\*fontFamilies[]) | void<br/>设置字体类型 |
| [OH_Drawing_SetTextStyleFontStyle](_drawing.md#ga67afa0910007fa3d8b15f2b6df61712c)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;int) | void<br/>设置字体风格 |
| [OH_Drawing_SetTextStyleLocale](_drawing.md#ga7eb6f2da34059c013cfb0567c44813d4)&nbsp;([OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*,&nbsp;const&nbsp;char&nbsp;\*) | void<br/>设置语言区域 |
| [OH_Drawing_CreateTypographyHandler](_drawing.md#gae72088abf73419c0c8e8e524602a317e)&nbsp;([OH_Drawing_TypographyStyle](_drawing.md#ga270cc54313a929ea90235840668daef9)&nbsp;\*,&nbsp;[OH_Drawing_FontCollection](_drawing.md#ga4ce31d04a1580d4f50e87b8695fcebc7)&nbsp;\*) | [OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9)&nbsp;\*<br/>创建指向OH_Drawing_TypographyCreate对象的指针 |
| [OH_Drawing_DestroyTypographyHandler](_drawing.md#ga211dced7f1eaed0c5bd507cd75d003c8)&nbsp;([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9)&nbsp;\*) | void<br/>释放被OH_Drawing_TypographyCreate对象占据的内存 |
| [OH_Drawing_TypographyHandlerPushStyle](_drawing.md#ga5aff793cec1b58c171817649b01f35d1)&nbsp;([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9)&nbsp;\*,&nbsp;[OH_Drawing_TextStyle](_drawing.md#gad731266accf168a6b50e1fa33ce90528)&nbsp;\*) | void<br/>设置排版风格 |
| [OH_Drawing_TypographyHandlerAddText](_drawing.md#ga0bb4f9730faa77f6ed8cdce25e7965f2)&nbsp;([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9)&nbsp;\*,&nbsp;const&nbsp;char&nbsp;\*) | void<br/>设置文本内容 |
| [OH_Drawing_TypographyHandlerPop](_drawing.md#gabe9b81431e1a7ca473fc0659c150bb6b)&nbsp;([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9)&nbsp;\*) | void<br/>排版弹出 |
| [OH_Drawing_CreateTypography](_drawing.md#gaf996ac9db09b8d7c21b8ea4797ea0c19)&nbsp;([OH_Drawing_TypographyCreate](_drawing.md#gaedefc2b3d226b0b07abcbce76be4cdb9)&nbsp;\*) | [OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007)&nbsp;\*<br/>创建OH_Drawing_Typography |
| [OH_Drawing_DestroyTypography](_drawing.md#ga2d0d1b715931c104042c75e4d21a86a3)&nbsp;([OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007)&nbsp;\*) | void<br/>释放OH_Drawing_Typography对象占据的内存 |
| [OH_Drawing_TypographyLayout](_drawing.md#ga9032552c1d8d8e258f86832190223843)&nbsp;([OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007)&nbsp;\*,&nbsp;double) | void<br/>排版布局 |
| [OH_Drawing_TypographyPaint](_drawing.md#ga8b12b7dc251b3a2bb71f7e289a27e174)&nbsp;([OH_Drawing_Typography](_drawing.md#ga70d06422fc84eb1ba49e35f525573007)&nbsp;\*,&nbsp;[OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)&nbsp;\*,&nbsp;double,&nbsp;double) | void<br/>显示文本 |
# drawing_types.h
## **Overview**
**Related Modules:**
[Drawing](_drawing.md)
**Description:**
文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径
**Since:**
8
**Version:**
1.0
## **Summary**
### Typedefs
| Typedef&nbsp;Name | Description |
| -------- | -------- |
| [OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a) | typedef&nbsp;struct&nbsp;[OH_Drawing_Canvas](_drawing.md#ga086e2de47ef7bfe6c96e6b09e87da33a)<br/>OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字 |
| [OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2) | typedef&nbsp;struct&nbsp;[OH_Drawing_Pen](_drawing.md#ga88e73d9d7b62e6113237fc0f828910d2)<br/>OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色 |
| [OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711) | typedef&nbsp;struct&nbsp;[OH_Drawing_Brush](_drawing.md#ga178c83de4a084d35c30e4681319ea711)<br/>OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色 |
| [OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023) | typedef&nbsp;struct&nbsp;[OH_Drawing_Path](_drawing.md#gab7e53fc0181099b4a0a3e4a08d3c9023)<br/>OH_Drawing_Path定义为路径,路径用于自定义各种形状 |
| [OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb) | typedef&nbsp;struct&nbsp;[OH_Drawing_Bitmap](_drawing.md#ga8ac4e64cd1e2c651d11325e04c72ddeb)<br/>OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据 |
### Enumerations
| Enumeration&nbsp;Name | Description |
| -------- | -------- |
| [OH_Drawing_ColorFormat](_drawing.md#ga6a37fff6c3e0b0d9d81b01755ef846db)&nbsp;{&nbsp;&nbsp;&nbsp;[COLOR_FORMAT_UNKNOWN](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dbab58141bf00d632ba06094d3c4b6446c2),&nbsp;[COLOR_FORMAT_ALPHA_8](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dbabe54d848a7de45ac9a9a89a6eb6a1886),&nbsp;[COLOR_FORMAT_RGB_565](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dbabc7b2f524d90d876ad222dd595c287d9),&nbsp;[COLOR_FORMAT_ARGB_4444](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dba3dac16f10989bdacb479e7fcd9b8861e),&nbsp;&nbsp;&nbsp;[COLOR_FORMAT_RGBA_8888](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dba3b1984f6b8b6fe5f5d65215c95e80ac2),&nbsp;[COLOR_FORMAT_BGRA_8888](_drawing.md#gga6a37fff6c3e0b0d9d81b01755ef846dba44017098e353684bc3bbd2cd0878df15)&nbsp;} | OH_Drawing_ColorFormat用于描述位图像素的存储格式 |
| [OH_Drawing_AlphaFormat](_drawing.md#gac4dc831be312bb0a7a4745448f4407d3)&nbsp;{&nbsp;[ALPHA_FORMAT_UNKNOWN](_drawing.md#ggac4dc831be312bb0a7a4745448f4407d3ac7e2536628ce62acfc14ec2538425a4a),&nbsp;[ALPHA_FORMAT_OPAQUE](_drawing.md#ggac4dc831be312bb0a7a4745448f4407d3abd3d60c5f30c90748393276a5845f662),&nbsp;[ALPHA_FORMAT_PREMUL](_drawing.md#ggac4dc831be312bb0a7a4745448f4407d3ac0ad416cd779ddc62466d6dceb9a757f),&nbsp;[ALPHA_FORMAT_UNPREMUL](_drawing.md#ggac4dc831be312bb0a7a4745448f4407d3a0b8120300ddca06e3d5db79bfad59a32)&nbsp;} | OH_Drawing_AlphaFormat用于描述位图像素的透明度分量 |
# external_window.h
## **Overview**
**Related Modules:**
[NativeWindow](_native_window.md)
**Description:**
定义获取和使用NativeWindow的相关函数
**Since:**
8
**Version:**
1.0
## **Summary**
### Functions
| Function | Description |
| -------- | -------- |
| [OH_NativeWindow_CreateNativeWindowFromSurface](_native_window.md#ga4225dd025093bc610670c2b517f186c2)&nbsp;(void&nbsp;\*pSurface) | struct&nbsp;NativeWindow&nbsp;\*<br/>创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例 |
| [OH_NativeWindow_DestroyNativeWindow](_native_window.md#ga1ca5f2e39a03b6546352ac90be19238d)&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window) | void<br/>将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉 |
| [OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer](_native_window.md#gaec1b04ace16a364d79b7d54cf917e6f5)&nbsp;(void&nbsp;\*pSurfaceBuffer) | struct&nbsp;NativeWindowBuffer&nbsp;\*<br/>创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例 |
| [OH_NativeWindow_DestroyNativeWindowBuffer](_native_window.md#gafa11a7f9a36b2e6962cc34790eb1e87e)&nbsp;(struct&nbsp;NativeWindowBuffer&nbsp;\*buffer) | void<br/>将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉 |
| [OH_NativeWindow_NativeWindowRequestBuffer](_native_window.md#ga80cad8d3c2863294f828caa4d3422c2c)&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;struct&nbsp;NativeWindowBuffer&nbsp;\*\*buffer,&nbsp;int&nbsp;\*fenceFd) | int32_t<br/>通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产 |
| [OH_NativeWindow_NativeWindowFlushBuffer](_native_window.md#ga8489a6525b5c9f7a6b52aafba07fb777)&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;struct&nbsp;NativeWindowBuffer&nbsp;\*buffer,&nbsp;int&nbsp;fenceFd,&nbsp;Region&nbsp;region) | int32_t<br/>通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费 |
| [OH_NativeWindow_NativeWindowCancelBuffer](_native_window.md#gad7b6ffa8b402f5be0bf6e742b18f03d0)&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;struct&nbsp;NativeWindowBuffer&nbsp;\*buffer) | int32_t<br/>通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请 |
| [OH_NativeWindow_NativeWindowHandleOpt](_native_window.md#ga5620fba277d2f086da6c6d7434c09253)&nbsp;(struct&nbsp;NativeWindow&nbsp;\*window,&nbsp;int&nbsp;code,...) | int32_t<br/>设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等 |
| [OH_NativeWindow_GetBufferHandleFromNative](_native_window.md#ga28c34ab9b0751010cb716ca9acd6dfef)&nbsp;(struct&nbsp;NativeWindowBuffer&nbsp;\*buffer) | BufferHandle&nbsp;\*<br/>通过NativeWindowBuffer获取该buffer的BufferHandle指针 |
| [OH_NativeWindow_NativeObjectReference](_native_window.md#gafcbd7894c5cdae431e591028c5f7f709)&nbsp;(void&nbsp;\*obj) | int32_t<br/>增加一个NativeObject的引用计数 |
| [OH_NativeWindow_NativeObjectUnreference](_native_window.md#ga24567fa7daee679bf927623adac93a9f)&nbsp;(void&nbsp;\*obj) | int32_t<br/>减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉 |
| [OH_NativeWindow_GetNativeObjectMagic](_native_window.md#ga93828d364eebf3ec5c81d7897757f9f2)&nbsp;(void&nbsp;\*obj) | int32_t<br/>获取NativeObject的MagicId |
# 头文件
- **[drawing_bitmap.h](drawing__bitmap_8h.md)**
- **[drawing_brush.h](drawing__brush_8h.md)**
- **[drawing_canvas.h](drawing__canvas_8h.md)**
- **[drawing_color.h](drawing__color_8h.md)**
- **[drawing_font_collection.h](drawing__font__collection_8h.md)**
- **[drawing_path.h](drawing__path_8h.md)**
- **[drawing_pen.h](drawing__pen_8h.md)**
- **[drawing_text_declaration.h](drawing__text__declaration_8h.md)**
- **[drawing_text_typography.h](drawing__text__typography_8h.md)**
- **[drawing_types.h](drawing__types_8h.md)**
- **[external_window.h](external__window_8h.md)**
- **[log.h](log_8h.md)**
- **[native_interface_bundle.h](native__interface__bundle_8h.md)**
- **[native_interface_xcomponent.h](native__interface__xcomponent_8h.md)**
- **[raw_dir.h](raw__dir_8h.md)**
- **[raw_file.h](raw__file_8h.md)**
\ No newline at end of file
# MyProject
- **[Native XComponent](_o_h___native_x_component.md)**
- **[Native_Bundle](_native___bundle.md)**
- **[HiLog](_hi_log.md)**
- **[NativeWindow](_native_window.md)**
- **[Drawing](_drawing.md)**
- **[Rawfile](rawfile.md)**
\ No newline at end of file
# log.h
## **Overview**
**Related Modules:**
[HiLog](_hi_log.md)
**Description:**
HiLog模块日志接口定义,通过这些接口实现日志打印相关功能。
用户输出日志时,先定义日志所属业务领域、日志TAG,然后按照类型、级别选择对应API,指定参数隐私标识输出日志内容。 业务领域:指定日志所对应的业务领域,用户自定义使用,用于标识业务的子系统、模块。16进制整数,范围0x0~0xFFFF。 日志TAG:字符串常量,用于标识调用所在的类或者业务。 日志级别:DEBUG、INFO、WARN、ERROR、FATAL。 参数格式:类printf的方式,包括格式字符串(包括参数类型标识)和变参。 隐私参数标识:在格式字符串每个参数中符号后类型前增加{public}、{private}标识。注意:每个参数未指定隐私标识时,缺省为隐私。 使用示例: 定义业务领域、TAG: \#define LOG_DOMAIN 0x0201 \#define LOG_TAG "MY_TAG" 日志打印: HILOG_WARN([LOG_APP](_hi_log.md#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5), "Failed to visit %{private}s, reason:%{public}d.", url, errno); 结果输出: 05-06 15:01:06.870 1051 1051 W 0201/MY_TAG: Failed to visit &lt;private&gt;, reason:503.
**Since:**
8
## **Summary**
### Macros
| Macro&nbsp;Name&nbsp;and&nbsp;Value | Description |
| -------- | -------- |
| [LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d)&nbsp;&nbsp;&nbsp;0 | 日志所对应的业务领域,用于标识业务的子系统、模块。 |
| [LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6)&nbsp;&nbsp;&nbsp;NULL | 字符串常量,标识调用所在的类或者业务。 |
| [OH_LOG_DEBUG](_hi_log.md#gac9b9319de06bce0df57ef440ccaa25fc)(type,&nbsp;...)&nbsp;&nbsp;&nbsp;((void)[OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946)((type),&nbsp;[LOG_DEBUG](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ab9f002c6ffbfd511da8090213227454e),&nbsp;[LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d),&nbsp;[LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6),&nbsp;__VA_ARGS__)) | DEBUG级别写日志,宏封装接口。 |
| [OH_LOG_INFO](_hi_log.md#gadf3fd661bccb575348c5109a0f24f252)(type,&nbsp;...)&nbsp;&nbsp;&nbsp;((void)[OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946)((type),&nbsp;[LOG_INFO](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9a6e98ff471e3ce6c4ef2d75c37ee51837),&nbsp;[LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d),&nbsp;[LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6),&nbsp;__VA_ARGS__)) | INFO级别写日志,宏封装接口。 |
| [OH_LOG_WARN](_hi_log.md#ga1beaeee414c2e0238db4c57212809737)(type,&nbsp;...)&nbsp;&nbsp;&nbsp;((void)[OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946)((type),&nbsp;[LOG_WARN](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ac8041ffa22bc823d4726701cdb13fc13),&nbsp;[LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d),&nbsp;[LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6),&nbsp;__VA_ARGS__)) | WARN级别写日志,宏封装接口。 |
| [OH_LOG_ERROR](_hi_log.md#gab7e62682d195ee81093e7e08673c4941)(type,&nbsp;...)&nbsp;&nbsp;&nbsp;((void)[OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946)((type),&nbsp;[LOG_ERROR](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9a230506cce5c68c3bac5a821c42ed3473),&nbsp;[LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d),&nbsp;[LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6),&nbsp;__VA_ARGS__)) | ERROR级别写日志,宏封装接口。 |
| [OH_LOG_FATAL](_hi_log.md#ga17370605a946403e37024ea898d27f55)(type,&nbsp;...)&nbsp;&nbsp;&nbsp;((void)HiLogPrint((type),&nbsp;[LOG_FATAL](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ac630750884d91cb9767ef2200bbb048b),&nbsp;[LOG_DOMAIN](_hi_log.md#ga95a1d08c807e0aada863b5298a61d08d),&nbsp;[LOG_TAG](_hi_log.md#ga7ce0df38eb467e59f209470c8f5ac4e6),&nbsp;__VA_ARGS__)) | FATAL级别写日志,宏封装接口。 |
### Enumerations
| Enumeration&nbsp;Name | Description |
| -------- | -------- |
| [LogType](_hi_log.md#gaf67907baa897e9fb84df0cb89795b87c)&nbsp;{&nbsp;[LOG_APP](_hi_log.md#ggaf67907baa897e9fb84df0cb89795b87ca84f0546432a39b6f5e8a777d5cf667b5)&nbsp;=&nbsp;0&nbsp;} | 日志类型。 |
| [LogLevel](_hi_log.md#gaca1fd1d8935433e6ba2e3918214e07f9)&nbsp;{&nbsp;&nbsp;&nbsp;[LOG_DEBUG](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ab9f002c6ffbfd511da8090213227454e)&nbsp;=&nbsp;3,&nbsp;[LOG_INFO](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9a6e98ff471e3ce6c4ef2d75c37ee51837)&nbsp;=&nbsp;4,&nbsp;[LOG_WARN](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ac8041ffa22bc823d4726701cdb13fc13)&nbsp;=&nbsp;5,&nbsp;[LOG_ERROR](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9a230506cce5c68c3bac5a821c42ed3473)&nbsp;=&nbsp;6,&nbsp;&nbsp;&nbsp;[LOG_FATAL](_hi_log.md#ggaca1fd1d8935433e6ba2e3918214e07f9ac630750884d91cb9767ef2200bbb048b)&nbsp;=&nbsp;7&nbsp;} | 日志级别。 |
### Functions
| Function | Description |
| -------- | -------- |
| [OH_LOG_Print](_hi_log.md#gaed4b343058326b7f5dbcac6799025946)&nbsp;([LogType](_hi_log.md#gaf67907baa897e9fb84df0cb89795b87c)&nbsp;type,&nbsp;[LogLevel](_hi_log.md#gaca1fd1d8935433e6ba2e3918214e07f9)&nbsp;level,&nbsp;unsigned&nbsp;int&nbsp;domain,&nbsp;const&nbsp;char&nbsp;\*tag,&nbsp;const&nbsp;char&nbsp;\*fmt,...)&nbsp;__attribute__((__format__(os_log | int<br/>写日志接口。 |
| [OH_LOG_IsLoggable](_hi_log.md#gabba82e8c08cf8941e4af54941eeda257)&nbsp;(unsigned&nbsp;int&nbsp;domain,&nbsp;const&nbsp;char&nbsp;\*tag,&nbsp;[LogLevel](_hi_log.md#gaca1fd1d8935433e6ba2e3918214e07f9)&nbsp;level) | int&nbsp;bool<br/>检查指定业务领域、TAG、级别的日志是否可以打印。 |
# 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)&nbsp;(const&nbsp;char&nbsp;\*bundleName) | char&nbsp;\*<br/>Obtains&nbsp;the&nbsp;application&nbsp;ID&nbsp;based&nbsp;on&nbsp;the&nbsp;given&nbsp;bundle&nbsp;name. |
# native_interface_xcomponent.h
## **Overview**
**Related Modules:**
[Native XComponent](_o_h___native_x_component.md)
**Description:**
Declares APIs for accessing a Native XComponent.
**Since:**
8
**Version:**
1.0
## **Summary**
### Classes
| Classe&nbsp;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&nbsp;the&nbsp;surface&nbsp;lifecycle&nbsp;and&nbsp;touch&nbsp;event&nbsp;callbacks. |
### Macros
| Macro&nbsp;Name&nbsp;and&nbsp;Value | Description |
| -------- | -------- |
| **OH_NATIVE_XCOMPONENT_OBJ**&nbsp;&nbsp;&nbsp;("__NATIVE_XCOMPONENT_OBJ__") | |
### Typedefs
| Typedef&nbsp;Name | Description |
| -------- | -------- |
| [OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1) | typedef&nbsp;struct&nbsp;[OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)<br/>Provides&nbsp;an&nbsp;encapsulated&nbsp;**OH_NativeXComponent**&nbsp;instance. |
| [OH_NativeXComponent_Callback](_o_h___native_x_component.md#gaf629ecc5d06f0a69aea9da3511679ea5) | typedef&nbsp;struct&nbsp;[OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)<br/>Registers&nbsp;the&nbsp;surface&nbsp;lifecycle&nbsp;and&nbsp;touch&nbsp;event&nbsp;callbacks. |
### Enumerations
| Enumeration&nbsp;Name | Description |
| -------- | -------- |
| {&nbsp;[OH_NATIVEXCOMPONENT_RESULT_SUCCESS](_o_h___native_x_component.md#gga06fc87d81c62e9abb8790b6e5713c55baf2a815b270113979adea7b9440e0b80e)&nbsp;=&nbsp;0,&nbsp;[OH_NATIVEXCOMPONENT_RESULT_FAILED](_o_h___native_x_component.md#gga06fc87d81c62e9abb8790b6e5713c55bad6e4a33f3c594e267b8101bbc8ba682f)&nbsp;=&nbsp;-1,&nbsp;[OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](_o_h___native_x_component.md#gga06fc87d81c62e9abb8790b6e5713c55baa12565a3677df7c8dc60e216ed40e580)&nbsp;=&nbsp;-2&nbsp;} | Enumerates&nbsp;the&nbsp;API&nbsp;access&nbsp;states. |
| [OH_NativeXComponent_TouchEventType](_o_h___native_x_component.md#ga0a8c68dd460d7e801e7c0ff771f09182)&nbsp;{&nbsp;&nbsp;&nbsp;[OH_NATIVEXCOMPONENT_DOWN](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182a87b4dfe82e5aafd40c202484fc10dfb4)&nbsp;=&nbsp;0,&nbsp;[OH_NATIVEXCOMPONENT_UP](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182ae2da3fbb127398f9a749070edf671597),&nbsp;[OH_NATIVEXCOMPONENT_MOVE](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182a0b97e9e7830d0363e3617e2a7d33b378),&nbsp;[OH_NATIVEXCOMPONENT_CANCEL](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182a8593a5e1053e9c9df74d6b0e8a9bbb0a),&nbsp;&nbsp;&nbsp;[OH_NATIVEXCOMPONENT_UNKNOWN](_o_h___native_x_component.md#gga0a8c68dd460d7e801e7c0ff771f09182aff39d23c1412b3b110a19df4893651d3)&nbsp;} | |
### Functions
| Function | Description |
| -------- | -------- |
| [OH_NativeXComponent_GetXComponentId](_o_h___native_x_component.md#ga1aa5d0ac3778b9caef35f93b54a6f677)&nbsp;([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)&nbsp;\*component,&nbsp;char&nbsp;\*id,&nbsp;uint64_t&nbsp;\*size) | int32_t<br/>Obtains&nbsp;the&nbsp;ID&nbsp;of&nbsp;the&nbsp;ArkUI&nbsp;XComponent. |
| [OH_NativeXComponent_GetXComponentSize](_o_h___native_x_component.md#ga8f60375298a5d9eae57d03d4c5cf5f3f)&nbsp;([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)&nbsp;\*component,&nbsp;const&nbsp;void&nbsp;\*window,&nbsp;uint64_t&nbsp;\*width,&nbsp;uint64_t&nbsp;\*height) | int32_t<br/>Obtains&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;surface&nbsp;held&nbsp;by&nbsp;the&nbsp;ArkUI&nbsp;XComponent. |
| [OH_NativeXComponent_GetXComponentOffset](_o_h___native_x_component.md#ga3a594868e2d0f633026b7fea2f45812a)&nbsp;([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)&nbsp;\*component,&nbsp;const&nbsp;void&nbsp;\*window,&nbsp;double&nbsp;\*x,&nbsp;double&nbsp;\*y) | int32_t<br/>Obtains&nbsp;the&nbsp;offset&nbsp;of&nbsp;the&nbsp;surface&nbsp;held&nbsp;by&nbsp;the&nbsp;ArkUI&nbsp;XComponent. |
| [OH_NativeXComponent_GetTouchEvent](_o_h___native_x_component.md#ga5b0e85c74dab846b5b61a5e244ee60ca)&nbsp;([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)&nbsp;\*component,&nbsp;const&nbsp;void&nbsp;\*window,&nbsp;[OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md)&nbsp;\*touchEvent) | int32_t<br/>Obtains&nbsp;the&nbsp;touch&nbsp;event&nbsp;dispatched&nbsp;by&nbsp;the&nbsp;ArkUI&nbsp;XComponent. |
| [OH_NativeXComponent_RegisterCallback](_o_h___native_x_component.md#gaf9b8b470cd51ac0e339710926bca72e3)&nbsp;([OH_NativeXComponent](_o_h___native_x_component.md#ga0e676460ec145b81bdb07a97a368a5f1)&nbsp;\*component,&nbsp;[OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)&nbsp;\*callback) | int32_t<br/>Registers&nbsp;a&nbsp;callback&nbsp;for&nbsp;this&nbsp;**OH_NativeXComponent**&nbsp;instance. |
# raw_dir.h
## **Overview**
**Related Modules:**
[Rawfile](rawfile.md)
**Description:**
提供rawfile目录相关功能
功能包括遍历和关闭rawfile目录
**Since:**
8
**Version:**
1.0
## **Summary**
### Typedefs
| Typedef&nbsp;Name | Description |
| -------- | -------- |
| [RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3) | typedef&nbsp;struct&nbsp;[RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)<br/>提供对rawfile目录的访问 |
### Functions
| Function | Description |
| -------- | -------- |
| [OH_ResourceManager_GetRawFileName](rawfile.md#gaf522ad160d8ca2bd476b6ad45696e1af)&nbsp;([RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)&nbsp;\*rawDir,&nbsp;int&nbsp;index) | const&nbsp;char&nbsp;\*<br/>通过索引获取rawfile文件名称 |
| [OH_ResourceManager_GetRawFileCount](rawfile.md#ga604cd2ced1bf4a0d1ace7b0fc89cb884)&nbsp;([RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)&nbsp;\*rawDir) | int<br/>获取[RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)中的rawfile数量 |
| [OH_ResourceManager_CloseRawDir](rawfile.md#ga1db0825028507d355db4067f187223de)&nbsp;([RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)&nbsp;\*rawDir) | void<br/>关闭已打开的[RawDir](rawfile.md#ga654d75f2b4badf0dac10c4127a9938c3)并释放所有相关联资源 |
# raw_file.h
## **Overview**
**Related Modules:**
[Rawfile](rawfile.md)
**Description:**
提供rawfile文件相关功能
功能包括搜索、读取和关闭rawfile文件
**Since:**
8
**Version:**
1.0
## **Summary**
### Classes
| Classe&nbsp;Name | Description |
| -------- | -------- |
| [RawFileDescriptor](_raw_file_descriptor.md) | 提供rawfile文件描述符信息 |
### Typedefs
| Typedef&nbsp;Name | Description |
| -------- | -------- |
| [RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27) | typedef&nbsp;struct&nbsp;[RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)<br/>提供对rawfile的访问功能 |
### Functions
| Function | Description |
| -------- | -------- |
| [OH_ResourceManager_ReadRawFile](rawfile.md#ga2958ba7372ae1232365358115a82c219)&nbsp;(const&nbsp;[RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)&nbsp;\*rawFile,&nbsp;void&nbsp;\*buf,&nbsp;size_t&nbsp;length) | int<br/>读取rawfile |
| [OH_ResourceManager_SeekRawFile](rawfile.md#ga7fc0d124fd184498b0a0bfad3454f45c)&nbsp;(const&nbsp;[RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)&nbsp;\*rawFile,&nbsp;long&nbsp;offset,&nbsp;int&nbsp;whence) | int<br/>基于指定的offset,在rawfile文件内搜索读写数据的位置 |
| [OH_ResourceManager_GetRawFileSize](rawfile.md#gafcc6036360466ab5193b7b4eba5eae50)&nbsp;([RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)&nbsp;\*rawFile) | long<br/>获取rawfile长度,单位为int32_t |
| [OH_ResourceManager_CloseRawFile](rawfile.md#ga5cccee53550670a2111705d56a1d427b)&nbsp;([RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)&nbsp;\*rawFile) | void<br/>关闭已打开的[RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)&nbsp;以及释放所有相关联资源 |
| [OH_ResourceManager_GetRawFileOffset](rawfile.md#ga57dc379d6df6b7c7f8e76303ad4957a4)&nbsp;(const&nbsp;[RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)&nbsp;\*rawFile) | long<br/>获取rawfile当前的offset,单位为int32_t |
| [OH_ResourceManager_GetRawFileDescriptor](rawfile.md#ga8313a7d4bb361a98ced485346a9be4b1)&nbsp;(const&nbsp;[RawFile](rawfile.md#gacf2dc23017812d7daf535b80f1a6ab27)&nbsp;\*rawFile,&nbsp;[RawFileDescriptor](_raw_file_descriptor.md)&nbsp;&amp;descriptor) | bool<br/>基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符 |
| [OH_ResourceManager_ReleaseRawFileDescriptor](rawfile.md#gabf9db7f05088a11cc311a6ef890eda6b)&nbsp;(const&nbsp;[RawFileDescriptor](_raw_file_descriptor.md)&nbsp;&amp;descriptor) | bool<br/>关闭rawfile文件描述符 |
# Rawfile
## **Overview**
**Description:**
提供操作rawfile目录和rawfile文件的功能
提供操作rawfile目录和rawfile文件功能
功能包括遍历、打开、搜索、读取和关闭rawfile
**Since:**
8
**Version:**
1.0
## **Summary**
### Files
| File&nbsp;Name | Description |
| -------- | -------- |
| [raw_dir.h](raw__dir_8h.md) | 提供rawfile目录相关功能 |
| [raw_file.h](raw__file_8h.md) | 提供rawfile文件相关功能 |
### Classes
| Classe&nbsp;Name | Description |
| -------- | -------- |
| [RawFileDescriptor](_raw_file_descriptor.md) | 提供rawfile文件描述符信息 |
### Typedefs
| Typedef&nbsp;Name | Description |
| -------- | -------- |
| RawDir | typedef&nbsp;struct&nbsp;RawDir<br/>提供对rawfile目录的访问 |
| RawFile | typedef&nbsp;struct&nbsp;RawFile<br/>提供对rawfile的访问功能 |
| NativeResourceManager | typedef&nbsp;struct&nbsp;NativeResourceManager<br/>代表resource&nbsp;manager |
### Functions
| Function | Description |
| -------- | -------- |
| OH_ResourceManager_GetRawFileName&nbsp;(RawDir&nbsp;\*rawDir,&nbsp;int&nbsp;index) | const&nbsp;char&nbsp;\*<br/>通过索引获取rawfile文件名称 |
| OH_ResourceManager_GetRawFileCount&nbsp;(RawDir&nbsp;\*rawDir) | int<br/>获取RawDir中的rawfile数量 |
| OH_ResourceManager_CloseRawDir&nbsp;(RawDir&nbsp;\*rawDir) | void<br/>关闭已打开的RawDir并释放所有相关联资源 |
| OH_ResourceManager_ReadRawFile&nbsp;(const&nbsp;RawFile&nbsp;\*rawFile,&nbsp;void&nbsp;\*buf,&nbsp;size_t&nbsp;length) | int<br/>读取rawfile |
| OH_ResourceManager_SeekRawFile&nbsp;(const&nbsp;RawFile&nbsp;\*rawFile,&nbsp;long&nbsp;offset,&nbsp;int&nbsp;whence) | int<br/>基于指定的offset,在rawfile文件内搜索读写数据的位置 |
| OH_ResourceManager_GetRawFileSize&nbsp;(RawFile&nbsp;\*rawFile) | long<br/>获取rawfile长度,单位为int32_t |
| OH_ResourceManager_CloseRawFile&nbsp;(RawFile&nbsp;\*rawFile) | void<br/>关闭已打开的RawFile&nbsp;以及释放所有相关联资源 |
| OH_ResourceManager_GetRawFileOffset&nbsp;(const&nbsp;RawFile&nbsp;\*rawFile) | long<br/>获取rawfile当前的offset,单位为int32_t |
| OH_ResourceManager_GetRawFileDescriptor&nbsp;(const&nbsp;RawFile&nbsp;\*rawFile,&nbsp;RawFileDescriptor&nbsp;&amp;descriptor) | bool<br/>基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符 |
| OH_ResourceManager_ReleaseRawFileDescriptor&nbsp;(const&nbsp;RawFileDescriptor&nbsp;&amp;descriptor) | bool<br/>关闭rawfile文件描述符 |
| OH_ResourceManager_InitNativeResourceManager&nbsp;(napi_env&nbsp;env,&nbsp;napi_value&nbsp;jsResMgr) | NativeResourceManager&nbsp;\*<br/>基于JavaScipt&nbsp;resource&nbsp;manager获取native&nbsp;resource&nbsp;manager |
| OH_ResourceManager_ReleaseNativeResourceManager&nbsp;(NativeResourceManager&nbsp;\*resMgr) | void<br/>释放native&nbsp;resource&nbsp;manager |
| OH_ResourceManager_OpenRawDir&nbsp;(const&nbsp;NativeResourceManager&nbsp;\*mgr,&nbsp;const&nbsp;char&nbsp;\*dirName) | RawDir&nbsp;\*<br/>打开rawfile目录 |
| OH_ResourceManager_OpenRawFile&nbsp;(const&nbsp;NativeResourceManager&nbsp;\*mgr,&nbsp;const&nbsp;char&nbsp;\*fileName) | RawFile&nbsp;\*<br/>打开rawfile文件 |
## **Details**
## **Typedef**
### NativeResourceManager
```
typedef struct NativeResourceManager NativeResourceManager
```
**Description:**
代表resource manager
此类封装了JavaScript resource manager的native实现 **ResourceManager**指针可以通过调用OH_ResourceManager_InitNativeResourceManager方法获取
### RawDir
```
typedef struct RawDir RawDir
```
**Description:**
提供对rawfile目录的访问
### RawFile
```
typedef struct RawFile RawFile
```
**Description:**
提供对rawfile的访问功能
## **Function**
### OH_ResourceManager_CloseRawDir()
```
void OH_ResourceManager_CloseRawDir (RawDir * rawDir)
```
**Description:**
关闭已打开的RawDir并释放所有相关联资源
**Parameters:**
| Name | Description |
| -------- | -------- |
| rawDir | 表示指向RawDir的指针 |
**See also:**
OH_ResourceManager_OpenRawDir
### OH_ResourceManager_CloseRawFile()
```
void OH_ResourceManager_CloseRawFile (RawFile * rawFile)
```
**Description:**
关闭已打开的RawFile 以及释放所有相关联资源
**Parameters:**
| Name | Description |
| -------- | -------- |
| rawFile | 表示指向RawFile的指针 |
**See also:**
OH_ResourceManager_OpenRawFile
### OH_ResourceManager_GetRawFileCount()
```
int OH_ResourceManager_GetRawFileCount (RawDir * rawDir)
```
**Description:**
获取RawDir中的rawfile数量
通过此方法可以获取OH_ResourceManager_GetRawFileName中可用的索引
**Parameters:**
| Name | Description |
| -------- | -------- |
| rawDir | 表示指向RawDir的指针 |
**See also:**
OH_ResourceManager_GetRawFileName
### OH_ResourceManager_GetRawFileDescriptor()
```
bool OH_ResourceManager_GetRawFileDescriptor (const RawFile * rawFile, RawFileDescriptor & descriptor )
```
**Description:**
基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符
打开的文件描述符被用于读取rawfile
**Parameters:**
| Name | Description |
| -------- | -------- |
| rawFile | 表示指向RawFile的指针 |
| descriptor | 显示rawfile文件描述符,以及在HAP包中的起始位置和长度 |
**Returns:**
返回true表示打开rawfile文件描述符成功,返回false表示rawfile不允许被访问
### OH_ResourceManager_GetRawFileName()
```
const char* OH_ResourceManager_GetRawFileName (RawDir * rawDir, int index )
```
**Description:**
通过索引获取rawfile文件名称
可以使用此方法遍历rawfile目录
**Parameters:**
| Name | Description |
| -------- | -------- |
| rawDir | 表示指向RawDir的指针 |
| index | 表示文件在RawDir中的索引位置 |
**Returns:**
通过索引返回文件名称,此返回值可以作为OH_ResourceManager_OpenRawFile的输入参数, 如果遍历完所有文件仍未找到,则返回**NULL**
**See also:**
OH_ResourceManager_OpenRawFile
### OH_ResourceManager_GetRawFileOffset()
```
long OH_ResourceManager_GetRawFileOffset (const RawFile * rawFile)
```
**Description:**
获取rawfile当前的offset,单位为int32_t
rawfile当前的offset
**Parameters:**
| Name | Description |
| -------- | -------- |
| rawFile | 表示指向RawFile的指针 |
**Returns:**
返回rawfile当前的offset
### OH_ResourceManager_GetRawFileSize()
```
long OH_ResourceManager_GetRawFileSize (RawFile * rawFile)
```
**Description:**
获取rawfile长度,单位为int32_t
**Parameters:**
| Name | Description |
| -------- | -------- |
| rawFile | 表示指向RawFile的指针 |
**Returns:**
Returns rawfile整体长度
### OH_ResourceManager_InitNativeResourceManager()
```
NativeResourceManager* OH_ResourceManager_InitNativeResourceManager (napi_env env, napi_value jsResMgr )
```
**Description:**
基于JavaScipt resource manager获取native resource manager
通过获取resource manager来完成rawfile相关功能
**Parameters:**
| Name | Description |
| -------- | -------- |
| env | 表示JavaScipt&nbsp;Native&nbsp;Interface&nbsp;(napi)环境指针 |
| jsResMgr | 表示JavaScipt&nbsp;resource&nbsp;manager |
**Returns:**
返回NativeResourceManager指针
### OH_ResourceManager_OpenRawDir()
```
RawDir* OH_ResourceManager_OpenRawDir (const NativeResourceManager * mgr, const char * dirName )
```
**Description:**
打开rawfile目录
打开rawfile目录后,可以遍历对应目录下的rawfile文件
**Parameters:**
| Name | Description |
| -------- | -------- |
| mgr | 表示指向NativeResourceManager的指针,此指针是通过调用&nbsp;OH_ResourceManager_InitNativeResourceManager方法获取的 |
| dirName | 表示要打开的rawfile目录名称,当传递一个空字符串时表示打开rawfile根目录 |
**Returns:**
返回RawDir指针。使用完此指针后,调用OH_ResourceManager_CloseRawDir释放。
**See also:**
OH_ResourceManager_InitNativeResourceManager
OH_ResourceManager_CloseRawDir
### OH_ResourceManager_OpenRawFile()
```
RawFile* OH_ResourceManager_OpenRawFile (const NativeResourceManager * mgr, const char * fileName )
```
**Description:**
打开rawfile文件
当打开rawfile以后,可以读取它的数据
**Parameters:**
| Name | Description |
| -------- | -------- |
| mgr | 表示指向NativeResourceManager的指针,此指针是通过调用&nbsp;OH_ResourceManager_InitNativeResourceManager方法获取的 |
| fileName | 表示基于rawfile根目录的相对路径下的文件名称 |
**Returns:**
返回RawFile指针。当使用完此指针,调用OH_ResourceManager_CloseRawFile释放。
**See also:**
OH_ResourceManager_InitNativeResourceManager
OH_ResourceManager_CloseRawFile
### OH_ResourceManager_ReadRawFile()
```
int OH_ResourceManager_ReadRawFile (const RawFile * rawFile, void * buf, size_t length )
```
**Description:**
读取rawfile
从当前位置读取**指定长度**的数据
**Parameters:**
| Name | Description |
| -------- | -------- |
| rawFile | 表示指向RawFile的指针 |
| buf | 用于接收读取数据的缓冲区指针 |
| length | 读取数据的字节长度 |
**Returns:**
返回读取的字节数,如果读取长度超过文件末尾长度,则返回**0**
### OH_ResourceManager_ReleaseNativeResourceManager()
```
void OH_ResourceManager_ReleaseNativeResourceManager (NativeResourceManager * resMgr)
```
**Description:**
释放native resource manager
**Parameters:**
| Name | Description |
| -------- | -------- |
| resMgr | 表示NativeResourceManager指针 |
### OH_ResourceManager_ReleaseRawFileDescriptor()
```
bool OH_ResourceManager_ReleaseRawFileDescriptor (const RawFileDescriptor & descriptor)
```
**Description:**
关闭rawfile文件描述符
已打开的文件描述符在使用完以后必须释放,防止文件描述符泄露
**Parameters:**
| Name | Description |
| -------- | -------- |
| descriptor | 包含rawfile文件描述符,以及在HAP包中的起始位置和长度 |
**Returns:**
返回true表示关闭文件描述符成功,返回false表示关闭文件描述符失败
### OH_ResourceManager_SeekRawFile()
```
int OH_ResourceManager_SeekRawFile (const RawFile * rawFile, long offset, int whence )
```
**Description:**
基于指定的offset,在rawfile文件内搜索读写数据的位置
**Parameters:**
| Name | Description |
| -------- | -------- |
| rawFile | 表示指向RawFile的指针 |
| offset | 表示指定的offset |
| whence | 读写位置,有以下场景:&nbsp;**0**:&nbsp;读写位置为**offset1**:&nbsp;读写位置为当前位置加上**offset2**:&nbsp;读写位置为文件末尾(EOF)加上**offset** |
**Returns:**
如果搜索成功返回新的读写位置,如果发生错误返回 **(long) -1**
# 头文件和结构体
- **[头文件](files.md)**
- **[结构体](annotated.md)**
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册