提交 8a237d1e 编写于 作者: S shegangbin

add nativeimage,nativebuffer,nativevsync guidlines

Signed-off-by: Nshegangbin <shegangbin1@huawei.com>
上级 24d34dbd
# NativeBuffer 开发指导
## 场景介绍
NativeBuffer是`OpenHarmony`提供**共享内存**的模块。开发者可以通过`NativeBuffer`接口实现共享内存的申请、使用、属性查询、释放等操作。
针对NativeBuffer,常见的开发场景如下:
* 通过`NativeBuffer`提供的`NAPI`接口申请`NativeBuffer`实例,获取内存的属性信息,把对应的ION内存映射到进程空间。
## 接口说明
| 接口名 | 描述 |
| -------- | -------- |
| OH_NativeBuffer_Alloc (const OH_NativeBuffer_Config \*config) | 通过OH_NativeBuffer_Config创建OH_NativeBuffer实例,每次调用都会产生一个新的OH_NativeBuffer实例。 |
| OH_NativeBuffer_Reference (OH_NativeBuffer \*buffer) | 将OH_NativeBuffer对象的引用计数加1。 |
| OH_NativeBuffer_Unreference (OH_NativeImage \*image, uint32_t textureId) | 将OH_NativeBuffer对象的引用计数减1,当引用计数为0的时候,该NativeBuffer对象会被析构掉。 |
| OH_NativeBuffer_GetConfig (OH_NativeBuffer \*buffer, OH_NativeBuffer_Config \*config) | 用于获取OH_NativeBuffer的属性。 |
| OH_NativeBuffer_Map (OH_NativeBuffer \*buffer, void \*\*virAddr) | 将OH_NativeBuffer对应的ION内存映射到进程空间。 |
| OH_NativeBuffer_Unmap (OH_NativeBuffer \*buffer) | 将OH_NativeBuffer对应的ION内存从进程空间移除。 |
| OH_NativeBuffer_GetSeqNum (OH_NativeBuffer \*buffer) | 获取OH_NativeBuffer的序列号。 |
详细的接口说明请参考[native_buffer](../reference/native-apis/_o_h___native_buffer.md)
## 开发步骤
以下步骤描述了在**OpenHarmony**中如何使用`NativeBuffer`提供的`NAPI`接口,创建`NativeBuffer`实例获取内存的属性信息,并把对应的ION内存映射到进程空间。
1. **创建`NativeBuffer`实例**
```c++
OH_NativeBuffer_Config config {
.width = 0x100,
.height = 0x100,
.format = GRAPHIC_PIXEL_FMT_RGBA_8888,
.usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA};
OH_NativeBuffer* buffer = OH_NativeBuffer_Alloc(&config);
if (buffer == nullptr) {
return;
}
```
2. **将OH_NativeBuffer对应的ION内存映射到进程空间**
```c++
// 将ION内存映射到进程空间
int32_t ret = OH_NativeBuffer_Map(buffer, &virAddr);
if (ret != OHOS::GSERROR_OK) {
return;
}
// 将OH_NativeBuffer对应的ION内存从进程空间移除
ret = OH_NativeBuffer_Unmap(buffer);
if (ret != OHOS::GSERROR_OK) {
return;
}
```
3. **获取内存的属性信息**
```c++
// 获取OH_NativeBuffer的属性
OH_NativeBuffer_Config config = {};
OH_NativeBuffer_GetConfig(buffer, &config);
// 获取OH_NativeBuffer的序列号
uint32_t hwBufferID = OH_NativeBuffer_GetSeqNum(buffer);
```
4. **销毁OH_NativeBuffer**
```c++
// 调用OH_NativeBuffer_Unreference引用计数减1,之后buffer的引用计数为0,buffer会销毁
ret = OH_NativeBuffer_Unreference(buffer);
if (ret != OHOS::GSERROR_OK) {
return;
}
```
\ No newline at end of file
# NativeImage 开发指导
## 场景介绍
NativeImage是`OpenHarmony`提供**Surface关联OpenGL外部纹理**的模块,表示图形队列的消费者端。开发者可以通过`NativeImage`接口接收和使用`Buffer`,并将`Buffer`关联输出到OpenGL外部纹理。
针对NativeImage,常见的开发场景如下:
* 通过`NativeImage`提供的`NAPI`接口创建`NativeImage`实例作为消费者端,获取与该实例对应的`NativeWindow`作为生产者端。`NativeWindow`相关接口可用于填充`Buffer`内容并提交,`NativeImage``Buffer`内容更新到OpenGL外部纹理上。
## 接口说明
| 接口名 | 描述 |
| -------- | -------- |
| OH_NativeImage_Create (uint32_t textureId, uint32_t textureTarget) | 创建一个OH_NativeImage实例,该实例与OpenGL ES的纹理ID和纹理目标相关联。 |
| OH_NativeImage_AcquireNativeWindow (OH_NativeImage \*image) | 获取与OH_NativeImage相关联的OHNativeWindow指针,该OHNativeWindow后续不再需要时需要调用 OH_NativeWindow_DestroyNativeWindow释放。 |
| OH_NativeImage_AttachContext (OH_NativeImage \*image, uint32_t textureId) | 将OH_NativeImage实例附加到当前OpenGL ES上下文,且该OpenGL ES纹理会绑定到 GL_TEXTURE_EXTERNAL_OES,并通过OH_NativeImage进行更新。 |
| OH_NativeImage_DetachContext (OH_NativeImage \*image) | 将OH_NativeImage实例从当前OpenGL ES上下文分离。 |
| OH_NativeImage_UpdateSurfaceImage (OH_NativeImage \*image) | 通过OH_NativeImage获取最新帧更新相关联的OpenGL ES纹理。 |
| OH_NativeImage_GetTimestamp (OH_NativeImage \*image) | 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的相关时间戳。 |
| OH_NativeImage_GetTransformMatrix (OH_NativeImage \*image, float matrix[16]) | 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的变化矩阵。 |
| OH_NativeImage_Destroy (OH_NativeImage \*\*image) | 销毁通过OH_NativeImage_Create创建的OH_NativeImage实例,销毁后该OH_NativeImage指针会被赋值为空。 |
详细的接口说明请参考[native_image](../reference/native-apis/_o_h___native_image.md)
## 开发步骤
以下步骤描述了在**OpenHarmony**中如何使用`NativeImage`提供的`NAPI`接口,创建`NativeImage`实例作为消费者端,将数据内容更新到OpenGL外部纹理上。
1. **初始化EGL环境**
```c++
EGLDisplay = GetPlatformEglDisplay(EGL_PLATFORM_OHOS_KHR, EGL_DEFAULT_DISPLAY, NULL);
if (eglDisplay_ == EGL_NO_DISPLAY) {
std::cout << "Failed to create EGLDisplay gl errno : " << eglGetError() << std::endl;
return;
}
EGLint major, minor;
if (eglInitialize(eglDisplay_, &major, &minor) == EGL_FALSE) {
std::cout << "Failed to initialize EGLDisplay" << std::endl;
return;
}
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
std::cout << "Failed to bind OpenGL ES API" << std::endl;
return;
}
unsigned int ret;
EGLint count;
EGLint config_attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, EGL_NONE };
ret = eglChooseConfig(eglDisplay_, config_attribs, &config_, 1, &count);
if (!(ret && static_cast<unsigned int>(count) >= 1)) {
std::cout << "Failed to eglChooseConfig" << std::endl;
return;
}
static const EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, EGL_CONTEXT_CLIENT_VERSION_NUM, EGL_NONE };
eglContext_ = eglCreateContext(eglDisplay_, config_, EGL_NO_CONTEXT, context_attribs);
if (eglContext_ == EGL_NO_CONTEXT) {
std::cout << "Failed to create egl context %{public}x, error:" << eglGetError() << std::endl;
return;
}
eglMakeCurrent(eglDisplay_, EGL_NO_SURFACE, EGL_NO_SURFACE, eglContext_);
std::cout << "Create EGL context successfully, version" << major << "." << minor << std::endl;
```
2. **创建NativeImage实例**
```c++
// 创建 OpenGL 纹理
GLuint textureId;
glGenTextures(1, &textureId);
// 创建 NativeImage 实例,关联 OpenGL 纹理
OH_NativeImage* image = OH_NativeImage_Create(textureId, GL_TEXTURE_2D);
```
3. **获取对应的数据生产者端NativeWindow**
```c++
// 获取生产者NativeWindow
OHNativeWindow* nativeWindow = OH_NativeImage_AcquireNativeWindow(image);
// 通过 OH_NativeWindow_NativeWindowRequestBuffer 获取 NativeWindowBuffer 实例
OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow_, &buffer, &fenceFd);
// 通过 OH_NativeWindow_GetNativeBufferHandleFromNative 获取 buffer 的 handle
BufferHandle* bufferHandle = OH_NativeWindow_GetNativeBufferHandleFromNative(buffer);
```
4. **将生产的内容写入NativeWindowBuffer**
1. 设置NativeWindowBuffer的属性
```c++
// 设置 NativeWindowBuffer 的读写场景
int code = SET_USAGE;
int32_t usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA;
int32_t ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, usage);
// 设置 NativeWindowBuffer 的宽高
code = SET_BUFFER_GEOMETRY;
int32_t width = 0x100;
int32_t height = 0x100;
ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, width, height);
// 设置 NativeWindowBuffer 的步长
code = SET_STRIDE;
int32_t stride = 0x8;
ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, stride);
// 设置 NativeWindowBuffer 的格式
code = SET_FORMAT;
int32_t format = PIXEL_FMT_RGBA_8888;
ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, format);
```
2. 从图形队列申请NativeWindowBuffer
```c++
struct NativeWindowBuffer* buffer = nullptr;
int fenceFd;
// 通过 OH_NativeWindow_NativeWindowRequestBuffer 获取 NativeWindowBuffer 实例
OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &buffer, &fenceFd);
// 通过 OH_NativeWindow_GetNativeBufferHandleFromNative 获取 buffer 的 handle
BufferHandle* bufferHandle = OH_NativeWindow_GetNativeBufferHandleFromNative(buffer);
```
3. 将生产的内容写入NativeWindowBuffer
```c++
auto data = static_cast<uint8_t *>(buffer->sfbuffer->GetVirAddr());
static uint32_t value = 0x00;
value++;
uint32_t *pixel = static_cast<uint32_t *>(data);
for (uint32_t x = 0; x < width; x++) {
for (uint32_t y = 0; y < height; y++) {
*pixel++ = value;
}
}
```
4. 提交NativeWindowBuffer到图形队列
```c++
// 设置刷新区域,如果Region中的Rect为nullptr,或者rectNumber为0,则认为NativeWindowBuffer全部有内容更改。
Region region{nullptr, 0};
// 通过OH_NativeWindow_NativeWindowFlushBuffer 提交给消费者使用,例如:显示在屏幕上。
OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, buffer, fenceFd, region);
```
5. **更新内容到OpenGL纹理**
```c++
// 更新内容到OpenGL纹理。
int32_t ret = OH_NativeImage_UpdateSurfaceImage(image);
if (ret != SURFACE_ERROR_OK) {
std::cout << "OH_NativeImage_UpdateSurfaceImage failed" << std::endl;
return -1;
}
// 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的时间戳和变化矩阵。
int64_t timeStamp = OH_NativeImage_GetTimestamp(image);
if (timeStamp == SURFACE_ERROR_ERROR) {
std::cout << "OH_NativeImage_GetTimestamp failed" << std::endl;
return -1;
}
float matrix[16];
ret = OH_NativeImage_GetTransformMatrix(image, matrix);
if (ret != SURFACE_ERROR_OK) {
std::cout << "OH_NativeImage_GetTransformMatrix failed" << std::endl;
return -1;
}
```
6. **解绑OpenGL纹理,绑定到新的外部纹理上**
```c++
// 将OH_NativeImage实例从当前OpenGL ES上下文分离
ret = OH_NativeImage_DetachContext(image);
if (ret != SURFACE_ERROR_OK) {
std::cout << "OH_NativeImage_DetachContext failed" << std::endl;
return -1;
}
// 将OH_NativeImage实例附加到当前OpenGL ES上下文, 且该OpenGL ES纹理会绑定到 GL_TEXTURE_EXTERNAL_OES, 并通过OH_NativeImage进行更新
GLuint textureId2;
glGenTextures(1, &textureId2);
ret = OH_NativeImage_AttachContext(image, textureId2);
```
# NativeVsync 开发指导
## 场景介绍
NativeVsync模块用来获取系统VSync信号,提供了OH_NativeVSync实例的创建、销毁,以及VSync信号到来时调用设置的调用回调函数能力。
## 接口说明
| 接口名 | 描述 |
| -------- | -------- |
| OH_NativeVSync_Create (const char \*name, unsigned int length) | 创建一个OH_NativeVSync实例,每次调用都会产生一个新的实例。 |
| OH_NativeVSync_Destroy (OH_NativeVSync \*nativeVsync) | 销毁OH_NativeVSync实例。 |
| OH_NativeVSync_FrameCallback (long long timestamp, void \*data) | 回调函数的形式,timestamp表示时间戳,data为回调函数入参。 |
| OH_NativeVSync_RequestFrame (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | 请求下一次VSync信号,当信号到来时,调用回调函数callback。 |
详细的接口说明请参考[native_vsync](../reference/native-apis/_native_vsync.md)
## 开发步骤
以下步骤描述了在**OpenHarmony**中如何使用`NativeVsync`提供的`NAPI`接口,创建和销毁`NativeVsync`实例,以及如何设置VSync信号到来时想要调用的回调函数。
1. **获取NativeVsync实例**
```c++
char name[] = "hello_vsync";
OH_NativeVSync* nativeVSync = OH_NativeVSync_Create(name, strlen(name));
```
2. **设置VSync信号到来时想要调用的回调函数**
```c++
static bool flag = false;
static void OnVSync(long long timestamp, void* data)
{
flag = true;
std::cout << "OnVSync: " << timestamp << std::endl;
}
OH_NativeVSync_FrameCallback callback = OnVSync;
OH_NativeVSync_RequestFrame(nativeVSync, callback, nullptr);
while (!flag) {
std::cout << "wait for vsync!\n";
sleep(1);
}
std::cout << "vsync come, end this thread\n";
```
3. **销毁NativeVsync实例**。
```c++
OH_NativeVSync_Destroy(nativeVSync);
```
\ No newline at end of file
......@@ -2,7 +2,7 @@
## 场景介绍
NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生产者端。接口能力包括从`Surface`构建`NativeWindow`的能力,从`SurfaceBuffer`构建出`NativeWindowBuffer`的能力,开发者可以通过`NativeWindow`接口进行申请和提交`Buffer`
NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生产者端。开发者可以通过`NativeWindow`接口进行申请和提交`Buffer`,配置`Buffer`属性信息
针对NativeWindow,常见的开发场景如下:
* 通过`NativeWindow`提供的`NAPI`接口申请图形`Buffer`,并将生产图形内容写入图形`Buffer`,最终提交`Buffer`到图形队列
......@@ -12,22 +12,22 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生
| 接口名 | 描述 |
| -------- | -------- |
| OH_NativeWindow_CreateNativeWindowFromSurface (void \*pSurface) | 创建NativeWindow实例,每次调用都会产生一个新的NativeWindow实例。 |
| OH_NativeWindow_DestroyNativeWindow (OHNativeWindow \*window) | 将NativeWindow对象的引用计数减1,当引用计数为0的时候,该NativeWindow对象会被析构掉。 |
| OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void \*pSurfaceBuffer) | 创建NativeWindowBuffer实例,每次调用都会产生一个新的NativeWindowBuffer实例。 |
| OH_NativeWindow_DestroyNativeWindowBuffer (OHNativeWindowBuffer \*buffer) | 将NativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该NativeWindowBuffer对象会被析构掉。 |
| OH_NativeWindow_NativeWindowRequestBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*\*buffer, int \*fenceFd) | 通过NativeWindow对象申请一块NativeWindowBuffer,用以内容生产。 |
| OH_NativeWindow_NativeWindowFlushBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer, int fenceFd, Region region) | 通过NativeWindow将生产好内容的NativeWindowBuffer放回到Buffer队列中,用以内容消费。 |
| OH_NativeWindow_NativeWindowAbortBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer) | 通过NativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请。 |
| OH_NativeWindow_NativeWindowHandleOpt (OHNativeWindow \*window, int code,...) | 设置/获取NativeWindow的属性,包括设置/获取宽高、内容格式等。 |
| OH_NativeWindow_GetBufferHandleFromNative (OHNativeWindowBuffer \*buffer) | 通过NativeWindowBuffer获取该buffer的BufferHandle指针。 |
| OH_NativeWindow_CreateNativeWindowFromSurface (void \*pSurface) | 创建OHNativeWindow实例,每次调用都会产生一个新的OHNativeWindow实例。 |
| OH_NativeWindow_DestroyNativeWindow (OHNativeWindow \*window) | 将OHNativeWindow对象的引用计数减1,当引用计数为0的时候,该OHNativeWindow对象会被析构掉。 |
| OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void \*pSurfaceBuffer) | 创建OHNativeWindowBuffer实例,每次调用都会产生一个新的OHNativeWindowBuffer实例。 |
| OH_NativeWindow_DestroyNativeWindowBuffer (OHNativeWindowBuffer \*buffer) | 将OHNativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该OHNativeWindowBuffer对象会被析构掉。 |
| OH_NativeWindow_NativeWindowRequestBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*\*buffer, int \*fenceFd) | 通过OHNativeWindow对象申请一块OHNativeWindowBuffer,用以内容生产。 |
| OH_NativeWindow_NativeWindowFlushBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer, int fenceFd, Region region) | 通过OHNativeWindow将生产好内容的OHNativeWindowBuffer放回到Buffer队列中,用以内容消费。 |
| OH_NativeWindow_NativeWindowAbortBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer) | 通过OHNativeWindow将之前申请出来的NativeWindowBuffer返还到Buffer队列中,供下次再申请。 |
| OH_NativeWindow_NativeWindowHandleOpt (OHNativeWindow \*window, int code,...) | 设置/获取OHNativeWindow的属性,包括设置/获取宽高、内容格式等。 |
| OH_NativeWindow_GetBufferHandleFromNative (OHNativeWindowBuffer \*buffer) | 通过OHNativeWindowBuffer获取该buffer的BufferHandle指针。 |
| OH_NativeWindow_NativeObjectReference (void \*obj) | 增加一个NativeObject的引用计数。 |
| OH_NativeWindow_NativeObjectUnreference (void \*obj) | 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉。 |
| OH_NativeWindow_GetNativeObjectMagic (void \*obj) | 获取NativeObject的MagicId。 |
| OH_NativeWindow_NativeWindowSetScalingMode (OHNativeWindow \*window, uint32_t sequence, OHScalingMode scalingMode) | 设置NativeWindow的缩放模式。 |
| OH_NativeWindow_NativeWindowSetMetaData(OHNativeWindow \*window, uint32_t sequence, int32_t size, const OHHDRMetaData \*metaData) | 设置NativeWindow的HDR静态元数据。 |
| OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow \*window, uint32_t sequence, OHHDRMetadataKey key, int32_t size, const uint8_t \*metaData) | 设置NativeWindow的HDR静态元数据集。 |
| OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow \*window, const OHExtDataHandle \*handle) | 设置NativeWindow的TunnelHandle。 |
| OH_NativeWindow_NativeWindowSetScalingMode (OHNativeWindow \*window, uint32_t sequence, OHScalingMode scalingMode) | 设置OHNativeWindow的缩放模式,此接口从API version 10开始废弃,不提供替代接口。 |
| OH_NativeWindow_NativeWindowSetMetaData(OHNativeWindow \*window, uint32_t sequence, int32_t size, const OHHDRMetaData \*metaData) | 设置OHNativeWindow的HDR静态元数据,此接口从API version 10开始废弃,不提供替代接口。 |
| OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow \*window, uint32_t sequence, OHHDRMetadataKey key, int32_t size, const uint8_t \*metaData) | 设置OHNativeWindow的HDR静态元数据集,此接口从API version 10开始废弃,不提供替代接口。 |
| OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow \*window, const OHExtDataHandle \*handle) | 设置OHNativeWindow的TunnelHandle,此接口从API version 10开始废弃,不提供替代接口。 |
详细的接口说明请参考[native_window](../reference/native-apis/_native_window.md)
......@@ -35,7 +35,7 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生
以下步骤描述了在**OpenHarmony**中如何使用`NativeWindow`提供的`NAPI`接口,申请图形`Buffer`,并将生产图形内容写入图形`Buffer`后,最终提交`Buffer`到图形队列。
1. **获取NativeWindow实例**。可在[`OH_NativeXComponent_Callback`](../reference/native-apis/_o_h___native_x_component___callback.md)提供的接口中获取。
1. **获取OHNativeWindow实例**。可在[`OH_NativeXComponent_Callback`](../reference/native-apis/_o_h___native_x_component___callback.md)提供的接口中获取。
1. 在xxx.ets 中定义 XComponent。
```ts
XComponent({ id: 'xcomponentId', type: 'surface', libraryname: 'nativerender'})
......@@ -62,25 +62,25 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生
// 定义回调函数
void OnSurfaceCreatedCB(OH_NativeXComponent* component, void* window)
{
// 可获取 NativeWindow 实例
// 可获取 OHNativeWindow 实例
OHNativeWindow* nativeWindow = window;
// ...
}
void OnSurfaceChangedCB(OH_NativeXComponent* component, void* window)
{
// 可获取 NativeWindow 实例
// 可获取 OHNativeWindow 实例
OHNativeWindow* nativeWindow = window;
// ...
}
void OnSurfaceDestroyedCB(OH_NativeXComponent* component, void* window)
{
// 可获取 NativeWindow 实例
// 可获取 OHNativeWindow 实例
OHNativeWindow* nativeWindow = window;
// ...
}
void DispatchTouchEventCB(OH_NativeXComponent* component, void* window)
{
// 可获取 NativeWindow 实例
// 可获取 OHNativeWindow 实例
OHNativeWindow* nativeWindow = window;
// ...
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册