1e41f4b71Sopenharmony_ci# OH_NativeBuffer
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## Overview
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThe **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.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci**Since**: 9
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci## Summary
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci### Files
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci| Name| Description| 
18e41f4b71Sopenharmony_ci| -------- | -------- |
19e41f4b71Sopenharmony_ci| [native_buffer.h](native__buffer_8h.md) | Declares the functions for obtaining and using **NativeBuffer**.| 
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci### Structs
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci| Name| Description| 
25e41f4b71Sopenharmony_ci| -------- | -------- |
26e41f4b71Sopenharmony_ci| struct  [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) | Describes 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.| 
27e41f4b71Sopenharmony_ci| struct  [OH_NativeBuffer_Plane](_o_h___native_buffer___plane.md) | Describes the plane information of an image.| 
28e41f4b71Sopenharmony_ci| struct  [OH_NativeBuffer_Planes](_o_h___native_buffer___planes.md) | Describes the plane information of images in an **OH_NativeBuffer** instance.| 
29e41f4b71Sopenharmony_ci| struct  [OH_NativeBuffer_ColorXY](_o_h___native_buffer___color_x_y.md) | Describes the X and Y coordinates of the primary color.| 
30e41f4b71Sopenharmony_ci| struct  [OH_NativeBuffer_Smpte2086](_o_h___native_buffer___smpte2086.md) | Describes the SMPTE ST 2086 static metadata.| 
31e41f4b71Sopenharmony_ci| struct  [OH_NativeBuffer_Cta861](_o_h___native_buffer___cta861.md) | Describes the CTA-861.3 static metadata.| 
32e41f4b71Sopenharmony_ci| struct  [OH_NativeBuffer_StaticMetadata](_o_h___native_buffer___static_metadata.md) | Describes the HDR static metadata.| 
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci### Types
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci| Name| Description| 
38e41f4b71Sopenharmony_ci| -------- | -------- |
39e41f4b71Sopenharmony_ci| typedef struct [OH_NativeBuffer](#oh_nativebuffer)  [OH_NativeBuffer](#oh_nativebuffer) | Provides the declaration of an **OH_NativeBuffer** struct.| 
40e41f4b71Sopenharmony_ci| typedef enum [OH_NativeBuffer_Usage](#oh_nativebuffer_usage)  [OH_NativeBuffer_Usage](#oh_nativebuffer_usage) | Defines an enum for the **OH_NativeBuffer** usages.| 
41e41f4b71Sopenharmony_ci| typedef enum [OH_NativeBuffer_Format](#oh_nativebuffer_format)  [OH_NativeBuffer_Format](#oh_nativebuffer_format) | Defines an enum for the **OH_NativeBuffer** formats.| 
42e41f4b71Sopenharmony_ci| typedef enum [OH_NativeBuffer_ColorSpace](#oh_nativebuffer_colorspace)  [OH_NativeBuffer_ColorSpace](#oh_nativebuffer_colorspace) | Defines an enum for the color spaces of an **OH_NativeBuffer** instance.| 
43e41f4b71Sopenharmony_ci| typedef enum [OH_NativeBuffer_TransformType](#oh_nativebuffer_transformtype)  [OH_NativeBuffer_TransformType](#oh_nativebuffer_transformtype) | Defines an enum for the transform types of an **OH_NativeBuffer** instance.| 
44e41f4b71Sopenharmony_ci| typedef enum [OH_NativeBuffer_ColorGamut](#oh_nativebuffer_colorgamut)  [OH_NativeBuffer_ColorGamut](#oh_nativebuffer_colorgamut) | Defines an enum for the color gamuts of an **OH_NativeBuffer** instance.| 
45e41f4b71Sopenharmony_ci| typedef enum [OHNativeErrorCode](_native_window.md#ohnativeerrorcode)  [OHNativeErrorCode](#ohnativeerrorcode) | Defines an enum for the error codes.| 
46e41f4b71Sopenharmony_ci| typedef struct [OH_NativeBuffer_Config](_o_h___native_buffer___config.md)  [OH_NativeBuffer_Config](#oh_nativebuffer_config) | 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.| 
47e41f4b71Sopenharmony_ci| typedef struct [OH_NativeBuffer_Plane](_o_h___native_buffer___plane.md)  [OH_NativeBuffer_Plane](#oh_nativebuffer_plane) | Defines a struct for the plane information of an image.| 
48e41f4b71Sopenharmony_ci| typedef struct [OH_NativeBuffer_Planes](_o_h___native_buffer___planes.md)  [OH_NativeBuffer_Planes](#oh_nativebuffer_planes) | Defines a struct for the plane information of images in an **OH_NativeBuffer** instance.| 
49e41f4b71Sopenharmony_ci| typedef enum [OH_NativeBuffer_MetadataType](#oh_nativebuffer_metadatatype)  [OH_NativeBuffer_MetadataType](#oh_nativebuffer_metadatatype) | Defines an enum for the **OH_NativeBuffer** image standards.| 
50e41f4b71Sopenharmony_ci| typedef struct [OH_NativeBuffer_ColorXY](_o_h___native_buffer___color_x_y.md)  [OH_NativeBuffer_ColorXY](#oh_nativebuffer_colorxy) | Defines a struct for the X and Y coordinates of the primary color.| 
51e41f4b71Sopenharmony_ci| typedef struct [OH_NativeBuffer_Smpte2086](_o_h___native_buffer___smpte2086.md)  [OH_NativeBuffer_Smpte2086](#oh_nativebuffer_smpte2086) | Defines a struct for the SMPTE ST 2086 static metadata.| 
52e41f4b71Sopenharmony_ci| typedef struct [OH_NativeBuffer_Cta861](_o_h___native_buffer___cta861.md)  [OH_NativeBuffer_Cta861](#oh_nativebuffer_cta861) | Defines a struct for the CTA-861.3 static metadata.| 
53e41f4b71Sopenharmony_ci| typedef struct [OH_NativeBuffer_StaticMetadata](_o_h___native_buffer___static_metadata.md)  [OH_NativeBuffer_StaticMetadata](#oh_nativebuffer_staticmetadata) | Defines a struct for the HDR static metadata.| 
54e41f4b71Sopenharmony_ci| typedef enum [OH_NativeBuffer_MetadataKey](#oh_nativebuffer_metadatakey)  [OH_NativeBuffer_MetadataKey](#oh_nativebuffer_metadatakey) | Defines an enum for the keys that specify the HDR metadata of an **OH_NativeBuffer** instance.| 
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci### Enums
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci| Name| Description| 
60e41f4b71Sopenharmony_ci| -------- | -------- |
61e41f4b71Sopenharmony_ci| [OH_NativeBuffer_Usage](#oh_nativebuffer_usage-1) {<br>NATIVEBUFFER_USAGE_CPU_READ = (1ULL &lt;&lt; 0), NATIVEBUFFER_USAGE_CPU_WRITE = (1ULL &lt;&lt; 1), NATIVEBUFFER_USAGE_MEM_DMA = (1ULL &lt;&lt; 3), NATIVEBUFFER_USAGE_HW_RENDER = (1ULL &lt;&lt; 8),<br>NATIVEBUFFER_USAGE_HW_TEXTURE = (1ULL &lt;&lt; 9), NATIVEBUFFER_USAGE_CPU_READ_OFTEN = (1ULL &lt;&lt; 16), NATIVEBUFFER_USAGE_ALIGNMENT_512 = (1ULL &lt;&lt; 18)<br>} | Enumerates the **OH_NativeBuffer** usages.| 
62e41f4b71Sopenharmony_ci| [OH_NativeBuffer_Format](#oh_nativebuffer_format-1) {<br>NATIVEBUFFER_PIXEL_FMT_CLUT8 = 0, NATIVEBUFFER_PIXEL_FMT_CLUT1, NATIVEBUFFER_PIXEL_FMT_CLUT4, NATIVEBUFFER_PIXEL_FMT_RGB_565 = 3,<br>NATIVEBUFFER_PIXEL_FMT_RGBA_5658, NATIVEBUFFER_PIXEL_FMT_RGBX_4444, NATIVEBUFFER_PIXEL_FMT_RGBA_4444, NATIVEBUFFER_PIXEL_FMT_RGB_444,<br>NATIVEBUFFER_PIXEL_FMT_RGBX_5551, NATIVEBUFFER_PIXEL_FMT_RGBA_5551, NATIVEBUFFER_PIXEL_FMT_RGB_555, NATIVEBUFFER_PIXEL_FMT_RGBX_8888,<br>NATIVEBUFFER_PIXEL_FMT_RGBA_8888, NATIVEBUFFER_PIXEL_FMT_RGB_888, NATIVEBUFFER_PIXEL_FMT_BGR_565, NATIVEBUFFER_PIXEL_FMT_BGRX_4444,<br>NATIVEBUFFER_PIXEL_FMT_BGRA_4444, NATIVEBUFFER_PIXEL_FMT_BGRX_5551, NATIVEBUFFER_PIXEL_FMT_BGRA_5551, NATIVEBUFFER_PIXEL_FMT_BGRX_8888,<br>NATIVEBUFFER_PIXEL_FMT_BGRA_8888, NATIVEBUFFER_PIXEL_FMT_YUV_422_I, NATIVEBUFFER_PIXEL_FMT_YCBCR_422_SP, NATIVEBUFFER_PIXEL_FMT_YCRCB_422_SP,<br>NATIVEBUFFER_PIXEL_FMT_YCBCR_420_SP, NATIVEBUFFER_PIXEL_FMT_YCRCB_420_SP, NATIVEBUFFER_PIXEL_FMT_YCBCR_422_P, NATIVEBUFFER_PIXEL_FMT_YCRCB_422_P,<br>NATIVEBUFFER_PIXEL_FMT_YCBCR_420_P, NATIVEBUFFER_PIXEL_FMT_YCRCB_420_P, NATIVEBUFFER_PIXEL_FMT_YUYV_422_PKG, NATIVEBUFFER_PIXEL_FMT_UYVY_422_PKG,<br>NATIVEBUFFER_PIXEL_FMT_YVYU_422_PKG, NATIVEBUFFER_PIXEL_FMT_VYUY_422_PKG, NATIVEBUFFER_PIXEL_FMT_RGBA_1010102, NATIVEBUFFER_PIXEL_FMT_YCBCR_P010,<br>NATIVEBUFFER_PIXEL_FMT_YCRCB_P010, NATIVEBUFFER_PIXEL_FMT_RAW10, NATIVEBUFFER_PIXEL_FMT_VENDER_MASK = 0X7FFF0000, NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF<br>} | Enumerates the **OH_NativeBuffer** formats.| 
63e41f4b71Sopenharmony_ci| [OH_NativeBuffer_ColorSpace](#oh_nativebuffer_colorspace-1) {<br>OH_COLORSPACE_NONE, OH_COLORSPACE_BT601_EBU_FULL, OH_COLORSPACE_BT601_SMPTE_C_FULL, OH_COLORSPACE_BT709_FULL,<br>OH_COLORSPACE_BT2020_HLG_FULL, OH_COLORSPACE_BT2020_PQ_FULL, OH_COLORSPACE_BT601_EBU_LIMIT, OH_COLORSPACE_BT601_SMPTE_C_LIMIT,<br>OH_COLORSPACE_BT709_LIMIT, OH_COLORSPACE_BT2020_HLG_LIMIT, OH_COLORSPACE_BT2020_PQ_LIMIT, OH_COLORSPACE_SRGB_FULL,<br>OH_COLORSPACE_P3_FULL, OH_COLORSPACE_P3_HLG_FULL, OH_COLORSPACE_P3_PQ_FULL, OH_COLORSPACE_ADOBERGB_FULL,<br>OH_COLORSPACE_SRGB_LIMIT, OH_COLORSPACE_P3_LIMIT, OH_COLORSPACE_P3_HLG_LIMIT, OH_COLORSPACE_P3_PQ_LIMIT,<br>OH_COLORSPACE_ADOBERGB_LIMIT, OH_COLORSPACE_LINEAR_SRGB, OH_COLORSPACE_LINEAR_BT709, OH_COLORSPACE_LINEAR_P3,<br>OH_COLORSPACE_LINEAR_BT2020, OH_COLORSPACE_DISPLAY_SRGB, OH_COLORSPACE_DISPLAY_P3_SRGB, OH_COLORSPACE_DISPLAY_P3_HLG,<br>OH_COLORSPACE_DISPLAY_P3_PQ, OH_COLORSPACE_DISPLAY_BT2020_SRGB, OH_COLORSPACE_DISPLAY_BT2020_HLG, OH_COLORSPACE_DISPLAY_BT2020_PQ<br>} | Enumerates the color spaces of an **OH_NativeBuffer** instance.| 
64e41f4b71Sopenharmony_ci| [OH_NativeBuffer_TransformType](#oh_nativebuffer_transformtype-1) {<br>NATIVEBUFFER_ROTATE_NONE = 0, NATIVEBUFFER_ROTATE_90, NATIVEBUFFER_ROTATE_180, NATIVEBUFFER_ROTATE_270,<br>NATIVEBUFFER_FLIP_H, NATIVEBUFFER_FLIP_V, NATIVEBUFFER_FLIP_H_ROT90, NATIVEBUFFER_FLIP_V_ROT90,<br>NATIVEBUFFER_FLIP_H_ROT180, NATIVEBUFFER_FLIP_V_ROT180, NATIVEBUFFER_FLIP_H_ROT270, NATIVEBUFFER_FLIP_V_ROT270<br>} | Enumerates the transform types of an **OH_NativeBuffer** instance.| 
65e41f4b71Sopenharmony_ci| [OH_NativeBuffer_ColorGamut](#oh_nativebuffer_colorgamut-1) {<br>NATIVEBUFFER_COLOR_GAMUT_NATIVE = 0, NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT601 = 1, NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT709 = 2, NATIVEBUFFER_COLOR_GAMUT_DCI_P3 = 3,<br>NATIVEBUFFER_COLOR_GAMUT_SRGB = 4, NATIVEBUFFER_COLOR_GAMUT_ADOBE_RGB = 5, NATIVEBUFFER_COLOR_GAMUT_DISPLAY_P3 = 6, NATIVEBUFFER_COLOR_GAMUT_BT2020 = 7,<br>NATIVEBUFFER_COLOR_GAMUT_BT2100_PQ = 8, NATIVEBUFFER_COLOR_GAMUT_BT2100_HLG = 9, NATIVEBUFFER_COLOR_GAMUT_DISPLAY_BT2020 = 10<br>} | Enumerates the color gamuts of an **OH_NativeBuffer** instance.| 
66e41f4b71Sopenharmony_ci| [OHNativeErrorCode](#ohnativeerrorcode-1) {<br>NATIVE_ERROR_OK = 0, NATIVE_ERROR_INVALID_ARGUMENTS = 40001000, NATIVE_ERROR_NO_PERMISSION = 40301000, NATIVE_ERROR_NO_BUFFER = 40601000,<br>NATIVE_ERROR_NO_CONSUMER = 41202000, NATIVE_ERROR_NOT_INIT = 41203000, NATIVE_ERROR_CONSUMER_CONNECTED = 41206000, NATIVE_ERROR_BUFFER_STATE_INVALID = 41207000,<br>NATIVE_ERROR_BUFFER_IN_CACHE = 41208000, NATIVE_ERROR_BUFFER_QUEUE_FULL = 41209000, NATIVE_ERROR_BUFFER_NOT_IN_CACHE = 41210000,NATIVE_ERROR_CONSUMER_DISCONNECTED = 41211000,NATIVE_ERROR_CONSUMER_NO_LISTENER_REGISTERED = 41212000, NATIVE_ERROR_UNSUPPORTED = 50102000,<br>NATIVE_ERROR_UNKNOWN = 50002000,NATIVE_ERROR_HDI_ERROR = 50007000,NATIVE_ERROR_BINDER_ERROR = 50401000, NATIVE_ERROR_EGL_STATE_UNKNOWN = 60001000, NATIVE_ERROR_EGL_API_FAILED = 60002000<br>} | Enumerates the error codes. | 
67e41f4b71Sopenharmony_ci| [OH_NativeBuffer_MetadataType](#oh_nativebuffer_metadatatype-1) { OH_VIDEO_HDR_HLG, OH_VIDEO_HDR_HDR10, OH_VIDEO_HDR_VIVID } | Enumerates the **OH_NativeBuffer** image standards.| 
68e41f4b71Sopenharmony_ci| [OH_NativeBuffer_MetadataKey](#oh_nativebuffer_metadatakey-1) { OH_HDR_METADATA_TYPE, OH_HDR_STATIC_METADATA, OH_HDR_DYNAMIC_METADATA } | Enumerates the keys that specify the HDR metadata of an **OH_NativeBuffer** instance.| 
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci### Functions
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci| Name| Description| 
74e41f4b71Sopenharmony_ci| -------- | -------- |
75e41f4b71Sopenharmony_ci| [OH_NativeBuffer](#oh_nativebuffer) \* [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.| 
76e41f4b71Sopenharmony_ci| int32_t [OH_NativeBuffer_Reference](#oh_nativebuffer_reference) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Increases the reference count of an **OH_NativeBuffer** instance by 1.| 
77e41f4b71Sopenharmony_ci| int32_t [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.| 
78e41f4b71Sopenharmony_ci| void [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.| 
79e41f4b71Sopenharmony_ci| int32_t [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.| 
80e41f4b71Sopenharmony_ci| int32_t [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.| 
81e41f4b71Sopenharmony_ci| uint32_t [OH_NativeBuffer_GetSeqNum](#oh_nativebuffer_getseqnum) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Obtains the sequence number of an **OH_NativeBuffer** instance.| 
82e41f4b71Sopenharmony_ci| int32_t [OH_NativeBuffer_SetColorSpace](#oh_nativebuffer_setcolorspace) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer, [OH_NativeBuffer_ColorSpace](#oh_nativebuffer_colorspace) colorSpace) | Sets the color space for an **OH_NativeBuffer** instance.| 
83e41f4b71Sopenharmony_ci| int32_t [OH_NativeBuffer_MapPlanes](#oh_nativebuffer_mapplanes) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer, void \*\*virAddr, [OH_NativeBuffer_Planes](_o_h___native_buffer___planes.md) \*outPlanes) | Maps the multi-channel ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.| 
84e41f4b71Sopenharmony_ci| int32_t [OH_NativeBuffer_FromNativeWindowBuffer](#oh_nativebuffer_fromnativewindowbuffer) ([OHNativeWindowBuffer](_native_window.md#ohnativewindowbuffer) \*nativeWindowBuffer, [OH_NativeBuffer](#oh_nativebuffer) \*\*buffer) | Converts an **OHNativeWindowBuffer** instance to an **OH_NativeBuffer** instance.| 
85e41f4b71Sopenharmony_ci| int32_t [OH_NativeBuffer_GetColorSpace](#oh_nativebuffer_getcolorspace) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer, [OH_NativeBuffer_ColorSpace](#oh_nativebuffer_colorspace) \*colorSpace) | Obtains the color space of an **OH_NativeBuffer** instance.| 
86e41f4b71Sopenharmony_ci| int32_t [OH_NativeBuffer_SetMetadataValue](#oh_nativebuffer_setmetadatavalue) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer, [OH_NativeBuffer_MetadataKey](#oh_nativebuffer_metadatakey) metadataKey, int32_t size, uint8_t \*metaData) | Sets a metadata value for an **OH_NativeBuffer** instance.| 
87e41f4b71Sopenharmony_ci| int32_t [OH_NativeBuffer_GetMetadataValue](#oh_nativebuffer_getmetadatavalue) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer, [OH_NativeBuffer_MetadataKey](#oh_nativebuffer_metadatakey) metadataKey, int32_t \*size, uint8_t \*\*metaData) | Obtains the metadata value of an **OH_NativeBuffer** instance.| 
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci
90e41f4b71Sopenharmony_ci## Type Description
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci### OH_NativeBuffer
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci```
96e41f4b71Sopenharmony_citypedef struct OH_NativeBuffer OH_NativeBuffer
97e41f4b71Sopenharmony_ci```
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci**Description**
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ciProvides the declaration of an **OH_NativeBuffer** struct.
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci**Since**: 9
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci### OH_NativeBuffer_ColorGamut
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci```
109e41f4b71Sopenharmony_citypedef enum OH_NativeBuffer_ColorGamut OH_NativeBuffer_ColorGamut
110e41f4b71Sopenharmony_ci```
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ci**Description**
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ciDefines an enum for the color gamuts of an **OH_NativeBuffer** instance.
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ci**Since**: 12
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci### OH_NativeBuffer_ColorSpace
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ci```
124e41f4b71Sopenharmony_citypedef enum OH_NativeBuffer_ColorSpace OH_NativeBuffer_ColorSpace
125e41f4b71Sopenharmony_ci```
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci**Description**
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ciDefines an enum for the color spaces of an **OH_NativeBuffer** instance.
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci**Since**: 11
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ci### OH_NativeBuffer_ColorXY
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci```
139e41f4b71Sopenharmony_citypedef struct OH_NativeBuffer_ColorXY OH_NativeBuffer_ColorXY
140e41f4b71Sopenharmony_ci```
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci**Description**
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ciDefines a struct for the X and Y coordinates of the primary color.
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci**Since**: 12
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ci### OH_NativeBuffer_Config
152e41f4b71Sopenharmony_ci
153e41f4b71Sopenharmony_ci```
154e41f4b71Sopenharmony_citypedef struct OH_NativeBuffer_Config OH_NativeBuffer_Config
155e41f4b71Sopenharmony_ci```
156e41f4b71Sopenharmony_ci
157e41f4b71Sopenharmony_ci**Description**
158e41f4b71Sopenharmony_ci
159e41f4b71Sopenharmony_ciDefines 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.
160e41f4b71Sopenharmony_ci
161e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
162e41f4b71Sopenharmony_ci
163e41f4b71Sopenharmony_ci**Since**: 9
164e41f4b71Sopenharmony_ci
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci### OH_NativeBuffer_Cta861
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci```
169e41f4b71Sopenharmony_citypedef struct OH_NativeBuffer_Cta861 OH_NativeBuffer_Cta861
170e41f4b71Sopenharmony_ci```
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ci**Description**
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ciDefines a struct for the CTA-861.3 static metadata.
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_ci**Since**: 12
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ci
181e41f4b71Sopenharmony_ci### OH_NativeBuffer_Format
182e41f4b71Sopenharmony_ci
183e41f4b71Sopenharmony_ci```
184e41f4b71Sopenharmony_citypedef enum OH_NativeBuffer_Format OH_NativeBuffer_Format
185e41f4b71Sopenharmony_ci```
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ci**Description**
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ciDefines an enum for the **OH_NativeBuffer** formats.
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
192e41f4b71Sopenharmony_ci
193e41f4b71Sopenharmony_ci**Since**: 10
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ci
196e41f4b71Sopenharmony_ci### OH_NativeBuffer_MetadataKey
197e41f4b71Sopenharmony_ci
198e41f4b71Sopenharmony_ci```
199e41f4b71Sopenharmony_citypedef enum OH_NativeBuffer_MetadataKey OH_NativeBuffer_MetadataKey
200e41f4b71Sopenharmony_ci```
201e41f4b71Sopenharmony_ci
202e41f4b71Sopenharmony_ci**Description**
203e41f4b71Sopenharmony_ci
204e41f4b71Sopenharmony_ciDefines an enum for the keys that specify the HDR metadata of an **OH_NativeBuffer** instance.
205e41f4b71Sopenharmony_ci
206e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
207e41f4b71Sopenharmony_ci
208e41f4b71Sopenharmony_ci**Since**: 12
209e41f4b71Sopenharmony_ci
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_ci### OH_NativeBuffer_MetadataType
212e41f4b71Sopenharmony_ci
213e41f4b71Sopenharmony_ci```
214e41f4b71Sopenharmony_citypedef enum OH_NativeBuffer_MetadataType OH_NativeBuffer_MetadataType
215e41f4b71Sopenharmony_ci```
216e41f4b71Sopenharmony_ci
217e41f4b71Sopenharmony_ci**Description**
218e41f4b71Sopenharmony_ci
219e41f4b71Sopenharmony_ciDefines an enum for the **OH_NativeBuffer** image standards.
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
222e41f4b71Sopenharmony_ci
223e41f4b71Sopenharmony_ci**Since**: 12
224e41f4b71Sopenharmony_ci
225e41f4b71Sopenharmony_ci
226e41f4b71Sopenharmony_ci### OH_NativeBuffer_Plane
227e41f4b71Sopenharmony_ci
228e41f4b71Sopenharmony_ci```
229e41f4b71Sopenharmony_citypedef struct OH_NativeBuffer_Plane OH_NativeBuffer_Plane
230e41f4b71Sopenharmony_ci```
231e41f4b71Sopenharmony_ci
232e41f4b71Sopenharmony_ci**Description**
233e41f4b71Sopenharmony_ci
234e41f4b71Sopenharmony_ciDefines a struct for the plane information of an image.
235e41f4b71Sopenharmony_ci
236e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
237e41f4b71Sopenharmony_ci
238e41f4b71Sopenharmony_ci**Since**: 12
239e41f4b71Sopenharmony_ci
240e41f4b71Sopenharmony_ci
241e41f4b71Sopenharmony_ci### OH_NativeBuffer_Planes
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci```
244e41f4b71Sopenharmony_citypedef struct OH_NativeBuffer_Planes OH_NativeBuffer_Planes
245e41f4b71Sopenharmony_ci```
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_ci**Description**
248e41f4b71Sopenharmony_ci
249e41f4b71Sopenharmony_ciDefines a struct for the plane information of images in an **OH_NativeBuffer** instance.
250e41f4b71Sopenharmony_ci
251e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
252e41f4b71Sopenharmony_ci
253e41f4b71Sopenharmony_ci**Since**: 12
254e41f4b71Sopenharmony_ci
255e41f4b71Sopenharmony_ci
256e41f4b71Sopenharmony_ci### OH_NativeBuffer_Smpte2086
257e41f4b71Sopenharmony_ci
258e41f4b71Sopenharmony_ci```
259e41f4b71Sopenharmony_citypedef struct OH_NativeBuffer_Smpte2086 OH_NativeBuffer_Smpte2086
260e41f4b71Sopenharmony_ci```
261e41f4b71Sopenharmony_ci
262e41f4b71Sopenharmony_ci**Description**
263e41f4b71Sopenharmony_ci
264e41f4b71Sopenharmony_ciDefines a struct for the SMPTE ST 2086 static metadata.
265e41f4b71Sopenharmony_ci
266e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
267e41f4b71Sopenharmony_ci
268e41f4b71Sopenharmony_ci**Since**: 12
269e41f4b71Sopenharmony_ci
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ci### OH_NativeBuffer_StaticMetadata
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ci```
274e41f4b71Sopenharmony_citypedef struct OH_NativeBuffer_StaticMetadata OH_NativeBuffer_StaticMetadata
275e41f4b71Sopenharmony_ci```
276e41f4b71Sopenharmony_ci
277e41f4b71Sopenharmony_ci**Description**
278e41f4b71Sopenharmony_ci
279e41f4b71Sopenharmony_ciDefines a struct for the HDR static metadata.
280e41f4b71Sopenharmony_ci
281e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
282e41f4b71Sopenharmony_ci
283e41f4b71Sopenharmony_ci**Since**: 12
284e41f4b71Sopenharmony_ci
285e41f4b71Sopenharmony_ci
286e41f4b71Sopenharmony_ci### OH_NativeBuffer_TransformType
287e41f4b71Sopenharmony_ci
288e41f4b71Sopenharmony_ci```
289e41f4b71Sopenharmony_citypedef enum OH_NativeBuffer_TransformType OH_NativeBuffer_TransformType
290e41f4b71Sopenharmony_ci```
291e41f4b71Sopenharmony_ci
292e41f4b71Sopenharmony_ci**Description**
293e41f4b71Sopenharmony_ci
294e41f4b71Sopenharmony_ciDefines an enum for the transform types of an **OH_NativeBuffer** instance.
295e41f4b71Sopenharmony_ci
296e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
297e41f4b71Sopenharmony_ci
298e41f4b71Sopenharmony_ci**Since**: 12
299e41f4b71Sopenharmony_ci
300e41f4b71Sopenharmony_ci
301e41f4b71Sopenharmony_ci### OH_NativeBuffer_Usage
302e41f4b71Sopenharmony_ci
303e41f4b71Sopenharmony_ci```
304e41f4b71Sopenharmony_citypedef enum OH_NativeBuffer_Usage OH_NativeBuffer_Usage
305e41f4b71Sopenharmony_ci```
306e41f4b71Sopenharmony_ci
307e41f4b71Sopenharmony_ci**Description**
308e41f4b71Sopenharmony_ci
309e41f4b71Sopenharmony_ciDefines an enum for the **OH_NativeBuffer** usages.
310e41f4b71Sopenharmony_ci
311e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
312e41f4b71Sopenharmony_ci
313e41f4b71Sopenharmony_ci**Since**: 10
314e41f4b71Sopenharmony_ci
315e41f4b71Sopenharmony_ci
316e41f4b71Sopenharmony_ci### OHNativeErrorCode
317e41f4b71Sopenharmony_ci
318e41f4b71Sopenharmony_ci```
319e41f4b71Sopenharmony_citypedef enum OHNativeErrorCodeOHNativeErrorCode
320e41f4b71Sopenharmony_ci```
321e41f4b71Sopenharmony_ci
322e41f4b71Sopenharmony_ci**Description**
323e41f4b71Sopenharmony_ci
324e41f4b71Sopenharmony_ciDefines an enum for the error codes.
325e41f4b71Sopenharmony_ci
326e41f4b71Sopenharmony_ci**Since**: 12
327e41f4b71Sopenharmony_ci
328e41f4b71Sopenharmony_ci
329e41f4b71Sopenharmony_ci## Enum Description
330e41f4b71Sopenharmony_ci
331e41f4b71Sopenharmony_ci
332e41f4b71Sopenharmony_ci### OH_NativeBuffer_ColorGamut
333e41f4b71Sopenharmony_ci
334e41f4b71Sopenharmony_ci```
335e41f4b71Sopenharmony_cienum OH_NativeBuffer_ColorGamut
336e41f4b71Sopenharmony_ci```
337e41f4b71Sopenharmony_ci
338e41f4b71Sopenharmony_ci**Description**
339e41f4b71Sopenharmony_ci
340e41f4b71Sopenharmony_ciEnumerates the color gamuts of an **OH_NativeBuffer** instance.
341e41f4b71Sopenharmony_ci
342e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
343e41f4b71Sopenharmony_ci
344e41f4b71Sopenharmony_ci**Since**: 12
345e41f4b71Sopenharmony_ci
346e41f4b71Sopenharmony_ci| Value| Description| 
347e41f4b71Sopenharmony_ci| -------- | -------- |
348e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_NATIVE | Default gamut.| 
349e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT601 | Standard BT.601 color gamut.| 
350e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT709 | Standard BT.709 color gamut.| 
351e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_DCI_P3 | DCI P3 color gamut.| 
352e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_SRGB | SRGB color gamut.| 
353e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_ADOBE_RGB | Adobe RGB color gamut.| 
354e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_DISPLAY_P3 | Display P3 color gamut.| 
355e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_BT2020 | BT.2020 color gamut.| 
356e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_BT2100_PQ | BT.2100 PQ color gamut.| 
357e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_BT2100_HLG | BT.2100 HLG color gamut format| 
358e41f4b71Sopenharmony_ci| NATIVEBUFFER_COLOR_GAMUT_DISPLAY_BT2020 | Display BT.2020 color gamut.| 
359e41f4b71Sopenharmony_ci
360e41f4b71Sopenharmony_ci
361e41f4b71Sopenharmony_ci### OH_NativeBuffer_ColorSpace
362e41f4b71Sopenharmony_ci
363e41f4b71Sopenharmony_ci```
364e41f4b71Sopenharmony_cienum OH_NativeBuffer_ColorSpace
365e41f4b71Sopenharmony_ci```
366e41f4b71Sopenharmony_ci
367e41f4b71Sopenharmony_ci**Description**
368e41f4b71Sopenharmony_ci
369e41f4b71Sopenharmony_ciEnumerates the color spaces of an **OH_NativeBuffer** instance.
370e41f4b71Sopenharmony_ci
371e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
372e41f4b71Sopenharmony_ci
373e41f4b71Sopenharmony_ci**Since**: 11
374e41f4b71Sopenharmony_ci
375e41f4b71Sopenharmony_ci| Value| Description| 
376e41f4b71Sopenharmony_ci| -------- | -------- |
377e41f4b71Sopenharmony_ci| OH_COLORSPACE_NONE | No color space is available.| 
378e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT601_EBU_FULL | The color gamut is BT601_P, the transfer function is BT709, the conversion matrix is BT601_P, and the data range is RANGE_FULL.| 
379e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT601_SMPTE_C_FULL | The color gamut is BT601_N, the transfer function is BT709, the conversion matrix is BT601_N, and the data range is RANGE_FULL.| 
380e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT709_FULL | The color gamut is BT709, the transfer function is BT709, the conversion matrix is BT709, and the data range is RANGE_FULL.| 
381e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT2020_HLG_FULL | The color gamut is BT2020, the transfer function is HLG, the conversion matrix is BT2020, and the data range is RANGE_FULL.| 
382e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT2020_PQ_FULL | The color gamut is BT2020, the transfer function is PQ, the conversion matrix is BT2020, and the data range is RANGE_FULL.| 
383e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT601_EBU_LIMIT | The color gamut is BT601_P, the transfer function is BT709, the conversion matrix is BT601_P, and the data range is RANGE_LIMITED.| 
384e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT601_SMPTE_C_LIMIT | The color gamut is BT601_N, the transfer function is BT709, the conversion matrix is BT601_N, and the data range is RANGE_LIMITED.| 
385e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT709_LIMIT | The color gamut is BT709, the transfer function is BT709, the conversion matrix is BT709, and the data range is RANGE_LIMITED.| 
386e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT2020_HLG_LIMIT | The color gamut is BT2020, the transfer function is HLG, the conversion matrix is BT2020, and the data range is RANGE_LIMITED.| 
387e41f4b71Sopenharmony_ci| OH_COLORSPACE_BT2020_PQ_LIMIT | The color gamut is BT2020, the transfer function is PQ, the conversion matrix is BT2020, and the data range is RANGE_LIMITED.| 
388e41f4b71Sopenharmony_ci| OH_COLORSPACE_SRGB_FULL | The color gamut is SRGB, the transfer function is SRGB, the conversion matrix is BT601_N, and the data range is RANGE_FULL.| 
389e41f4b71Sopenharmony_ci| OH_COLORSPACE_P3_FULL | The color gamut is P3_D65, the transfer function is SRGB, the conversion matrix is P3, and the data range is RANGE_FULL.| 
390e41f4b71Sopenharmony_ci| OH_COLORSPACE_P3_HLG_FULL | The color gamut is P3_D65, the transfer function is HLG, the conversion matrix is P3, and the data range is RANGE_FULL.| 
391e41f4b71Sopenharmony_ci| OH_COLORSPACE_P3_PQ_FULL | The color gamut is P3_D65, the transfer function is PQ, the conversion matrix is P3, and the data range is RANGE_FULL.| 
392e41f4b71Sopenharmony_ci| OH_COLORSPACE_ADOBERGB_FULL | The color gamut is ADOBERGB, the transfer function is ADOBERGB, the conversion matrix is ADOBERGB, and the data range is RANGE_FULL.| 
393e41f4b71Sopenharmony_ci| OH_COLORSPACE_SRGB_LIMIT | The color gamut is SRGB, the transfer function is SRGB, the conversion matrix is BT601_N, and the data range is RANGE_LIMITED.| 
394e41f4b71Sopenharmony_ci| OH_COLORSPACE_P3_LIMIT | The color gamut is P3_D65, the transfer function is SRGB, the conversion matrix is P3, and the data range is RANGE_LIMITED.| 
395e41f4b71Sopenharmony_ci| OH_COLORSPACE_P3_HLG_LIMIT | The color gamut is P3_D65, the transfer function is HLG, the conversion matrix is P3, and the data range is RANGE_LIMITED.| 
396e41f4b71Sopenharmony_ci| OH_COLORSPACE_P3_PQ_LIMIT | The color gamut is P3_D65, the transfer function is PQ, the conversion matrix is P3, and the data range is RANGE_LIMITED.| 
397e41f4b71Sopenharmony_ci| OH_COLORSPACE_ADOBERGB_LIMIT | The color gamut is ADOBERGB, the transfer function is ADOBERGB, the conversion matrix is ADOBERGB, and the data range is RANGE_LIMITED.| 
398e41f4b71Sopenharmony_ci| OH_COLORSPACE_LINEAR_SRGB | The color gamut is SRGB, and the transfer function is LINEAR.| 
399e41f4b71Sopenharmony_ci| OH_COLORSPACE_LINEAR_BT709 | It is equivalent to **OH_COLORSPACE_LINEAR_SRGB**.| 
400e41f4b71Sopenharmony_ci| OH_COLORSPACE_LINEAR_P3 | The color gamut is P3_D65, and the transfer function is LINEAR.| 
401e41f4b71Sopenharmony_ci| OH_COLORSPACE_LINEAR_BT2020 | The color gamut is BT2020, and the transfer function is LINEAR.| 
402e41f4b71Sopenharmony_ci| OH_COLORSPACE_DISPLAY_SRGB | It is equivalent to **OH_COLORSPACE_SRGB_FULL**.| 
403e41f4b71Sopenharmony_ci| OH_COLORSPACE_DISPLAY_P3_SRGB | It is equivalent to **OH_COLORSPACE_P3_FULL**.| 
404e41f4b71Sopenharmony_ci| OH_COLORSPACE_DISPLAY_P3_HLG | It is equivalent to **OH_COLORSPACE_P3_HLG_FULL**.| 
405e41f4b71Sopenharmony_ci| OH_COLORSPACE_DISPLAY_P3_PQ | It is equivalent to **OH_COLORSPACE_P3_PQ_FULL**.| 
406e41f4b71Sopenharmony_ci| OH_COLORSPACE_DISPLAY_BT2020_SRGB | The color gamut is BT2020, the transfer function is SRGB, the conversion matrix is BT2020, and the data range is RANGE_FULL.| 
407e41f4b71Sopenharmony_ci| OH_COLORSPACE_DISPLAY_BT2020_HLG | It is equivalent to **OH_COLORSPACE_BT2020_HLG_FULL**.| 
408e41f4b71Sopenharmony_ci| OH_COLORSPACE_DISPLAY_BT2020_PQ | It is equivalent to **OH_COLORSPACE_BT2020_PQ_FULL**.| 
409e41f4b71Sopenharmony_ci
410e41f4b71Sopenharmony_ci
411e41f4b71Sopenharmony_ci### OH_NativeBuffer_Format
412e41f4b71Sopenharmony_ci
413e41f4b71Sopenharmony_ci```
414e41f4b71Sopenharmony_cienum OH_NativeBuffer_Format
415e41f4b71Sopenharmony_ci```
416e41f4b71Sopenharmony_ci
417e41f4b71Sopenharmony_ci**Description**
418e41f4b71Sopenharmony_ci
419e41f4b71Sopenharmony_ciEnumerates the **OH_NativeBuffer** formats.
420e41f4b71Sopenharmony_ci
421e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
422e41f4b71Sopenharmony_ci
423e41f4b71Sopenharmony_ci**Since**: 10
424e41f4b71Sopenharmony_ci
425e41f4b71Sopenharmony_ci| Value| Description| 
426e41f4b71Sopenharmony_ci| -------- | -------- |
427e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_CLUT8<sup>12+</sup> | CLUT8.| 
428e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_CLUT1<sup>12+</sup> | CLUT1.| 
429e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_CLUT4<sup>12+</sup> | CLUT4.| 
430e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGB_565 | RGB565.| 
431e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGBA_5658 | RGBA5658.| 
432e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGBX_4444 | RGBX4444.| 
433e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGBA_4444 | RGBA4444.| 
434e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGB_444 | RGB444.| 
435e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGBX_5551 | RGBX5551.| 
436e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGBA_5551 | RGBA5551.| 
437e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGB_555 | RGB555.| 
438e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGBX_8888 | RGBX8888.| 
439e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGBA_8888 | RGBA8888.| 
440e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGB_888 | RGB888.| 
441e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_BGR_565 | BGR565.| 
442e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_BGRX_4444 | BGRX4444.| 
443e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_BGRA_4444 | BGRA4444.| 
444e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_BGRX_5551 | BGRX5551.| 
445e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_BGRA_5551 | BGRA5551.| 
446e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_BGRX_8888 | BGRX8888.| 
447e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_BGRA_8888 | BGRA8888.| 
448e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YUV_422_I<sup>12+</sup> | YUV422 interleaved.| 
449e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCBCR_422_SP<sup>12+</sup> | YCbCr422 semi-planar.| 
450e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCRCB_422_SP<sup>12+</sup> | YCrCb422 semi-planar.| 
451e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCBCR_420_SP<sup>12+</sup> | YCbCr420 semi-planar.| 
452e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCRCB_420_SP<sup>12+</sup> | YCrCb420 semi-planar.| 
453e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCBCR_422_P<sup>12+</sup> | YCbCr422 planar.| 
454e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCRCB_422_P<sup>12+</sup> | YCrCb422 planar.| 
455e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCBCR_420_P<sup>12+</sup> | YCbCr420 planar.| 
456e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCRCB_420_P<sup>12+</sup> | YCrCb420 planar.| 
457e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YUYV_422_PKG<sup>12+</sup> | YUYV422 packed.| 
458e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_UYVY_422_PKG<sup>12+</sup> | UYVY422 packed.| 
459e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YVYU_422_PKG<sup>12+</sup> | YVYU422 packed.| 
460e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_VYUY_422_PKG<sup>12+</sup> | VYUY422 packed.| 
461e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RGBA_1010102<sup>12+</sup> | RGBA_1010102 packed.| 
462e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCBCR_P010<sup>12+</sup> | YCBCR420 semi-planar 10-bit packed.| 
463e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_YCRCB_P010<sup>12+</sup> | YCRCB420 semi-planar 10-bit packed.| 
464e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_RAW10<sup>12+</sup> | Raw 10-bit packed.| 
465e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_VENDER_MASK<sup>12+</sup> | Vender mask.| 
466e41f4b71Sopenharmony_ci| NATIVEBUFFER_PIXEL_FMT_BUTT | Invalid format.| 
467e41f4b71Sopenharmony_ci
468e41f4b71Sopenharmony_ci
469e41f4b71Sopenharmony_ci### OH_NativeBuffer_MetadataKey
470e41f4b71Sopenharmony_ci
471e41f4b71Sopenharmony_ci```
472e41f4b71Sopenharmony_cienum OH_NativeBuffer_MetadataKey
473e41f4b71Sopenharmony_ci```
474e41f4b71Sopenharmony_ci
475e41f4b71Sopenharmony_ci**Description**
476e41f4b71Sopenharmony_ci
477e41f4b71Sopenharmony_ciEnumerates the keys that specify the HDR metadata of an **OH_NativeBuffer** instance.
478e41f4b71Sopenharmony_ci
479e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
480e41f4b71Sopenharmony_ci
481e41f4b71Sopenharmony_ci**Since**: 12
482e41f4b71Sopenharmony_ci
483e41f4b71Sopenharmony_ci| Value| Description| 
484e41f4b71Sopenharmony_ci| -------- | -------- |
485e41f4b71Sopenharmony_ci| OH_HDR_METADATA_TYPE | Metadata type. For details about the available options, see [OH_NativeBuffer_MetadataType](#oh_nativebuffer_metadatatype). **size** indicates the size of **OH_NativeBuffer_MetadataType**.| 
486e41f4b71Sopenharmony_ci| OH_HDR_STATIC_METADATA | Static metadata. For details about the available options, see [OH_NativeBuffer_StaticMetadata](_o_h___native_buffer___static_metadata.md). **size** indicates the size of **OH_NativeBuffer_StaticMetadata**.| 
487e41f4b71Sopenharmony_ci| OH_HDR_DYNAMIC_METADATA | Dynamic metadata. For details about the available options, see the SEI byte stream in the video stream. The value range of **size** is 1-3000.| 
488e41f4b71Sopenharmony_ci
489e41f4b71Sopenharmony_ci
490e41f4b71Sopenharmony_ci### OH_NativeBuffer_MetadataType
491e41f4b71Sopenharmony_ci
492e41f4b71Sopenharmony_ci```
493e41f4b71Sopenharmony_cienum OH_NativeBuffer_MetadataType
494e41f4b71Sopenharmony_ci```
495e41f4b71Sopenharmony_ci
496e41f4b71Sopenharmony_ci**Description**
497e41f4b71Sopenharmony_ci
498e41f4b71Sopenharmony_ciEnumerates the **OH_NativeBuffer** image standards.
499e41f4b71Sopenharmony_ci
500e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
501e41f4b71Sopenharmony_ci
502e41f4b71Sopenharmony_ci**Since**: 12
503e41f4b71Sopenharmony_ci
504e41f4b71Sopenharmony_ci| Value| Description| 
505e41f4b71Sopenharmony_ci| -------- | -------- |
506e41f4b71Sopenharmony_ci| OH_VIDEO_HDR_HLG | Video HLG.| 
507e41f4b71Sopenharmony_ci| OH_VIDEO_HDR_HDR10 | Video HDR10.| 
508e41f4b71Sopenharmony_ci| OH_VIDEO_HDR_VIVID | Video HDR Vivid.| 
509e41f4b71Sopenharmony_ci
510e41f4b71Sopenharmony_ci
511e41f4b71Sopenharmony_ci### OH_NativeBuffer_TransformType
512e41f4b71Sopenharmony_ci
513e41f4b71Sopenharmony_ci```
514e41f4b71Sopenharmony_cienum OH_NativeBuffer_TransformType
515e41f4b71Sopenharmony_ci```
516e41f4b71Sopenharmony_ci
517e41f4b71Sopenharmony_ci**Description**
518e41f4b71Sopenharmony_ci
519e41f4b71Sopenharmony_ciEnumerates the transform types of an **OH_NativeBuffer** instance.
520e41f4b71Sopenharmony_ci
521e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
522e41f4b71Sopenharmony_ci
523e41f4b71Sopenharmony_ci**Since**: 12
524e41f4b71Sopenharmony_ci
525e41f4b71Sopenharmony_ci| Value| Description| 
526e41f4b71Sopenharmony_ci| -------- | -------- |
527e41f4b71Sopenharmony_ci| NATIVEBUFFER_ROTATE_NONE | No rotation.| 
528e41f4b71Sopenharmony_ci| NATIVEBUFFER_ROTATE_90 | Rotates by 90 degrees.| 
529e41f4b71Sopenharmony_ci| NATIVEBUFFER_ROTATE_180 | Rotates by 180 degrees.| 
530e41f4b71Sopenharmony_ci| NATIVEBUFFER_ROTATE_270 | Rotates by 270 degrees.| 
531e41f4b71Sopenharmony_ci| NATIVEBUFFER_FLIP_H | Flips horizontally.| 
532e41f4b71Sopenharmony_ci| NATIVEBUFFER_FLIP_V | Flips vertically.| 
533e41f4b71Sopenharmony_ci| NATIVEBUFFER_FLIP_H_ROT90 | Flips horizontally and rotates by 90 degrees.| 
534e41f4b71Sopenharmony_ci| NATIVEBUFFER_FLIP_V_ROT90 | Flips vertically and rotates by 90 degrees.| 
535e41f4b71Sopenharmony_ci| NATIVEBUFFER_FLIP_H_ROT180 | Flips horizontally and rotates by 180 degrees.| 
536e41f4b71Sopenharmony_ci| NATIVEBUFFER_FLIP_V_ROT180 | Flips vertically and rotates by 180 degrees.| 
537e41f4b71Sopenharmony_ci| NATIVEBUFFER_FLIP_H_ROT270 | Flips horizontally and rotates by 270 degrees.| 
538e41f4b71Sopenharmony_ci| NATIVEBUFFER_FLIP_V_ROT270 | Flips vertically and rotates by 270 degrees.| 
539e41f4b71Sopenharmony_ci
540e41f4b71Sopenharmony_ci
541e41f4b71Sopenharmony_ci### OH_NativeBuffer_Usage
542e41f4b71Sopenharmony_ci
543e41f4b71Sopenharmony_ci```
544e41f4b71Sopenharmony_cienum OH_NativeBuffer_Usage
545e41f4b71Sopenharmony_ci```
546e41f4b71Sopenharmony_ci
547e41f4b71Sopenharmony_ci**Description**
548e41f4b71Sopenharmony_ci
549e41f4b71Sopenharmony_ciEnumerates the **OH_NativeBuffer** usages.
550e41f4b71Sopenharmony_ci
551e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
552e41f4b71Sopenharmony_ci
553e41f4b71Sopenharmony_ci**Since**: 10
554e41f4b71Sopenharmony_ci
555e41f4b71Sopenharmony_ci| Value| Description| 
556e41f4b71Sopenharmony_ci| -------- | -------- |
557e41f4b71Sopenharmony_ci| NATIVEBUFFER_USAGE_CPU_READ | CPU readable.| 
558e41f4b71Sopenharmony_ci| NATIVEBUFFER_USAGE_CPU_WRITE | CPU writable.| 
559e41f4b71Sopenharmony_ci| NATIVEBUFFER_USAGE_MEM_DMA | Direct memory access to the buffer.| 
560e41f4b71Sopenharmony_ci| NATIVEBUFFER_USAGE_HW_RENDER<sup>12+</sup> | GPU writable.| 
561e41f4b71Sopenharmony_ci| NATIVEBUFFER_USAGE_HW_TEXTURE<sup>12+</sup> | GPU readable.| 
562e41f4b71Sopenharmony_ci| NATIVEBUFFER_USAGE_CPU_READ_OFTEN<sup>12+</sup> | Direct mapping of CPU.| 
563e41f4b71Sopenharmony_ci| NATIVEBUFFER_USAGE_ALIGNMENT_512<sup>12+</sup> | 512-byte alignment.| 
564e41f4b71Sopenharmony_ci
565e41f4b71Sopenharmony_ci
566e41f4b71Sopenharmony_ci### OHNativeErrorCode
567e41f4b71Sopenharmony_ci
568e41f4b71Sopenharmony_ci```
569e41f4b71Sopenharmony_cienum OHNativeErrorCode
570e41f4b71Sopenharmony_ci```
571e41f4b71Sopenharmony_ci
572e41f4b71Sopenharmony_ci**Description**
573e41f4b71Sopenharmony_ci
574e41f4b71Sopenharmony_ciEnumerates the error codes.
575e41f4b71Sopenharmony_ci
576e41f4b71Sopenharmony_ci**Since**: 12
577e41f4b71Sopenharmony_ci
578e41f4b71Sopenharmony_ci| Value| Description| 
579e41f4b71Sopenharmony_ci| -------- | -------- |
580e41f4b71Sopenharmony_ci| NATIVE_ERROR_OK | The operation is successful.| 
581e41f4b71Sopenharmony_ci| NATIVE_ERROR_INVALID_ARGUMENTS | An input parameter is invalid.| 
582e41f4b71Sopenharmony_ci| NATIVE_ERROR_NO_PERMISSION | You do not have the permission to perform the operation.| 
583e41f4b71Sopenharmony_ci| NATIVE_ERROR_NO_BUFFER | No buffer is available.| 
584e41f4b71Sopenharmony_ci| NATIVE_ERROR_NO_CONSUMER | The consumer does not exist.| 
585e41f4b71Sopenharmony_ci| NATIVE_ERROR_NOT_INIT | Not initialized.| 
586e41f4b71Sopenharmony_ci| NATIVE_ERROR_CONSUMER_CONNECTED | The consumer is connected.| 
587e41f4b71Sopenharmony_ci| NATIVE_ERROR_BUFFER_STATE_INVALID | The buffer status does not meet the expectation.| 
588e41f4b71Sopenharmony_ci| NATIVE_ERROR_BUFFER_IN_CACHE | The buffer is already in the buffer queue.| 
589e41f4b71Sopenharmony_ci| NATIVE_ERROR_BUFFER_QUEUE_FULL | The queue is full.| 
590e41f4b71Sopenharmony_ci| NATIVE_ERROR_BUFFER_NOT_IN_CACHE | The buffer is not in the buffer queue.|
591e41f4b71Sopenharmony_ci| NATIVE_ERROR_CONSUMER_DISCONNECTED | The consumer is disconnected.|
592e41f4b71Sopenharmony_ci| NATIVE_ERROR_CONSUMER_NO_LISTENER_REGISTERED | No listener is registered on the consumer side.|
593e41f4b71Sopenharmony_ci| NATIVE_ERROR_UNSUPPORTED | The device or platform does not support the operation.| 
594e41f4b71Sopenharmony_ci| NATIVE_ERROR_UNKNOWN | Unknown error. Check the log.| 
595e41f4b71Sopenharmony_ci| NATIVE_ERROR_HDI_ERROR  | Failed to call the HDI.  | 
596e41f4b71Sopenharmony_ci| NATIVE_ERROR_BINDER_ERROR  | Cross-process communication failed.  | 
597e41f4b71Sopenharmony_ci| NATIVE_ERROR_EGL_STATE_UNKNOWN | The EGL environment is abnormal.| 
598e41f4b71Sopenharmony_ci| NATIVE_ERROR_EGL_API_FAILED | Failed to call the EGL APIs.| 
599e41f4b71Sopenharmony_ci
600e41f4b71Sopenharmony_ci
601e41f4b71Sopenharmony_ci## Function Description
602e41f4b71Sopenharmony_ci
603e41f4b71Sopenharmony_ci
604e41f4b71Sopenharmony_ci### OH_NativeBuffer_Alloc()
605e41f4b71Sopenharmony_ci
606e41f4b71Sopenharmony_ci```
607e41f4b71Sopenharmony_ciOH_NativeBuffer* OH_NativeBuffer_Alloc (const OH_NativeBuffer_Config* config)
608e41f4b71Sopenharmony_ci```
609e41f4b71Sopenharmony_ci
610e41f4b71Sopenharmony_ci**Description**
611e41f4b71Sopenharmony_ci
612e41f4b71Sopenharmony_ciCreates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.
613e41f4b71Sopenharmony_ci
614e41f4b71Sopenharmony_ciThis function must be used in pair with **OH_NativeBuffer_Unreference**. Otherwise, memory leak occurs.
615e41f4b71Sopenharmony_ci
616e41f4b71Sopenharmony_ciThis function is not thread-safe.
617e41f4b71Sopenharmony_ci
618e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
619e41f4b71Sopenharmony_ci
620e41f4b71Sopenharmony_ci**Since**: 9
621e41f4b71Sopenharmony_ci
622e41f4b71Sopenharmony_ci**Parameters**
623e41f4b71Sopenharmony_ci
624e41f4b71Sopenharmony_ci| Name| Description| 
625e41f4b71Sopenharmony_ci| -------- | -------- |
626e41f4b71Sopenharmony_ci| config | Pointer to an **OH_NativeBuffer_Config** instance.| 
627e41f4b71Sopenharmony_ci
628e41f4b71Sopenharmony_ci**Returns**
629e41f4b71Sopenharmony_ci
630e41f4b71Sopenharmony_ciReturns the pointer to the **OH_NativeBuffer** instance created if the operation is successful; returns **NULL** otherwise.
631e41f4b71Sopenharmony_ci
632e41f4b71Sopenharmony_ci
633e41f4b71Sopenharmony_ci### OH_NativeBuffer_FromNativeWindowBuffer()
634e41f4b71Sopenharmony_ci
635e41f4b71Sopenharmony_ci```
636e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_FromNativeWindowBuffer (OHNativeWindowBuffer *nativeWindowBuffer, OH_NativeBuffer **buffer )
637e41f4b71Sopenharmony_ci```
638e41f4b71Sopenharmony_ci
639e41f4b71Sopenharmony_ci**Description**
640e41f4b71Sopenharmony_ci
641e41f4b71Sopenharmony_ciConverts an **OHNativeWindowBuffer** instance to an **OH_NativeBuffer** instance.
642e41f4b71Sopenharmony_ci
643e41f4b71Sopenharmony_ciThis function is not thread-safe.
644e41f4b71Sopenharmony_ci
645e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
646e41f4b71Sopenharmony_ci
647e41f4b71Sopenharmony_ci**Since**: 12
648e41f4b71Sopenharmony_ci
649e41f4b71Sopenharmony_ci**Parameters**
650e41f4b71Sopenharmony_ci
651e41f4b71Sopenharmony_ci| Name| Description| 
652e41f4b71Sopenharmony_ci| -------- | -------- |
653e41f4b71Sopenharmony_ci| nativeWindowBuffer | Pointer to an **OHNativeWindowBuffer** instance.| 
654e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
655e41f4b71Sopenharmony_ci
656e41f4b71Sopenharmony_ci**Returns**
657e41f4b71Sopenharmony_ci
658e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
659e41f4b71Sopenharmony_ci
660e41f4b71Sopenharmony_ci
661e41f4b71Sopenharmony_ci### OH_NativeBuffer_GetColorSpace()
662e41f4b71Sopenharmony_ci
663e41f4b71Sopenharmony_ci```
664e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_GetColorSpace (OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace *colorSpace )
665e41f4b71Sopenharmony_ci```
666e41f4b71Sopenharmony_ci
667e41f4b71Sopenharmony_ci**Description**
668e41f4b71Sopenharmony_ci
669e41f4b71Sopenharmony_ciObtains the color space of an **OH_NativeBuffer** instance.
670e41f4b71Sopenharmony_ci
671e41f4b71Sopenharmony_ciThis function is not thread-safe.
672e41f4b71Sopenharmony_ci
673e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
674e41f4b71Sopenharmony_ci
675e41f4b71Sopenharmony_ci**Since**: 12
676e41f4b71Sopenharmony_ci
677e41f4b71Sopenharmony_ci**Parameters**
678e41f4b71Sopenharmony_ci
679e41f4b71Sopenharmony_ci| Name| Description| 
680e41f4b71Sopenharmony_ci| -------- | -------- |
681e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
682e41f4b71Sopenharmony_ci| colorSpace | Pointer to the color space. For details about the available options, see [OH_NativeBuffer_ColorSpace](#oh_nativebuffer_colorspace).| 
683e41f4b71Sopenharmony_ci
684e41f4b71Sopenharmony_ci**Returns**
685e41f4b71Sopenharmony_ci
686e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
687e41f4b71Sopenharmony_ci
688e41f4b71Sopenharmony_ci
689e41f4b71Sopenharmony_ci### OH_NativeBuffer_GetConfig()
690e41f4b71Sopenharmony_ci
691e41f4b71Sopenharmony_ci```
692e41f4b71Sopenharmony_civoid OH_NativeBuffer_GetConfig (OH_NativeBuffer *buffer, OH_NativeBuffer_Config* config )
693e41f4b71Sopenharmony_ci```
694e41f4b71Sopenharmony_ci
695e41f4b71Sopenharmony_ci**Description**
696e41f4b71Sopenharmony_ci
697e41f4b71Sopenharmony_ciObtains the attributes of an **OH_NativeBuffer** instance.
698e41f4b71Sopenharmony_ci
699e41f4b71Sopenharmony_ciThis function is not thread-safe.
700e41f4b71Sopenharmony_ci
701e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
702e41f4b71Sopenharmony_ci
703e41f4b71Sopenharmony_ci**Since**: 9
704e41f4b71Sopenharmony_ci
705e41f4b71Sopenharmony_ci**Parameters**
706e41f4b71Sopenharmony_ci
707e41f4b71Sopenharmony_ci| Name| Description| 
708e41f4b71Sopenharmony_ci| -------- | -------- |
709e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
710e41f4b71Sopenharmony_ci| config | Pointer to an **OH_NativeBuffer_Config** instance, which is used to receive the attributes of **OH_NativeBuffer**.| 
711e41f4b71Sopenharmony_ci
712e41f4b71Sopenharmony_ci
713e41f4b71Sopenharmony_ci### OH_NativeBuffer_GetMetadataValue()
714e41f4b71Sopenharmony_ci
715e41f4b71Sopenharmony_ci```
716e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_GetMetadataValue (OH_NativeBuffer *buffer, OH_NativeBuffer_MetadataKey metadataKey, int32_t *size, uint8_t **metaData )
717e41f4b71Sopenharmony_ci```
718e41f4b71Sopenharmony_ci
719e41f4b71Sopenharmony_ci**Description**
720e41f4b71Sopenharmony_ci
721e41f4b71Sopenharmony_ciObtains the metadata value of an **OH_NativeBuffer** instance.
722e41f4b71Sopenharmony_ci
723e41f4b71Sopenharmony_ciThis function is not thread-safe.
724e41f4b71Sopenharmony_ci
725e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
726e41f4b71Sopenharmony_ci
727e41f4b71Sopenharmony_ci**Since**: 12
728e41f4b71Sopenharmony_ci
729e41f4b71Sopenharmony_ci**Parameters**
730e41f4b71Sopenharmony_ci
731e41f4b71Sopenharmony_ci| Name| Description| 
732e41f4b71Sopenharmony_ci| -------- | -------- |
733e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
734e41f4b71Sopenharmony_ci| metadataKey | Key of the metadata. For details about the available options, see [OH_NativeBuffer_MetadataKey](#oh_nativebuffer_metadatakey).| 
735e41f4b71Sopenharmony_ci| size | Pointer to the size of the uint8_t vector. For details about the available options, see [OH_NativeBuffer_MetadataKey](#oh_nativebuffer_metadatakey).| 
736e41f4b71Sopenharmony_ci| metaData | Double pointer to the uint8_t vector.| 
737e41f4b71Sopenharmony_ci
738e41f4b71Sopenharmony_ci**Returns**
739e41f4b71Sopenharmony_ci
740e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
741e41f4b71Sopenharmony_ci
742e41f4b71Sopenharmony_ci
743e41f4b71Sopenharmony_ci### OH_NativeBuffer_GetSeqNum()
744e41f4b71Sopenharmony_ci
745e41f4b71Sopenharmony_ci```
746e41f4b71Sopenharmony_ciuint32_t OH_NativeBuffer_GetSeqNum (OH_NativeBuffer *buffer)
747e41f4b71Sopenharmony_ci```
748e41f4b71Sopenharmony_ci
749e41f4b71Sopenharmony_ci**Description**
750e41f4b71Sopenharmony_ci
751e41f4b71Sopenharmony_ciObtains the sequence number of an **OH_NativeBuffer** instance.
752e41f4b71Sopenharmony_ci
753e41f4b71Sopenharmony_ciThis function is not thread-safe.
754e41f4b71Sopenharmony_ci
755e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
756e41f4b71Sopenharmony_ci
757e41f4b71Sopenharmony_ci**Since**: 9
758e41f4b71Sopenharmony_ci
759e41f4b71Sopenharmony_ci**Parameters**
760e41f4b71Sopenharmony_ci
761e41f4b71Sopenharmony_ci| Name| Description| 
762e41f4b71Sopenharmony_ci| -------- | -------- |
763e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
764e41f4b71Sopenharmony_ci
765e41f4b71Sopenharmony_ci**Returns**
766e41f4b71Sopenharmony_ci
767e41f4b71Sopenharmony_ciReturns the unique sequence number of the **OH_NativeBuffer** instance.
768e41f4b71Sopenharmony_ci
769e41f4b71Sopenharmony_ci
770e41f4b71Sopenharmony_ci### OH_NativeBuffer_Map()
771e41f4b71Sopenharmony_ci
772e41f4b71Sopenharmony_ci```
773e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_Map (OH_NativeBuffer *buffer, void **virAddr )
774e41f4b71Sopenharmony_ci```
775e41f4b71Sopenharmony_ci
776e41f4b71Sopenharmony_ci**Description**
777e41f4b71Sopenharmony_ci
778e41f4b71Sopenharmony_ciMaps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.
779e41f4b71Sopenharmony_ci
780e41f4b71Sopenharmony_ciThis function must be used in pair with **OH_NativeBuffer_Unmap**.
781e41f4b71Sopenharmony_ci
782e41f4b71Sopenharmony_ciThis function is not thread-safe.
783e41f4b71Sopenharmony_ci
784e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
785e41f4b71Sopenharmony_ci
786e41f4b71Sopenharmony_ci**Since**: 9
787e41f4b71Sopenharmony_ci
788e41f4b71Sopenharmony_ci**Parameters**
789e41f4b71Sopenharmony_ci
790e41f4b71Sopenharmony_ci| Name| Description| 
791e41f4b71Sopenharmony_ci| -------- | -------- |
792e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
793e41f4b71Sopenharmony_ci| virAddr | Double pointer to the address of the virtual memory.| 
794e41f4b71Sopenharmony_ci
795e41f4b71Sopenharmony_ci**Returns**
796e41f4b71Sopenharmony_ci
797e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
798e41f4b71Sopenharmony_ci
799e41f4b71Sopenharmony_ci
800e41f4b71Sopenharmony_ci### OH_NativeBuffer_MapPlanes()
801e41f4b71Sopenharmony_ci
802e41f4b71Sopenharmony_ci```
803e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_MapPlanes (OH_NativeBuffer *buffer, void **virAddr, OH_NativeBuffer_Planes *outPlanes )
804e41f4b71Sopenharmony_ci```
805e41f4b71Sopenharmony_ci
806e41f4b71Sopenharmony_ci**Description**
807e41f4b71Sopenharmony_ci
808e41f4b71Sopenharmony_ciMaps the multi-channel ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.
809e41f4b71Sopenharmony_ci
810e41f4b71Sopenharmony_ciThis function is not thread-safe.
811e41f4b71Sopenharmony_ci
812e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
813e41f4b71Sopenharmony_ci
814e41f4b71Sopenharmony_ci**Since**: 12
815e41f4b71Sopenharmony_ci
816e41f4b71Sopenharmony_ci**Parameters**
817e41f4b71Sopenharmony_ci
818e41f4b71Sopenharmony_ci| Name| Description| 
819e41f4b71Sopenharmony_ci| -------- | -------- |
820e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
821e41f4b71Sopenharmony_ci| virAddr | Double pointer to the address of the virtual memory.| 
822e41f4b71Sopenharmony_ci| outPlanes | Pointer to the plane information of all images.| 
823e41f4b71Sopenharmony_ci
824e41f4b71Sopenharmony_ci**Returns**
825e41f4b71Sopenharmony_ci
826e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
827e41f4b71Sopenharmony_ci
828e41f4b71Sopenharmony_ci
829e41f4b71Sopenharmony_ci### OH_NativeBuffer_Reference()
830e41f4b71Sopenharmony_ci
831e41f4b71Sopenharmony_ci```
832e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_Reference (OH_NativeBuffer *buffer)
833e41f4b71Sopenharmony_ci```
834e41f4b71Sopenharmony_ci
835e41f4b71Sopenharmony_ci**Description**
836e41f4b71Sopenharmony_ci
837e41f4b71Sopenharmony_ciIncreases the reference count of an **OH_NativeBuffer** instance by 1.
838e41f4b71Sopenharmony_ci
839e41f4b71Sopenharmony_ciThis function must be used in pair with **OH_NativeBuffer_Unreference**. Otherwise, memory leak occurs.
840e41f4b71Sopenharmony_ci
841e41f4b71Sopenharmony_ciThis function is not thread-safe.
842e41f4b71Sopenharmony_ci
843e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
844e41f4b71Sopenharmony_ci
845e41f4b71Sopenharmony_ci**Since**: 9
846e41f4b71Sopenharmony_ci
847e41f4b71Sopenharmony_ci**Parameters**
848e41f4b71Sopenharmony_ci
849e41f4b71Sopenharmony_ci| Name| Description| 
850e41f4b71Sopenharmony_ci| -------- | -------- |
851e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
852e41f4b71Sopenharmony_ci
853e41f4b71Sopenharmony_ci**Returns**
854e41f4b71Sopenharmony_ci
855e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
856e41f4b71Sopenharmony_ci
857e41f4b71Sopenharmony_ci
858e41f4b71Sopenharmony_ci### OH_NativeBuffer_SetColorSpace()
859e41f4b71Sopenharmony_ci
860e41f4b71Sopenharmony_ci```
861e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_SetColorSpace (OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace colorSpace )
862e41f4b71Sopenharmony_ci```
863e41f4b71Sopenharmony_ci
864e41f4b71Sopenharmony_ci**Description**
865e41f4b71Sopenharmony_ci
866e41f4b71Sopenharmony_ciSets the color space for an **OH_NativeBuffer** instance.
867e41f4b71Sopenharmony_ci
868e41f4b71Sopenharmony_ciThis function is not thread-safe.
869e41f4b71Sopenharmony_ci
870e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
871e41f4b71Sopenharmony_ci
872e41f4b71Sopenharmony_ci**Since**: 11
873e41f4b71Sopenharmony_ci
874e41f4b71Sopenharmony_ci**Parameters**
875e41f4b71Sopenharmony_ci
876e41f4b71Sopenharmony_ci| Name| Description| 
877e41f4b71Sopenharmony_ci| -------- | -------- |
878e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
879e41f4b71Sopenharmony_ci| colorSpace | Color space. For details about the available options, see [OH_NativeBuffer_ColorSpace](#oh_nativebuffer_colorspace).| 
880e41f4b71Sopenharmony_ci
881e41f4b71Sopenharmony_ci**Returns**
882e41f4b71Sopenharmony_ci
883e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
884e41f4b71Sopenharmony_ci
885e41f4b71Sopenharmony_ci
886e41f4b71Sopenharmony_ci### OH_NativeBuffer_SetMetadataValue()
887e41f4b71Sopenharmony_ci
888e41f4b71Sopenharmony_ci```
889e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_SetMetadataValue (OH_NativeBuffer *buffer, OH_NativeBuffer_MetadataKey metadataKey, int32_t size, uint8_t *metaData )
890e41f4b71Sopenharmony_ci```
891e41f4b71Sopenharmony_ci
892e41f4b71Sopenharmony_ci**Description**
893e41f4b71Sopenharmony_ci
894e41f4b71Sopenharmony_ciSets a metadata value for an **OH_NativeBuffer** instance.
895e41f4b71Sopenharmony_ci
896e41f4b71Sopenharmony_ciThis function is not thread-safe.
897e41f4b71Sopenharmony_ci
898e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
899e41f4b71Sopenharmony_ci
900e41f4b71Sopenharmony_ci**Since**: 12
901e41f4b71Sopenharmony_ci
902e41f4b71Sopenharmony_ci**Parameters**
903e41f4b71Sopenharmony_ci
904e41f4b71Sopenharmony_ci| Name| Description| 
905e41f4b71Sopenharmony_ci| -------- | -------- |
906e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
907e41f4b71Sopenharmony_ci| metadataKey | Key of the metadata. For details about the available options, see [OH_NativeBuffer_MetadataKey](#oh_nativebuffer_metadatakey).| 
908e41f4b71Sopenharmony_ci| size | Size of the uint8_t vector. For details about the available options, see [OH_NativeBuffer_MetadataKey](#oh_nativebuffer_metadatakey).| 
909e41f4b71Sopenharmony_ci| metaDate | Pointer to the uint8_t vector.| 
910e41f4b71Sopenharmony_ci
911e41f4b71Sopenharmony_ci**Returns**
912e41f4b71Sopenharmony_ci
913e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
914e41f4b71Sopenharmony_ci
915e41f4b71Sopenharmony_ci
916e41f4b71Sopenharmony_ci### OH_NativeBuffer_Unmap()
917e41f4b71Sopenharmony_ci
918e41f4b71Sopenharmony_ci```
919e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_Unmap (OH_NativeBuffer *buffer)
920e41f4b71Sopenharmony_ci```
921e41f4b71Sopenharmony_ci
922e41f4b71Sopenharmony_ci**Description**
923e41f4b71Sopenharmony_ci
924e41f4b71Sopenharmony_ciUnmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.
925e41f4b71Sopenharmony_ci
926e41f4b71Sopenharmony_ciThis function is not thread-safe.
927e41f4b71Sopenharmony_ci
928e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
929e41f4b71Sopenharmony_ci
930e41f4b71Sopenharmony_ci**Since**: 9
931e41f4b71Sopenharmony_ci
932e41f4b71Sopenharmony_ci**Parameters**
933e41f4b71Sopenharmony_ci
934e41f4b71Sopenharmony_ci| Name| Description| 
935e41f4b71Sopenharmony_ci| -------- | -------- |
936e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
937e41f4b71Sopenharmony_ci
938e41f4b71Sopenharmony_ci**Returns**
939e41f4b71Sopenharmony_ci
940e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
941e41f4b71Sopenharmony_ci
942e41f4b71Sopenharmony_ci
943e41f4b71Sopenharmony_ci### OH_NativeBuffer_Unreference()
944e41f4b71Sopenharmony_ci
945e41f4b71Sopenharmony_ci```
946e41f4b71Sopenharmony_ciint32_t OH_NativeBuffer_Unreference (OH_NativeBuffer *buffer)
947e41f4b71Sopenharmony_ci```
948e41f4b71Sopenharmony_ci
949e41f4b71Sopenharmony_ci**Description**
950e41f4b71Sopenharmony_ci
951e41f4b71Sopenharmony_ciDecreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.
952e41f4b71Sopenharmony_ci
953e41f4b71Sopenharmony_ciThis function is not thread-safe.
954e41f4b71Sopenharmony_ci
955e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Graphic.Graphic2D.NativeBuffer
956e41f4b71Sopenharmony_ci
957e41f4b71Sopenharmony_ci**Since**: 9
958e41f4b71Sopenharmony_ci
959e41f4b71Sopenharmony_ci**Parameters**
960e41f4b71Sopenharmony_ci
961e41f4b71Sopenharmony_ci| Name| Description| 
962e41f4b71Sopenharmony_ci| -------- | -------- |
963e41f4b71Sopenharmony_ci| buffer | Pointer to an **OH_NativeBuffer** instance.| 
964e41f4b71Sopenharmony_ci
965e41f4b71Sopenharmony_ci**Returns**
966e41f4b71Sopenharmony_ci
967e41f4b71Sopenharmony_ciReturns **0** if the operation is successful; returns an error code defined in [OHNativeErrorCode](#ohnativeerrorcode) otherwise.
968