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

!22509 翻译完成:21842 开发指导中指明代码示例需要依赖的动态链接库

Merge pull request !22509 from wusongqing/TR21842
......@@ -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.
**Adding Dynamic Link Libraries**
Add the following library to **CMakeLists.txt**:
```txt
libnative_buffer.so
```
**Header File**
```c++
#include <native_buffer/native_buffer.h>
......@@ -52,7 +59,7 @@ The following describes how to use the native APIs provided by **NativeBuffer**
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);
if (ret != 0) {
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
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**
```c++
#include <EGL/egl.h>
......@@ -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.
1. Obtain a NativeWindowBuffer instance from the NativeWindow instance.
```c++
OHNativeWindowBuffer* buffer = nullptr;
int fenceFd;
......@@ -171,7 +183,9 @@ The following steps describe how to use the native APIs provided by **NativeImag
int32_t height = 0x100;
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++
static uint32_t value = 0x00;
value++;
......@@ -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++
// 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};
// 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);
```
5. Destroy the **NativeWindow** instance when it is no longer needed.
4. Destroy the **NativeWindow** instance when it is no longer needed.
```c++
OH_NativeWindow_DestroyNativeWindow(nativeWindow);
```
......
......@@ -6,11 +6,11 @@ The **NativeVSync** module is used to obtain virtual synchronization (VSync) sig
## 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_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.|
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_
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**
```c++
#include <native_vsync/native_vsync.h>
......
......@@ -159,5 +159,3 @@ libnative_window.so
// 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
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**
```c++
#include <ace/xcomponent/native_interface_xcomponent.h>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册