提交 68f84489 编写于 作者: G Gloria 提交者: wusongqing

fixed 1756273a from https://gitee.com/wusongqing/docs/pulls/22509

Update docs against 21842

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 9ba15f44
...@@ -26,6 +26,13 @@ For details about the APIs, see [native_buffer](../reference/native-apis/_o_h___ ...@@ -26,6 +26,13 @@ For details about the APIs, see [native_buffer](../reference/native-apis/_o_h___
The following describes how to use the native APIs provided by **NativeBuffer** to create an **OH_NativeBuffer** instance, obtain memory properties, and map the corresponding ION memory to the process address space. The following describes how to use the native APIs provided by **NativeBuffer** to create an **OH_NativeBuffer** instance, obtain memory properties, and map the corresponding ION memory to the process address space.
**Adding Dynamic Link Libraries**
Add the following library to **CMakeLists.txt**:
```txt
libnative_buffer.so
```
**Header File** **Header File**
```c++ ```c++
#include <native_buffer/native_buffer.h> #include <native_buffer/native_buffer.h>
...@@ -52,7 +59,7 @@ The following describes how to use the native APIs provided by **NativeBuffer** ...@@ -52,7 +59,7 @@ The following describes how to use the native APIs provided by **NativeBuffer**
std::cout << "OH_NativeBuffer_Map Failed" << std::endl; std::cout << "OH_NativeBuffer_Map Failed" << std::endl;
} }
// Unmap the ION memory from the process address space when it is no longer needed. // Unmap the ION memory from the process address space when it is no longer needed.
ret = OH_NativeBuffer_Unmap(buffer); ret = OH_NativeBuffer_Unmap(buffer);
if (ret != 0) { if (ret != 0) {
std::cout << "OH_NativeBuffer_Unmap Failed" << std::endl; std::cout << "OH_NativeBuffer_Unmap Failed" << std::endl;
......
...@@ -27,6 +27,17 @@ For details about the APIs, see [native_image](../reference/native-apis/_o_h___n ...@@ -27,6 +27,17 @@ For details about the APIs, see [native_image](../reference/native-apis/_o_h___n
The following steps describe how to use the native APIs provided by **NativeImage** to create an **OH_NativeImage** instance as the consumer and update the data to a OpenGL external texture. The following steps describe how to use the native APIs provided by **NativeImage** to create an **OH_NativeImage** instance as the consumer and update the data to a OpenGL external texture.
**Adding Dynamic Link Libraries**
Add the following libraries to **CMakeLists.txt**:
```txt
libEGL.so
libGLESv3.so
libnative_image.so
libnative_window.so
libnative_buffer.so
```
**Header File** **Header File**
```c++ ```c++
#include <EGL/egl.h> #include <EGL/egl.h>
...@@ -159,6 +170,7 @@ The following steps describe how to use the native APIs provided by **NativeImag ...@@ -159,6 +170,7 @@ The following steps describe how to use the native APIs provided by **NativeImag
4. Write the produced content to a **NativeWindowBuffer** instance. 4. Write the produced content to a **NativeWindowBuffer** instance.
1. Obtain a NativeWindowBuffer instance from the NativeWindow instance. 1. Obtain a NativeWindowBuffer instance from the NativeWindow instance.
```c++ ```c++
OHNativeWindowBuffer* buffer = nullptr; OHNativeWindowBuffer* buffer = nullptr;
int fenceFd; int fenceFd;
...@@ -171,7 +183,9 @@ The following steps describe how to use the native APIs provided by **NativeImag ...@@ -171,7 +183,9 @@ The following steps describe how to use the native APIs provided by **NativeImag
int32_t height = 0x100; int32_t height = 0x100;
ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, width, height); ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, width, height);
``` ```
3. Write the produced content to the **NativeWindowBuffer** instance.
2. Write the produced content to the **NativeWindowBuffer** instance.
```c++ ```c++
static uint32_t value = 0x00; static uint32_t value = 0x00;
value++; value++;
...@@ -182,14 +196,18 @@ The following steps describe how to use the native APIs provided by **NativeImag ...@@ -182,14 +196,18 @@ The following steps describe how to use the native APIs provided by **NativeImag
} }
} }
``` ```
4. Flush the **NativeWindowBuffer** to the **NativeWindow**.
3. Flush the **NativeWindowBuffer** to the **NativeWindow**.
```c++ ```c++
// Set the refresh region. If Rect in Region is a null pointer or rectNumber is 0, all contents in the NativeWindowBuffer are changed. // Set the refresh region. If Rect in Region is a null pointer or rectNumber is 0, all contents in the NativeWindowBuffer are changed.
Region region{nullptr, 0}; Region region{nullptr, 0};
// Flush the buffer to the consumer through OH_NativeWindow_NativeWindowFlushBuffer, for example, by displaying it on the screen. // Flush the buffer to the consumer through OH_NativeWindow_NativeWindowFlushBuffer, for example, by displaying it on the screen.
OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, buffer, fenceFd, region); OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, buffer, fenceFd, region);
``` ```
5. Destroy the **NativeWindow** instance when it is no longer needed.
4. Destroy the **NativeWindow** instance when it is no longer needed.
```c++ ```c++
OH_NativeWindow_DestroyNativeWindow(nativeWindow); OH_NativeWindow_DestroyNativeWindow(nativeWindow);
``` ```
......
...@@ -6,11 +6,11 @@ The **NativeVSync** module is used to obtain virtual synchronization (VSync) sig ...@@ -6,11 +6,11 @@ The **NativeVSync** module is used to obtain virtual synchronization (VSync) sig
## Available APIs ## Available APIs
| API| Description:| | API| Description|
| -------- | -------- | | -------- | -------- |
| OH_NativeVSync_Create (const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.| | OH_NativeVSync_Create (const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.|
| OH_NativeVSync_Destroy (OH_NativeVSync \*nativeVsync) | Destroys an **OH_NativeVSync** instance.| | OH_NativeVSync_Destroy (OH_NativeVSync \*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
| OH_NativeVSync_FrameCallback (long long timestamp, void \*data) | Sets a callback function. **timestamp** indicates the timestamp, and **data** indicates the input parameter of the callback function. | | OH_NativeVSync_FrameCallback (long long timestamp, void \*data) | Sets a callback function. **timestamp** indicates the timestamp, and **data** indicates the input parameter of the callback function.|
| OH_NativeVSync_RequestFrame (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.| | OH_NativeVSync_RequestFrame (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|
For details about the APIs, see [native_vsync](../reference/native-apis/_native_vsync.md). For details about the APIs, see [native_vsync](../reference/native-apis/_native_vsync.md).
...@@ -19,6 +19,13 @@ For details about the APIs, see [native_vsync](../reference/native-apis/_native_ ...@@ -19,6 +19,13 @@ For details about the APIs, see [native_vsync](../reference/native-apis/_native_
The following steps describe how to use the native APIs provided by **NativeVSync** to create and destroy an **OH_NativeVSync** instance and set the VSync callback function. The following steps describe how to use the native APIs provided by **NativeVSync** to create and destroy an **OH_NativeVSync** instance and set the VSync callback function.
**Adding Dynamic Link Libraries**
Add the following library to **CMakeLists.txt**:
```txt
libnative_vsync.so
```
**Header File** **Header File**
```c++ ```c++
#include <native_vsync/native_vsync.h> #include <native_vsync/native_vsync.h>
......
...@@ -159,5 +159,3 @@ libnative_window.so ...@@ -159,5 +159,3 @@ libnative_window.so
// munmap failed // munmap failed
} }
``` ```
<!--no_check-->
\ No newline at end of file
...@@ -18,6 +18,15 @@ For details about the APIs, see [Vulkan](../reference/native-lib/third_party_vul ...@@ -18,6 +18,15 @@ For details about the APIs, see [Vulkan](../reference/native-lib/third_party_vul
The following steps illustrate how to create a **VkSurfaceKHR** instance. The following steps illustrate how to create a **VkSurfaceKHR** instance.
**Adding Dynamic Link Libraries**
Add the following libraries to **CMakeLists.txt**:
```txt
libace_ndk.z.so
libnative_window.so
libvulkan.so
```
**Header File** **Header File**
```c++ ```c++
#include <ace/xcomponent/native_interface_xcomponent.h> #include <ace/xcomponent/native_interface_xcomponent.h>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册