提交 1f96ad80 编写于 作者: G Gloria

Update docs against 19975

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 c3c489cd
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- About OpenHarmony - About OpenHarmony
- [OpenHarmony Project](../OpenHarmony-Overview.md) - [OpenHarmony Project](../OpenHarmony-Overview.md)
- [Glossary](../glossary.md) - [Glossary](../glossary.md)
- [OpenHarmony Release Notes](../release-notes/Readme.md) - [Release Notes](../release-notes/Readme.md)
- Quick Start - Quick Start
- Getting Started - Getting Started
- [Before You Start](quick-start/start-overview.md) - [Before You Start](quick-start/start-overview.md)
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
- Application Package Fundamentals - Application Package Fundamentals
- [Application Package Overview](quick-start/application-package-overview.md) - [Application Package Overview](quick-start/application-package-overview.md)
- Application Package Structure - Application Package Structure
- [Application Package Structure in Stage Model)](quick-start/application-package-structure-stage.md) - [Application Package Structure in Stage Model](quick-start/application-package-structure-stage.md)
- [Application Package Structure in FA Model](quick-start/application-package-structure-fa.md) - [Application Package Structure in FA Model](quick-start/application-package-structure-fa.md)
- Multi-HAP Mechanism - Multi-HAP Mechanism
- [Multi-HAP Design Objectives](quick-start/multi-hap-objective.md) - [Multi-HAP Design Objectives](quick-start/multi-hap-objective.md)
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
- Application Configuration Files in FA Model - Application Configuration Files in FA Model
- [Application Configuration File Overview (FA Model)](quick-start/application-configuration-file-overview-fa.md) - [Application Configuration File Overview (FA Model)](quick-start/application-configuration-file-overview-fa.md)
- [Internal Structure of the app Tag](quick-start/app-structure.md) - [Internal Structure of the app Tag](quick-start/app-structure.md)
- [Internal structure of deviceConfig Tag](quick-start/deviceconfig-structure.md) - [Internal Structure of the deviceConfig Tag](quick-start/deviceconfig-structure.md)
- [Internal Structure of the module Tag](quick-start/module-structure.md) - [Internal Structure of the module Tag](quick-start/module-structure.md)
- [Resource Categories and Access](quick-start/resource-categories-and-access.md) - [Resource Categories and Access](quick-start/resource-categories-and-access.md)
- Learning ArkTS - Learning ArkTS
- [Getting Started with ArkTS](quick-start/arkts-get-started.md) - [Getting Started with ArkTS](quick-start/arkts-get-started.md)
- Basic Syntax - Basic Syntax
...@@ -47,19 +47,19 @@ ...@@ -47,19 +47,19 @@
- Custom Component - Custom Component
- [Creating a Custom Component](quick-start/arkts-create-custom-components.md) - [Creating a Custom Component](quick-start/arkts-create-custom-components.md)
- [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md) - [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md)
- [\@Builder: Custom Builder Function](quick-start/arkts-builder.md) - [\@Builder Decorator: Custom Builder Function](quick-start/arkts-builder.md)
- [\@BuilderParam: @Builder Function Reference](quick-start/arkts-builderparam.md) - [\@BuilderParam Decorator: \@Builder Function Reference](quick-start/arkts-builderparam.md)
- [\@Styles: Definition of Resusable Styles](quick-start/arkts-style.md) - [\@Styles Decorator: Definition of Resusable Styles](quick-start/arkts-style.md)
- [\@Extend: Extension of Built-in Components](quick-start/arkts-extend.md) - [\@Extend Decorator: Extension of Built-in Components](quick-start/arkts-extend.md)
- [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md) - [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md)
- State Management - State Management
- [State Management Overview](quick-start/arkts-state-management-overview.md) - [State Management Overview](quick-start/arkts-state-management-overview.md)
- Component State Management - Component State Management
- [\@State: State Owned by Component](quick-start/arkts-state.md) - [\@State Decorator: State Owned by Component](quick-start/arkts-state.md)
- [\@Prop: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md) - [\@Prop Decorator: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md)
- [\@Link: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md) - [\@Link Decorator: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md)
- [\@Provide and \@Consume: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.md) - [\@Provide and \@Consume Decorators: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.md)
- [\@Observed and \@ObjectLink: Observing Attribute Changes in Nested Class Objects](quick-start/arkts-observed-and-objectlink.md) - [\@Observed and \@ObjectLink Decorators: Observing Attribute Changes in Nested Class Objects](quick-start/arkts-observed-and-objectlink.md)
- Application State Management - Application State Management
- [Application State Management Overview](quick-start/arkts-application-state-management-overview.md) - [Application State Management Overview](quick-start/arkts-application-state-management-overview.md)
- [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md) - [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md)
...@@ -68,10 +68,10 @@ ...@@ -68,10 +68,10 @@
- [Environment: Device Environment Query](quick-start/arkts-environment.md) - [Environment: Device Environment Query](quick-start/arkts-environment.md)
- Other State Management Features - Other State Management Features
- [Overview of Other State Management Features](quick-start/arkts-other-state-mgmt-functions-overview.md) - [Overview of Other State Management Features](quick-start/arkts-other-state-mgmt-functions-overview.md)
- [\@Watch: Getting Notified of State Variable Changes](quick-start/arkts-watch.md) - [\@Watch Decorator: Getting Notified of State Variable Changes](quick-start/arkts-watch.md)
- [$$ Syntax: Two-Way Synchronization of Built-in Components](quick-start/arkts-two-way-sync.md) - [$$ Syntax: Two-Way Synchronization of Built-in Components](quick-start/arkts-two-way-sync.md)
- Rendering Control - Rendering Control
- [Rendering Control Overview](quick-start/arkts-rendering-control-overview.md) - [Overview of Rendering Control](quick-start/arkts-rendering-control-overview.md)
- [if/else: Conditional Rendering](quick-start/arkts-rendering-control-ifelse.md) - [if/else: Conditional Rendering](quick-start/arkts-rendering-control-ifelse.md)
- [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md) - [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md)
- [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md) - [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md)
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
- [DFX](dfx/Readme-EN.md) - [DFX](dfx/Readme-EN.md)
- [Internationalization](internationalization/Readme-EN.md) - [Internationalization](internationalization/Readme-EN.md)
- [Application Test](application-test/Readme-EN.md) - [Application Test](application-test/Readme-EN.md)
- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md) - [IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Native APIs](napi/Readme-EN.md) - [Native APIs](napi/Readme-EN.md)
- Tools - Tools
- [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md) - [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md)
...@@ -109,11 +109,11 @@ ...@@ -109,11 +109,11 @@
- [SystemCapability List](reference/syscap-list.md) - [SystemCapability List](reference/syscap-list.md)
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md) - [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md)
- [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md) - [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md)
- [JS Service Widget UI Components](reference/js-service-widget-ui/Readme-EN.md) - [JavaScript Service Widget UI Component Reference](reference/js-service-widget-ui/Readme-EN.md)
- APIs - API Reference
- [ArkTS and JS APIs](reference/apis/Readme-EN.md) - [ArkTS and JavaScript APIs](reference/apis/Readme-EN.md)
- [Error Codes](reference/errorcodes/Readme-EN.md) - [Error Codes](reference/errorcodes/Readme-EN.md)
- Native APIs - Native API Reference
- [Native APIs](reference/native-apis/Readme-EN.md) - [Native APIs](reference/native-apis/Readme-EN.md)
- [Standard Libraries](reference/native-lib/third_party_libc/musl.md) - [Standard Libraries](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md) - [Node_API](reference/native-lib/third_party_napi/napi.md)
......
...@@ -10,7 +10,7 @@ The documents are carefully organized as follows: ...@@ -10,7 +10,7 @@ The documents are carefully organized as follows:
## Getting Started ## Getting Started
[Here](quick-start/start-overview.md) you'll learn how to quickly get started with OpenHarmony application development. [Here](quick-start/start-overview.md) you can learn how to better prepare yourself for application development.
Browse the documents on the instructions for quickly building your first application and the basics about OpenHarmony applications. Browse the documents on the instructions for quickly building your first application and the basics about OpenHarmony applications.
...@@ -40,12 +40,12 @@ Then, equip yourself for developing the key features, with the following guideli ...@@ -40,12 +40,12 @@ Then, equip yourself for developing the key features, with the following guideli
- [Data Management](database/data-mgmt-overview.md) - [Data Management](database/data-mgmt-overview.md)
- [File Management](file-management/file-management-overview.md) - [File Management](file-management/file-management-overview.md)
- [Task Management](task-management/background-task-overview.md) - [Task Management](task-management/background-task-overview.md)
- [Device](device/usb-overview.md) - [Device Management](device/usb-overview.md)
- [Device Usage Statistics](device-usage-statistics/device-usage-statistics-overview.md) - [Device Usage Statistics](device-usage-statistics/device-usage-statistics-overview.md)
- [DFX](dfx/hiappevent-guidelines.md) - [DFX](dfx/hiappevent-guidelines.md)
- [Internationalization](internationalization/international-overview.md) - [Internationalization](internationalization/international-overview.md)
- [Application Test](application-test/arkxtest-guidelines.md) - [Application Test](application-test/arkxtest-guidelines.md)
- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md) - [IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Using Native APIs in Application Projects](napi/napi-guidelines.md) - [Using Native APIs in Application Projects](napi/napi-guidelines.md)
## Tools ## Tools
...@@ -63,11 +63,12 @@ API references encompass all components and APIs available in OpenHarmony, helpi ...@@ -63,11 +63,12 @@ API references encompass all components and APIs available in OpenHarmony, helpi
They are organized as follows: They are organized as follows:
- [ArkTS API Reference](reference/apis/development-intro.md)
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/ts-components-summary.md) - [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/ts-components-summary.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm- ArkUI.Full)](reference/arkui-js/Readme-EN.md) - [Component Reference (JavaScript-compatible Web-like Development Paradigm- ArkUI.Full)](reference/arkui-js/Readme-EN.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm- ArkUI.Lite)](reference/arkui-js-lite/Readme-EN.md) - [Component Reference (JavaScript-compatible Web-like Development Paradigm- ArkUI.Lite)](reference/arkui-js-lite/Readme-EN.md)
- [JS Service Widget UI Components](reference/js-service-widget-ui/js-service-widget-file.md) - [JavaScript Service Widget UI Component Reference](reference/js-service-widget-ui/js-service-widget-file.md)
- [JS and TS APIs](reference/apis/development-intro.md) - Native API Reference
- Native APIs - [Native APIs](reference/native-apis/_o_h___native_x_component.md)
- [Standard Library](reference/native-lib/third_party_libc/musl.md) - [Standard Libraries](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md) - [Node_API](reference/native-lib/third_party_napi/napi.md)
# Development References # Development References
- [ArkTS API Reference](apis/Readme-EN.md)
- [SystemCapability](syscap.md) - [SystemCapability](syscap.md)
- [SystemCapability List](syscap-list.md) - [SystemCapability List](syscap-list.md)
- [Component Reference (ArkTS-based Declarative Development Paradigm)](arkui-ts/Readme-EN.md) - [Component Reference (ArkTS-based Declarative Development Paradigm)](arkui-ts/Readme-EN.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm)](arkui-js/Readme-EN.md) - [Component Reference (JavaScript-compatible Web-like Development Paradigm - ArkUI.Full)](arkui-js/Readme-EN.md)
- [JS Service Widget UI Component Reference](js-service-widget-ui/Readme-EN.md) - [Component Reference (JavaScript-compatible Web-like Development Paradigm - ArkUI.Lite)](arkui-js-lite/Readme-EN.md)
- [API Reference (ArkTS and JS APIs)](apis/Readme-EN.md) - [JavaScript Service Widget UI Component Reference](js-service-widget-ui/Readme-EN.md)
- [Error Codes](errorcodes/Readme-EN.md) - [Error Codes](errorcodes/Readme-EN.md)
- API Reference (Native APIs) - Native API Reference
- [Standard Libraries Supported by Native APIs](native-lib/Readme-EN.md) - [OpenHarmony Native APIs](native-apis/Readme-EN.md)
- [Standard Libraries Supported by Native APIs](native-lib/Readme-EN.md)
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
- [Native XComponent](_o_h___native_x_component.md) - [Native XComponent](_o_h___native_x_component.md)
- [HiLog](_hi_log.md) - [HiLog](_hi_log.md)
- [NativeWindow](_native_window.md) - [NativeWindow](_native_window.md)
- [OH_NativeBuffer](_o_h___native_buffer.md)
- [Drawing](_drawing.md) - [Drawing](_drawing.md)
- [OH_NativeImage](_o_h___native_image.md)
- [NativeVsync](_native_vsync.md)
- [Image](image.md) - [Image](image.md)
- [Rawfile](rawfile.md) - [Rawfile](rawfile.md)
- [MindSpore](_mind_spore.md) - [MindSpore](_mind_spore.md)
...@@ -32,7 +35,10 @@ ...@@ -32,7 +35,10 @@
- [external_window.h](external__window_8h.md) - [external_window.h](external__window_8h.md)
- [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) - [image_pixel_map_napi.h](image__pixel__map__napi_8h.md)
- [log.h](log_8h.md) - [log.h](log_8h.md)
- [native_buffer.h](native__buffer_8h.md)
- [native_image.h](native__image_8h.md)
- [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) - [native_interface_xcomponent.h](native__interface__xcomponent_8h.md)
- [native_vsync.h](native__vsync_8h.md)
- [raw_dir.h](raw__dir_8h.md) - [raw_dir.h](raw__dir_8h.md)
- [raw_file_manager.h](raw__file__manager_8h.md) - [raw_file_manager.h](raw__file__manager_8h.md)
- [raw_file.h](raw__file_8h.md) - [raw_file.h](raw__file_8h.md)
...@@ -58,6 +64,7 @@ ...@@ -58,6 +64,7 @@
- [native_huks_type.h](native__huks__type_8h.md) - [native_huks_type.h](native__huks__type_8h.md)
- Structs - Structs
- [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) - [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)
- [OH_NativeBuffer_Config](_o_h___native_buffer___config.md)
- [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) - [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)
- [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) - [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md)
- [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) - [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md)
...@@ -65,7 +72,6 @@ ...@@ -65,7 +72,6 @@
- [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) - [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md)
- [OHExtDataHandle](_o_h_ext_data_handle.md) - [OHExtDataHandle](_o_h_ext_data_handle.md)
- [OHHDRMetaData](_o_h_h_d_r_meta_data.md) - [OHHDRMetaData](_o_h_h_d_r_meta_data.md)
- [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md)
- [OhosPixelMapInfo](_ohos_pixel_map_info.md) - [OhosPixelMapInfo](_ohos_pixel_map_info.md)
- [RawFileDescriptor](_raw_file_descriptor.md) - [RawFileDescriptor](_raw_file_descriptor.md)
- [Region](_region.md) - [Region](_region.md)
......
# NativeVsync
## Overview
The **NativeVsync** module provides the capabilities of native virtual synchronization (VSync).
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Since**
9
## Summary
### Files
| Name| Description|
| -------- | -------- |
| [native_vsync.h](native__vsync_8h.md) | Declares the functions for obtaining and using native VSync.<br>File to include: &lt;native_vsync/native_vsync.h&gt;|
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync](#oh_nativevsync) | Provides the declaration of an **OH_NativeVSync** struct. |
| (\*[OH_NativeVSync_FrameCallback](#oh_nativevsync_framecallback)) (long long timestamp, void \*data) | Defines the pointer to a VSync callback function.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync_Create](#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_destroy) ([OH_NativeVSync](#oh_nativevsync) \*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
| [OH_NativeVSync_RequestFrame](#oh_nativevsync_requestframe) ([OH_NativeVSync](#oh_nativevsync) \*nativeVsync, [OH_NativeVSync_FrameCallback](#oh_nativevsync_framecallback) callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|
## Type Description
### OH_NativeVSync
```
typedef struct OH_NativeVSync OH_NativeVSync
```
**Description**
Provides the declaration of a **OH_NativeVSync** struct.
### OH_NativeVSync_FrameCallback
```
typedef void(* OH_NativeVSync_FrameCallback) (long long timestamp, void *data)
```
**Description**
Defines the pointer to a VSync callback function.
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Parameters**
| Name| Description|
| -------- | -------- |
| timestamp | VSync timestamp.|
| data | User-defined data.|
## Function Description
### OH_NativeVSync_Create()
```
OH_NativeVSync* OH_NativeVSync_Create (const char * name, unsigned int length )
```
**Description**
Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Parameters**
| Name| Description|
| -------- | -------- |
| name | Pointer to the name that associates with an **OH_NativeVSync** instance.|
| length | Length of the name.|
**Returns**
Returns the pointer to an **OH_NativeVSync** instance.
### OH_NativeVSync_Destroy()
```
void OH_NativeVSync_Destroy (OH_NativeVSync * nativeVsync)
```
**Description**
Destroys an **OH_NativeVSync** instance.
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Parameters**
| Name| Description|
| -------- | -------- |
| nativeVsync | Pointer to an **OH_NativeVSync** instance.|
### OH_NativeVSync_RequestFrame()
```
int OH_NativeVSync_RequestFrame (OH_NativeVSync * nativeVsync, OH_NativeVSync_FrameCallback callback, void * data )
```
**Description**
Requests the next VSync signal. When the signal arrives, a callback function is invoked.
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Parameters**
| Name| Description|
| -------- | -------- |
| nativeVsync | Pointer to an **OH_NativeVSync** instance.|
| callback | Function pointer of the **OH_NativeVSync_FrameCallback** type. This function pointer will be called when the next VSync signal arrives.|
| data | Pointer to the user-defined data struct. The type is void\*.|
**Returns**
Returns **0** if the operation is successful.
# OH_NativeBuffer
## Overview
The **OH_NativeBuffer** module provides the capabilities of **NativeBuffer**. Using the functions provided by this module, you can apply for, use, and release the shared memory, and query its attributes.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Since**
9
## Summary
### Files
| Name| Description|
| -------- | -------- |
| [native_buffer.h](native__buffer_8h.md) | Declares the functions for obtaining and using **NativeBuffer**.<br>File to include: &lt;native_buffer/native_buffer.h&gt; |
### Structs
| Name| Description|
| -------- | -------- |
| [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) | Defines the **OH_NativeBuffer** attribute configuration, which is used when you apply for a new **OH_NativeBuffer** instance or query the attributes of an existing instance.|
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeBuffer](#oh_nativebuffer) | Provides the declaration of an **OH_NativeBuffer** struct.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeBuffer_Alloc](#oh_nativebuffer_alloc) (const [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) \*config) | Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.|
| [OH_NativeBuffer_Reference](#oh_nativebuffer_reference) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Increases the reference count of an **OH_NativeBuffer** instance by 1.|
| [OH_NativeBuffer_Unreference](#oh_nativebuffer_unreference) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Decreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.|
| [OH_NativeBuffer_GetConfig](#oh_nativebuffer_getconfig) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer, [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) \*config) | Obtains the attributes of an **OH_NativeBuffer** instance.|
| [OH_NativeBuffer_Map](#oh_nativebuffer_map) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer, void \*\*virAddr) | Maps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.|
| [OH_NativeBuffer_Unmap](#oh_nativebuffer_unmap) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Unmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.|
| [OH_NativeBuffer_GetSeqNum](#oh_nativebuffer_getseqnum) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Obtains the sequence number of an **OH_NativeBuffer** instance.|
## Type Description
### OH_NativeBuffer
```
typedef struct OH_NativeBuffer OH_NativeBuffer
```
**Description**
Provides the declaration of an **OH_NativeBuffer** struct.
## Function Description
### OH_NativeBuffer_Alloc()
```
OH_NativeBuffer* OH_NativeBuffer_Alloc (const OH_NativeBuffer_Config * config)
```
**Description**
Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| config | Pointer to an **OH_NativeBuffer_Config** instance.|
**Returns**
Returns the pointer to the **OH_NativeBuffer** instance created if the operation is successful; returns **NULL** otherwise.
### OH_NativeBuffer_GetConfig()
```
void OH_NativeBuffer_GetConfig (OH_NativeBuffer * buffer, OH_NativeBuffer_Config * config )
```
**Description**
Obtains the attributes of an **OH_NativeBuffer** instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
| config | Pointer to an **OH_NativeBuffer_Config** instance, which is used to receive the attributes of **OH_NativeBuffer**.|
### OH_NativeBuffer_GetSeqNum()
```
uint32_t OH_NativeBuffer_GetSeqNum (OH_NativeBuffer * buffer)
```
**Description**
Obtains the sequence number of an **OH_NativeBuffer** instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
**Returns**
Returns the unique sequence number of the **OH_NativeBuffer** instance.
### OH_NativeBuffer_Map()
```
int32_t OH_NativeBuffer_Map (OH_NativeBuffer * buffer, void ** virAddr )
```
**Description**
Maps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
| virAddr | Double pointer to the address of the virtual memory.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeBuffer_Reference()
```
int32_t OH_NativeBuffer_Reference (OH_NativeBuffer * buffer)
```
**Description**
Increases the reference count of an **OH_NativeBuffer** instance by 1.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeBuffer_Unmap()
```
int32_t OH_NativeBuffer_Unmap (OH_NativeBuffer * buffer)
```
**Description**
Unmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeBuffer_Unreference()
```
int32_t OH_NativeBuffer_Unreference (OH_NativeBuffer * buffer)
```
**Description**
Decreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
**Returns**
Returns **0** if the operation is successful.
# OH_NativeBuffer_Config
## Overview
The **OH_NativeBuffer_Config** struct defines the **OH_NativeBuffer** attribute configuration, which is used when you apply for a new **OH_NativeBuffer** instance or query the attributes of an existing instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Since**
9
**Related Modules**
[OH_NativeBuffer](_o_h___native_buffer.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| width | Width, in pixels.|
| height | Height, in pixels.|
| format | Pixel map format.|
| usage | Description of the buffer usage.|
# OH_NativeImage
## Overview
The **OH_NativeImage** module provides the capabilities of **NativeImage**. Functioning as a data consumer, it is used to associate data with the OpenGL texture. It is used in the OpenGL environment.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Since**
9
## Summary
### Files
| Name| Description|
| -------- | -------- |
| [native_image.h](native__image_8h.md) | Defines the functions for obtaining and using **NativeImage**.<br>File to include: &lt;native_image/native_image.h&gt; |
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeImage](#oh_nativeimage) | Provides the declaration of an **OH_NativeImage** struct.|
| [OHNativeWindow](#ohnativewindow) | Provides the capability of accessing the **NativeWindow**.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeImage_Create](#oh_nativeimage_create) (uint32_t textureId, uint32_t textureTarget) | Creates an **OH_NativeImage** instance to be associated with the OpenGL ES texture ID and target.|
| [OH_NativeImage_AcquireNativeWindow](#oh_nativeimage_acquirenativewindow) (OH_NativeImage \*image) | Obtains an **OHNativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **OHNativeWindow** instance when it is no longer required. |
| [OH_NativeImage_AttachContext](#oh_nativeimage_attachcontext) (OH_NativeImage \*image, uint32_t textureId) | Attaches an **OH_NativeImage** instance to the current OpenGL ES context.<br>The OpenGL ES texture will be bound to an **GL_TEXTURE_EXTERNAL_OES** instance and updated through the **OH_NativeImage** instance.|
| [OH_NativeImage_DetachContext](#oh_nativeimage_detachcontext) (OH_NativeImage \*image) | Detaches an **OH_NativeImage** instance from the current OpenGL ES context.|
| [OH_NativeImage_UpdateSurfaceImage](#oh_nativeimage_updatesurfaceimage) (OH_NativeImage \*image) | Updates the OpenGL ES texture associated with the latest frame through an **OH_NativeImage** instance.|
| [OH_NativeImage_GetTimestamp](#oh_nativeimage_gettimestamp) (OH_NativeImage*image) | Obtains the timestamp of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_GetTransformMatrix](#oh_nativeimage_gettransformmatrix) (OH_NativeImage \*image, float matrix[16]) | Obtains the transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_Destroy](#oh_nativeimage_destroy) (OH_NativeImage \*\*image) | Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**. |
## Type Description
### OH_NativeImage
```
typedef struct OH_NativeImage OH_NativeImage
```
**Description**
Provides the declaration of an **OH_NativeImage** struct.
### OHNativeWindow
```
typedef struct NativeWindow OHNativeWindow
```
**Description**
Provides the capability of accessing the **NativeWindow**.
## Function Description
### OH_NativeImage_AcquireNativeWindow()
```
OHNativeWindow* OH_NativeImage_AcquireNativeWindow (OH_NativeImage * image)
```
**Description**
Obtains an **OHNativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **OHNativeWindow** instance when it is no longer required.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
**Returns**
Returns a pointer to the **OHNativeWindow** instance if the operation is successful; returns **NULL** otherwise.
### OH_NativeImage_AttachContext()
```
int32_t OH_NativeImage_AttachContext (OH_NativeImage * image, uint32_t textureId )
```
**Description**
Attaches an **OH_NativeImage** instance to the current OpenGL ES context.
The OpenGL ES texture will be bound to an **GL_TEXTURE_EXTERNAL_OES** instance and updated through the **OH_NativeImage** instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
| textureId | ID of the OpenGL ES texture to which the **OH_NativeImage** instance is to be attached.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeImage_Create()
```
OH_NativeImage* OH_NativeImage_Create (uint32_t textureId, uint32_t textureTarget )
```
**Description**
Creates an **OH_NativeImage** instance to be associated with the OpenGL ES texture ID and target.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| textureId | OpenGL ES texture ID.|
| textureTarget | OpenGL ES texture target.|
**Returns**
Returns a pointer to the **OH_NativeImage** instance if the operation is successful; returns **NULL** otherwise.
### OH_NativeImage_Destroy()
```
void OH_NativeImage_Destroy (OH_NativeImage ** image)
```
**Description**
Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
### OH_NativeImage_DetachContext()
```
int32_t OH_NativeImage_DetachContext (OH_NativeImage * image)
```
**Description**
Detaches an **OH_NativeImage** instance from the current OpenGL ES context.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeImage_GetTimestamp()
```
int64_t OH_NativeImage_GetTimestamp (OH_NativeImage * image)
```
**Description**
Obtains the timestamp of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
**Returns**
Returns the timestamp of the texture image.
### OH_NativeImage_GetTransformMatrix()
```
int32_t OH_NativeImage_GetTransformMatrix (OH_NativeImage * image, float matrix[16] )
```
**Description**
Obtains the transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
| matrix | Buffer used to store the 4 \* 4 transform matrix obtained.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeImage_UpdateSurfaceImage()
```
int32_t OH_NativeImage_UpdateSurfaceImage (OH_NativeImage * image)
```
**Description**
Updates the OpenGL ES texture associated with the latest frame through an **OH_NativeImage** instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
**Returns**
Returns **0** if the operation is successful.
# OhosPixelMapCreateOps
## Overview
Defines the options used for creating a pixel map.
**Since:**
9
**Related Modules:**
[Image](image.md)
## Summary
### Member Variables
| Name | Description |
| -------- | -------- |
| [width](#width) | Image width, in pixels. |
| [height](#height) | Image height, in pixels. |
| [pixelFormat](#pixelformat) | Image format. |
| [editable](#editable) | Editing type of the image. |
| [alphaType](#alphatype) | Alpha type of the image. |
| [scaleMode](#scalemode) | Scale mode of the image. |
## Member Variable Description
### alphaType
```
uint32_t OhosPixelMapCreateOps::alphaType
```
**Description**<br>
Alpha type of the image.
### editable
```
uint32_t OhosPixelMapCreateOps::editable
```
**Description**<br>
Editing type of the image.
### height
```
uint32_t OhosPixelMapCreateOps::height
```
**Description**<br>
Image height, in pixels.
### pixelFormat
```
int32_t OhosPixelMapCreateOps::pixelFormat
```
**Description**<br>
Image format.
### scaleMode
```
uint32_t OhosPixelMapCreateOps::scaleMode
```
**Description**<br>
Scale mode of the image.
### width
```
uint32_t OhosPixelMapCreateOps::width
```
**Description**<br>
Image width, in pixels.
...@@ -9,6 +9,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. ...@@ -9,6 +9,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required.
**Since** **Since**
8 8
...@@ -19,7 +20,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. ...@@ -19,7 +20,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required.
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | Declares the APIs that can lock, access, and unlock a pixel map.<br>File to include:: <multimedia/image_framework/image_pixel_map_napi.h>| | [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | Declares the APIs that can lock, access, and unlock a pixel map.<br>File to include: <multimedia/image_framework/image_pixel_map_napi.h> |
### Structs ### Structs
...@@ -27,25 +28,14 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. ...@@ -27,25 +28,14 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required.
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| [OhosPixelMapInfo](_ohos_pixel_map_info.md) | Defines the pixel map information.| | [OhosPixelMapInfo](_ohos_pixel_map_info.md) | Defines the pixel map information.|
| [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) | Defines the options used for creating a pixel map.|
### Types ### Types
| Name| Description|
| -------- | -------- |
| [NativePixelMap](#nativepixelmap) | Defines the data type name of the native pixel map.|
### Enums
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| { OHOS_IMAGE_RESULT_SUCCESS = 0, OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by the functions.| | { OHOS_IMAGE_RESULT_SUCCESS = 0, OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by the functions.|
| { OHOS_PIXEL_MAP_FORMAT_NONE = 0, OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3, OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel formats.| | { OHOS_PIXEL_MAP_FORMAT_NONE = 0, OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3, OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel formats.|
| { OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0, OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1, OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2, OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 } | Enumerates the pixel map alpha types.|
| { OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE = 0, OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1 } | Enumerates the pixel map scale modes.|
| { OHOS_PIXEL_MAP_READ_ONLY = 0, OHOS_PIXEL_MAP_EDITABLE = 1 } | Enumerates the pixel map editing types.|
### Functions ### Functions
...@@ -55,44 +45,11 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. ...@@ -55,44 +45,11 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required.
| [OH_GetImageInfo](#oh_getimageinfo) (napi_env env, napi_value value, [OhosPixelMapInfo](_ohos_pixel_map_info.md) \*info) | Obtains the **PixelMap** information and stores the information to the [OhosPixelMapInfo](_ohos_pixel_map_info.md) struct.| | [OH_GetImageInfo](#oh_getimageinfo) (napi_env env, napi_value value, [OhosPixelMapInfo](_ohos_pixel_map_info.md) \*info) | Obtains the **PixelMap** information and stores the information to the [OhosPixelMapInfo](_ohos_pixel_map_info.md) struct.|
| [OH_AccessPixels](#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of a **PixelMap** object and locks the memory.| | [OH_AccessPixels](#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of a **PixelMap** object and locks the memory.|
| [OH_UnAccessPixels](#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of a **PixelMap** object. This function is used with [OH_AccessPixels](#oh_accesspixels) in pairs.| | [OH_UnAccessPixels](#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of a **PixelMap** object. This function is used with [OH_AccessPixels](#oh_accesspixels) in pairs.|
| [OH_PixelMap_CreatePixelMap](#oh_pixelmap_createpixelmap) (napi_env env, [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) info, void \*buf, size_t len, napi_value \*res) | Creates a **PixelMap** object.|
| [OH_PixelMap_CreateAlphaPixelMap](#oh_pixelmap_createalphapixelmap) (napi_env env, napi_value source, napi_value \*alpha) | Creates a **PixelMap** object that contains only alpha channel information.|
| [OH_PixelMap_InitNativePixelMap](#oh_pixelmap_initnativepixelmap) (napi_env env, napi_value source) | Initializes a **PixelMap** object.|
| [OH_PixelMap_GetBytesNumberPerRow](#oh_pixelmap_getbytesnumberperrow) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*num) | Obtains the number of bytes per row of a **PixelMap** object.|
| [OH_PixelMap_GetIsEditable](#oh_pixelmap_getiseditable) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*[editable](image__pixel__map__napi_8h.md#editable)) | Checks whether a **PixelMap** object is editable.|
| [OH_PixelMap_IsSupportAlpha](#oh_pixelmap_issupportalpha) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*alpha) | Checks whether a **PixelMap** object supports alpha channels.|
| [OH_PixelMap_SetAlphaAble](#oh_pixelmap_setalphaable) (const [NativePixelMap](#nativepixelmap) \*native, int32_t alpha) | Sets an alpha channel for a **PixelMap** object.|
| [OH_PixelMap_GetDensity](#oh_pixelmap_getdensity) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*density) | Obtains the pixel density of a **PixelMap** object.|
| [OH_PixelMap_SetDensity](#oh_pixelmap_setdensity) (const [NativePixelMap](#nativepixelmap) \*native, int32_t density) | Sets the pixel density for a **PixelMap** object.|
| [OH_PixelMap_SetOpacity](#oh_pixelmap_setopacity) (const [NativePixelMap](#nativepixelmap) \*native, float opacity) | Sets the opacity for a **PixelMap** object.|
| [OH_PixelMap_Scale](#oh_pixelmap_scale) (const [NativePixelMap](#nativepixelmap) \*native, float x, float y) | Scales a **PixelMap** object.|
| [OH_PixelMap_Translate](#oh_pixelmap_translate) (const [NativePixelMap](#nativepixelmap) \*native, float x, float y) | Translates a **PixelMap** object.|
| [OH_PixelMap_Rotate](#oh_pixelmap_rotate) (const [NativePixelMap](#nativepixelmap) \*native, float angle) | Rotates a **PixelMap** object.|
| [OH_PixelMap_Flip](#oh_pixelmap_flip) (const [NativePixelMap](#nativepixelmap) \*native, int32_t x, int32_t y) | Flips a **PixelMap** object.|
| [OH_PixelMap_Crop](#oh_pixelmap_crop) (const [NativePixelMap](#nativepixelmap) \*native, int32_t x, int32_t y, int32_t [width](image__pixel__map__napi_8h.md#width), int32_t [height](image__pixel__map__napi_8h.md#height)) | Crops a **PixelMap** object.|
## Type Description ## Type Description
### NativePixelMap
```
typedef struct NativePixelMap
```
**Description**
Defines the data type name of the native pixel map.
**Since**
9
## Enum Description
### anonymous enum ### anonymous enum
...@@ -132,68 +89,7 @@ Enumerates the pixel formats. ...@@ -132,68 +89,7 @@ Enumerates the pixel formats.
8 8
### anonymous enum ## anonymous enum
```
anonymous enum
```
**Description**
Enumerates the pixel map alpha types.
| Value| Description|
| -------- | -------- |
| OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN| Unknown format.|
| OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE| Opaque format.|
| OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL| Premultiplied format.|
| OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL| Unpremultiplied format.|
**Since**
9
### anonymous enum
```
anonymous enum
```
**Description**
Enumerates the pixel map scale modes.
| Value| Description|
| -------- | -------- |
| OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE| Adaptation to the target image size.|
| OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP| Cropping the center portion of an image to the target size.|
**Since**
9
### anonymous enum
```
anonymous enum
```
**Description**
Enumerates the pixel map editing types.
| Value| Description|
| -------- | -------- |
| OHOS_PIXEL_MAP_READ_ONLY| Read-only.|
| OHOS_PIXEL_MAP_EDITABLE| Editable.|
**Since**
9
## Function Description
### OH_AccessPixels() ### OH_AccessPixels()
...@@ -258,467 +154,6 @@ Returns **0** if the information is obtained and stored successfully; returns an ...@@ -258,467 +154,6 @@ Returns **0** if the information is obtained and stored successfully; returns an
8 8
### OH_PixelMap_CreateAlphaPixelMap()
```
int32_t OH_PixelMap_CreateAlphaPixelMap (napi_env env, napi_value source, napi_value * alpha )
```
**Description**
Creates a **PixelMap** object that contains only alpha channel information.
**Parameters**
| Name| Description|
| -------- | -------- |
| env | Indicates the NAPI environment pointer.|
| source | Indicates the options for setting the **PixelMap** object.|
| alpha | Indicates the pointer to the alpha channel.|
**Returns**
Returns a **PixelMap** object if the operation is successful; returns an error code otherwise.
**See**
CreateAlphaPixelMap
**Since**
9
### OH_PixelMap_CreatePixelMap()
```
int32_t OH_PixelMap_CreatePixelMap (napi_env env, OhosPixelMapCreateOps info, void * buf, size_t len, napi_value * res )
```
**Description**
Creates a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| env | Indicates the NAPI environment pointer.|
| info | Indicates the options for setting the **PixelMap** object.|
| buf | Indicates the pointer to the buffer of the image.|
| len | Indicates the image size.|
| res | Indicates the pointer to the **PixelMap** object at the application layer.|
**Returns**
Returns a **PixelMap** object if the operation is successful; returns an error code otherwise.
**See**
CreatePixelMap
**Since**
9
### OH_PixelMap_Crop()
```
int32_t OH_PixelMap_Crop (const NativePixelMap * native, int32_t x, int32_t y, int32_t width, int32_t height )
```
**Description**
Crops a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| x | Indicates the x-coordinate of the upper left corner of the target image.|
| y | Indicates the y-coordinate of the upper left corner of the target image.|
| width | Indicates the width of the cropped region.|
| height | Indicates the height of the cropped region.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Crop
**Since**
9
### OH_PixelMap_Flip()
```
int32_t OH_PixelMap_Flip (const NativePixelMap * native, int32_t x, int32_t y )
```
**Description**
Flips a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| x | Specifies whether to flip around the x axis.|
| y | Specifies whether to flip around the y axis.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Flip
**Since**
9
### OH_PixelMap_GetBytesNumberPerRow()
```
int32_t OH_PixelMap_GetBytesNumberPerRow (const NativePixelMap * native, int32_t * num )
```
**Description**
Obtains the number of bytes per row of a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| num | Indicates the pointer to the number of bytes per row of the **PixelMap** object.|
**Returns**
Returns the number of bytes per row of the **PixelMap** object if the operation is successful; returns an error code otherwise.
**See**
GetBytesNumberPerRow
**Since**
9
### OH_PixelMap_GetDensity()
```
int32_t OH_PixelMap_GetDensity (const NativePixelMap * native, int32_t * density )
```
**Description**
Obtains the pixel density of a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| density | Indicates the pointer to the pixel density.|
**Returns**
Returns the pixel density if the operation is successful; returns an error code otherwise.
**See**
GetDensity
**Since**
9
### OH_PixelMap_GetIsEditable()
```
int32_t OH_PixelMap_GetIsEditable (const NativePixelMap * native, int32_t * editable )
```
**Description**
Checks whether a **PixelMap** object is editable.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| editable | Indicates the pointer to the editing type of the **PixelMap** object.|
**Returns**
Returns an enumerated value that indicates the editing type of the **PixelMap** object if the operation is successful; returns an error code otherwise.
**See**
GetIsEditable
**Since**
9
### OH_PixelMap_InitNativePixelMap()
```
NativePixelMap* OH_PixelMap_InitNativePixelMap (napi_env env, napi_value source )
```
**Description**
Initializes a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| env | Indicates the NAPI environment pointer.|
| source | Indicates the options for setting the **PixelMap** object.|
**Returns**
Returns a pointer to the **NativePixelMap** object if the operation is successful; returns an error code otherwise.
**See**
InitNativePixelMap
**Since**
9
### OH_PixelMap_IsSupportAlpha()
```
int32_t OH_PixelMap_IsSupportAlpha (const NativePixelMap * native, int32_t * alpha )
```
**Description**
Checks whether a **PixelMap** object supports alpha channels.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| alpha | Indicates the pointer to the support for alpha channels.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
IsSupportAlpha
**Since**
9
### OH_PixelMap_Rotate()
```
int32_t OH_PixelMap_Rotate (const NativePixelMap * native, float angle )
```
**Description**
Rotates a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| angle | Indicates the angle to rotate.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Rotate
**Since**
9
### OH_PixelMap_Scale()
```
int32_t OH_PixelMap_Scale (const NativePixelMap * native, float x, float y )
```
**Description**
Scales a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| x | Indicates the scaling ratio of the width.|
| y | Indicates the scaling ratio of the height.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Scale
**Since**
9
### OH_PixelMap_SetAlphaAble()
```
int32_t OH_PixelMap_SetAlphaAble (const NativePixelMap * native, int32_t alpha )
```
**Description**
Sets an alpha channel for a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| alpha | Indicates the alpha channel to set.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
SetAlphaAble
**Since**
9
### OH_PixelMap_SetDensity()
```
int32_t OH_PixelMap_SetDensity (const NativePixelMap * native, int32_t density )
```
**Description**
Sets the pixel density for a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| density | Indicates the pixel density to set.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
GetDensity
**Since**
9
### OH_PixelMap_SetOpacity()
```
int32_t OH_PixelMap_SetOpacity (const NativePixelMap * native, float opacity )
```
**Description**
Sets the opacity for a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| opacity | Indicates the opacity to set.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
SetOpacity
**Since**
9
### OH_PixelMap_Translate()
```
int32_t OH_PixelMap_Translate (const NativePixelMap * native, float x, float y )
```
**Description**
Translates a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| x | Indicates the horizontal distance to translate.|
| y | Indicates the vertical distance to translate.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Translate
**Since**
9
### OH_UnAccessPixels() ### OH_UnAccessPixels()
...@@ -746,4 +181,5 @@ AccessPixels ...@@ -746,4 +181,5 @@ AccessPixels
**Since** **Since**
8 8
\ No newline at end of file
...@@ -21,13 +21,7 @@ Declares the APIs that can lock, access, and unlock pixel map data. ...@@ -21,13 +21,7 @@ Declares the APIs that can lock, access, and unlock pixel map data.
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| [OhosPixelMapInfo](_ohos_pixel_map_info.md) | Defines the pixel map information. | | [OhosPixelMapInfo](_ohos_pixel_map_info.md) | Defines the pixel map information. |
| [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) |Defines the options used for creating a pixel map. |
### Types
| Name | Description |
| -------- | -------- |
| [NativePixelMap](image.md#nativepixelmap) | Defines the data type name of the native pixel map. |
### Enums ### Enums
...@@ -35,9 +29,6 @@ Declares the APIs that can lock, access, and unlock pixel map data. ...@@ -35,9 +29,6 @@ Declares the APIs that can lock, access, and unlock pixel map data.
| -------- | -------- | | -------- | -------- |
| { OHOS_IMAGE_RESULT_SUCCESS = 0, OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by a function. | | { OHOS_IMAGE_RESULT_SUCCESS = 0, OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by a function. |
| { OHOS_PIXEL_MAP_FORMAT_NONE = 0, OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3, OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel formats. | | { OHOS_PIXEL_MAP_FORMAT_NONE = 0, OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3, OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel formats. |
| { OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0, OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1, OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2, OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 } | Enumerates the pixel map alpha types. |
| { OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE = 0, OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1 } | Enumerates the pixel map scale modes. |
| { OHOS_PIXEL_MAP_READ_ONLY = 0, OHOS_PIXEL_MAP_EDITABLE = 1 } | Enumerates the pixel map editing types. |
### Functions ### Functions
...@@ -48,77 +39,3 @@ Declares the APIs that can lock, access, and unlock pixel map data. ...@@ -48,77 +39,3 @@ Declares the APIs that can lock, access, and unlock pixel map data.
| [OH_AccessPixels](image.md#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of the **PixelMap** object data and locks the memory. | | [OH_AccessPixels](image.md#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of the **PixelMap** object data and locks the memory. |
| [OH_UnAccessPixels](image.md#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of the **PixelMap** object data. This function is used with [OH_AccessPixels](image.md#oh_accesspixels) in pairs. | | [OH_UnAccessPixels](image.md#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of the **PixelMap** object data. This function is used with [OH_AccessPixels](image.md#oh_accesspixels) in pairs. |
### Variables
| Name | Description |
| -------- | -------- |
| [width](#width) | Image width, in pixels. |
| [height](#height) | Image height, in pixels. |
| [pixelFormat](#pixelformat) | Image format. |
| [editable](#editable) | Editing type of the image. |
| [alphaType](#alphatype) | Alpha type of the image. |
| [scaleMode](#scalemode) | Scale mode of the image. |
## Variable Description
### alphaType
```
uint32_t alphaType
```
**Description:**
Alpha type of the image.
### editable
```
uint32_t editable
```
**Description:**
Editing type of the image.
### height
```
uint32_t height
```
**Description:**
Image height, in pixels.
### pixelFormat
```
int32_t pixelFormat
```
**Description:**
Image format.
### scaleMode
```
uint32_t scaleMode
```
**Description:**
Scale mode of the image.
### width
```
uint32_t width
```
**Description:**
Image width, in pixels.
# native_buffer.h
## Overview
The **native_buffer.h** file declares the functions for obtaining and using **NativeBuffer**.
**Since**
9
**Related Modules**
[OH_NativeBuffer](_o_h___native_buffer.md)
## Summary
### Structs
| Name| Description:|
| -------- | -------- |
| [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) | Defines the **OH_NativeBuffer** attribute configuration, which is used when you apply for a new **OH_NativeBuffer** instance or query the attributes of an existing instance.|
### Types
| Name| Description:|
| -------- | -------- |
| [OH_NativeBuffer](_o_h___native_buffer.md#oh_nativebuffer) | Provides the declaration of an **OH_NativeBuffer** struct.|
### Functions
| Name| Description:|
| -------- | -------- |
| [OH_NativeBuffer_Alloc](_o_h___native_buffer.md#oh_nativebuffer_alloc) (const OH_NativeBuffer_Config \*config) | Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.|
| [OH_NativeBuffer_Reference](_o_h___native_buffer.md#oh_nativebuffer_reference) (OH_NativeBuffer \*buffer) | Increases the reference count of an **OH_NativeBuffer** instance by 1.|
| [OH_NativeBuffer_Unreference](_o_h___native_buffer.md#oh_nativebuffer_unreference) (OH_NativeBuffer \*buffer) | Decreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.|
| [OH_NativeBuffer_GetConfig](_o_h___native_buffer.md#oh_nativebuffer_getconfig) (OH_NativeBuffer \*buffer, OH_NativeBuffer_Config \*config) | Obtains the attributes of an **OH_NativeBuffer** instance.|
| [OH_NativeBuffer_Map](_o_h___native_buffer.md#oh_nativebuffer_map) (OH_NativeBuffer \*buffer, void \*\*virAddr) | Maps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.|
| [OH_NativeBuffer_Unmap](_o_h___native_buffer.md#oh_nativebuffer_unmap) (OH_NativeBuffer \*buffer) | Unmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.|
| [OH_NativeBuffer_GetSeqNum](_o_h___native_buffer.md#oh_nativebuffer_getseqnum) (OH_NativeBuffer \*buffer) | Obtains the sequence number of an **OH_NativeBuffer** instance.|
# native_image.h
## Overview
The **native_image.h** file declares the functions for obtaining and using **NativeImage**.
**Since**
9
**Related Modules**
[OH_NativeImage](_o_h___native_image.md)
## Summary
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeImage](_o_h___native_image.md#oh_nativeimage) | Provides the declaration of an **OH_NativeImage** struct.|
| [OHNativeWindow](_o_h___native_image.md#ohnativewindow) | Provides the capability of accessing the **NativeWindow**.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeImage_Create](_o_h___native_image.md#oh_nativeimage_create) (uint32_t textureId, uint32_t textureTarget) | Creates an **OH_NativeImage** instance to be associated with the OpenGL ES texture ID and target.|
| [OH_NativeImage_AcquireNativeWindow](_o_h___native_image.md#oh_nativeimage_acquirenativewindow) (OH_NativeImage \*image) | Obtains an **OHNativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **OHNativeWindow** instance when it is no longer required. |
| [OH_NativeImage_AttachContext](_o_h___native_image.md#oh_nativeimage_attachcontext) (OH_NativeImage \*image, uint32_t textureId) | Attaches an **OH_NativeImage** instance to the current OpenGL ES context.<br>The OpenGL ES texture will be bound to an **GL_TEXTURE_EXTERNAL_OES** instance and updated through the **OH_NativeImage** instance.|
| [OH_NativeImage_DetachContext](_o_h___native_image.md#oh_nativeimage_detachcontext) (OH_NativeImage \*image) | Detaches an **OH_NativeImage** instance from the current OpenGL ES context.|
| [OH_NativeImage_UpdateSurfaceImage](_o_h___native_image.md#oh_nativeimage_updatesurfaceimage) (OH_NativeImage \*image) | Updates the OpenGL ES texture associated with the latest frame through an **OH_NativeImage** instance.|
| [OH_NativeImage_GetTimestamp](_o_h___native_image.md#oh_nativeimage_gettimestamp) (OH_NativeImage \*image) | Obtains the timestamp of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_GetTransformMatrix](_o_h___native_image.md#oh_nativeimage_gettransformmatrix) (OH_NativeImage \*image, float matrix[16]) | Obtains the transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_Destroy](_o_h___native_image.md#oh_nativeimage_destroy) (OH_NativeImage \*\*image) | Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**. |
# native_vsync.h
## Overview
The **native_vsync.h** file declares the functions for obtaining and using native virtual synchronization (VSync).
**Since**
9
**Related Modules**
[NativeVsync](_native_vsync.md)
## Summary
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync](_native_vsync.md#oh_nativevsync) | Provides the declaration of an **OH_NativeVSync** struct. |
| (\*[OH_NativeVSync_FrameCallback](_native_vsync.md#oh_nativevsync_framecallback)) (long long timestamp, void \*data) | Defines the pointer to a VSync callback function.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync_Create](_native_vsync.md#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](_native_vsync.md#oh_nativevsync_destroy) (OH_NativeVSync \*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
| [OH_NativeVSync_RequestFrame](_native_vsync.md#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.|
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册