• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# image_pixel_map_mdk.h
2
3## Overview
4
5The **image_pixel_map_napi.h** file declares the APIs used to lock, access, and unlock a PixelMap.
6
7**Library**: libpixelmapndk.z.so
8
9**Since**: 10
10
11**Related module**: [Image](capi-image.md)
12
13## Summary
14
15### Structs
16
17| Name| typedef Keyword| Description|
18| -- | -- | -- |
19| [OhosPixelMapInfos](capi-image-ohospixelmapinfos.md) | OhosPixelMapInfos | Describes the information about a PixelMap.|
20| [NativePixelMap_](capi-image-nativepixelmap-.md) | NativePixelMap | Describes the native PixelMap information. It defines the data type name of the PixelMap at the native layer.|
21| [OhosPixelMapCreateOps](capi-image-ohospixelmapcreateops.md) | - | Describes the options used for creating a PixelMap.|
22
23### Enums
24
25| Name| typedef Keyword| Description|
26| -- | -- | -- |
27| [anonymous enum](#pixelmap-alpha-types)| - | Enumerates the PixelMap alpha types.|
28| [anonymous enum](#pixelmap-editing-types)| - | Enumerates the PixelMap editing types.|
29| [OH_PixelMap_AntiAliasingLevel](#oh_pixelmap_antialiasinglevel) | OH_PixelMap_AntiAliasingLevel | Enumerates the anti-aliasing levels used for scaling PixelMaps.|
30
31### Functions
32
33| Name| Description|
34| -- | -- |
35| [int32_t OH_PixelMap_CreatePixelMap(napi_env env, OhosPixelMapCreateOps info,void* buf, size_t len, napi_value* res)](#oh_pixelmap_createpixelmap) | Creates a PixelMap object. Currently, only BGRA input streams are supported.<br>The buffer passed in by this API does not support the stride.<br>This function does not support the DMA memory.|
36| [int32_t OH_PixelMap_CreatePixelMapWithStride(napi_env env, OhosPixelMapCreateOps info,void* buf, size_t len, int32_t rowStride, napi_value* res)](#oh_pixelmap_createpixelmapwithstride) | Creates a PixelMap object.<br>Currently, only BGRA input streams are supported. For a PixelMap in RGBA format (with the size greater than 512\*512), DMA memory is used by default.|
37| [int32_t OH_PixelMap_CreateAlphaPixelMap(napi_env env, napi_value source, napi_value* alpha)](#oh_pixelmap_createalphapixelmap) | Creates a PixelMap object that contains only alpha channel information.|
38| [NativePixelMap* OH_PixelMap_InitNativePixelMap(napi_env env, napi_value source)](#oh_pixelmap_initnativepixelmap) | Initializes a NativePixelMap object.|
39| [int32_t OH_PixelMap_GetBytesNumberPerRow(const NativePixelMap* native, int32_t* num)](#oh_pixelmap_getbytesnumberperrow) | Obtains the number of bytes per row of a NativePixelMap object.|
40| [int32_t OH_PixelMap_GetIsEditable(const NativePixelMap* native, int32_t* editable)](#oh_pixelmap_getiseditable) | Checks whether a NativePixelMap object is editable.|
41| [int32_t OH_PixelMap_IsSupportAlpha(const NativePixelMap* native, int32_t* alpha)](#oh_pixelmap_issupportalpha) | Checks whether a NativePixelMap object supports alpha channels.|
42| [int32_t OH_PixelMap_SetAlphaAble(const NativePixelMap* native, int32_t alpha)](#oh_pixelmap_setalphaable) | Sets an alpha channel for a NativePixelMap object.|
43| [int32_t OH_PixelMap_GetDensity(const NativePixelMap* native, int32_t* density)](#oh_pixelmap_getdensity) | Obtains the pixel density of a NativePixelMap object.|
44| [int32_t OH_PixelMap_SetDensity(const NativePixelMap* native, int32_t density)](#oh_pixelmap_setdensity) | Sets the pixel density for a NativePixelMap object.|
45| [int32_t OH_PixelMap_SetOpacity(const NativePixelMap* native, float opacity)](#oh_pixelmap_setopacity) | Sets the opacity for a NativePixelMap object.|
46| [int32_t OH_PixelMap_Scale(const NativePixelMap* native, float x, float y)](#oh_pixelmap_scale) | Scales a NativePixelMap object.<br>You are advised to use the new function [OH_PixelmapNative_Scale](capi-pixelmap-native-h.md#oh_pixelmapnative_scale) since API version 12.|
47| [int32_t OH_PixelMap_ScaleWithAntiAliasing(const NativePixelMap* native, float x, float y,OH_PixelMap_AntiAliasingLevel level)](#oh_pixelmap_scalewithantialiasing) | Scales a NativePixelMap object based on the specified anti-aliasing level, width, and height.<br>You are advised to use the new function [OH_PixelmapNative_ScaleWithAntiAliasing](capi-pixelmap-native-h.md#oh_pixelmapnative_scalewithantialiasing) since API version 12.|
48| [int32_t OH_PixelMap_Translate(const NativePixelMap* native, float x, float y)](#oh_pixelmap_translate) | Translates a NativePixelMap object.<br>You are advised to use the new function [OH_PixelmapNative_Translate](capi-pixelmap-native-h.md#oh_pixelmapnative_translate) since API version 12.|
49| [int32_t OH_PixelMap_Rotate(const NativePixelMap* native, float angle)](#oh_pixelmap_rotate) | Rotates a NativePixelMap object.<br>You are advised to use the new function [OH_PixelmapNative_Rotate](capi-pixelmap-native-h.md#oh_pixelmapnative_rotate) since API version 12.|
50| [int32_t OH_PixelMap_Flip(const NativePixelMap* native, int32_t x, int32_t y)](#oh_pixelmap_flip) | Flips a NativePixelMap object.<br>You are advised to use the new function [OH_PixelmapNative_Flip](capi-pixelmap-native-h.md#oh_pixelmapnative_flip) since API version 12.|
51| [int32_t OH_PixelMap_Crop(const NativePixelMap* native, int32_t x, int32_t y, int32_t width, int32_t height)](#oh_pixelmap_crop) | Crops a NativePixelMap object.<br>You are advised to use the new function [OH_PixelmapNative_Crop](capi-pixelmap-native-h.md#oh_pixelmapnative_crop) since API version 12.|
52| [int32_t OH_PixelMap_GetImageInfo(const NativePixelMap* native, OhosPixelMapInfos *info)](#oh_pixelmap_getimageinfo) | Obtains the image information of a NativePixelMap object.<br>You are advised to use the new function [OH_PixelmapNative_GetImageInfo](capi-pixelmap-native-h.md#oh_pixelmapnative_getimageinfo) since API version 12.|
53| [int32_t OH_PixelMap_AccessPixels(const NativePixelMap* native, void** addr)](#oh_pixelmap_accesspixels) | Obtains the memory address of a NativePixelMap object and locks the memory.|
54| [int32_t OH_PixelMap_UnAccessPixels(const NativePixelMap* native)](#oh_pixelmap_unaccesspixels) | Unlocks the memory of a NativePixelMap object. This function is used with [OH_PixelMap_AccessPixels](#oh_pixelmap_accesspixels) in pairs.|
55
56## Enum Description
57
58### PixelMap Alpha Types
59
60```
61enum anonymous enum
62```
63
64**Description**
65
66Enumerates the PixelMap alpha types.
67
68**Since**: 10
69
70| Enum Item| Description|
71| -- | -- |
72| OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0 | Unknown format.|
73| OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1 | Opaque format.|
74| OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2 | Premultiplied format.|
75| OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 | Unpremultiplied format.|
76
77### PixelMap Editing Types
78
79```
80enum anonymous enum
81```
82
83**Description**
84
85Enumerates the PixelMap editing types.
86
87**Since**: 10
88
89| Enum Item| Description|
90| -- | -- |
91| OHOS_PIXEL_MAP_READ_ONLY = 0 | Read-only.|
92| OHOS_PIXEL_MAP_EDITABLE = 1 | Editable.|
93
94### OH_PixelMap_AntiAliasingLevel
95
96```
97enum OH_PixelMap_AntiAliasingLevel
98```
99
100**Description**
101
102Enumerates the anti-aliasing levels used for scaling PixelMaps.
103
104**Since**: 12
105
106| Enum Item| Description|
107| -- | -- |
108| OH_PixelMap_AntiAliasing_NONE = 0 | Nearest neighbor interpolation.|
109| OH_PixelMap_AntiAliasing_LOW = 1 | Bilinear interpolation.|
110| OH_PixelMap_AntiAliasing_MEDIUM = 2 | Bilinear interpolation with mipmap enabled. You are advised to use this value when zooming out an image.|
111| OH_PixelMap_AntiAliasing_HIGH = 3 | Cubic interpolation.|
112
113
114## Function Description
115
116### OH_PixelMap_CreatePixelMap()
117
118```
119int32_t OH_PixelMap_CreatePixelMap(napi_env env, OhosPixelMapCreateOps info,void* buf, size_t len, napi_value* res)
120```
121
122**Description**
123
124Creates a PixelMap object. Currently, only BGRA input streams are supported.
125
126The buffer passed in by this API does not support the stride.
127
128This function does not support the DMA memory.
129
130**Since**: 10
131
132
133**Parameters**
134
135| Name| Description|
136| -- | -- |
137| napi_env env | Pointer to the NAPI environment.|
138| [OhosPixelMapCreateOps](capi-image-ohospixelmapcreateops.md) info | Options for setting the PixelMap object.|
139| void* buf | Pointer to the buffer of the image.|
140| size_t len | Image size.|
141| napi_value* res | Pointer to the PixelMap object at the application layer.|
142
143**Returns**
144
145| Type| Description|
146| -- | -- |
147| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: The decoder fails to be created.<br> **IMAGE_RESULT_CREATE_ENCODER_FAILED**: The encoder fails to be created.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_INIT_ABNORMAL**: The image fails to be initialized.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_ENCODE_FAILED**: The image fails to be encoded.<br> **IMAGE_RESULT_HW_DECODE_UNSUPPORT**: Hardware decoding is not supported.<br> **IMAGE_RESULT_HW_DECODE_FAILED**: Hardware decoding fails.<br> **IMAGE_RESULT_INDEX_INVALID**: IPC fails.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
148
149### OH_PixelMap_CreatePixelMapWithStride()
150
151```
152int32_t OH_PixelMap_CreatePixelMapWithStride(napi_env env, OhosPixelMapCreateOps info,void* buf, size_t len, int32_t rowStride, napi_value* res)
153```
154
155**Description**
156
157Creates a PixelMap object.
158
159Currently, only BGRA input streams are supported. For a PixelMap in RGBA format (with the size greater than 512\*512), DMA memory is used by default.
160
161**Since**: 12
162
163
164**Parameters**
165
166| Name| Description|
167| -- | -- |
168| napi_env env | Pointer to the NAPI environment.|
169| [OhosPixelMapCreateOps](capi-image-ohospixelmapcreateops.md) info | Options for setting the PixelMap object.|
170| void* buf | Pointer to the buffer of the image.|
171| size_t len | Buffer size.|
172| int32_t rowStride | Row stride. The stride is the actual memory size occupied by each row of the image, in bytes. Stride = Width \*Number of bytes per pixel + Padding, where padding refers to the extra space added at the end of each row for memory alignment purposes.|
173| napi_value* res | Pointer to the PixelMap object at the application layer.|
174
175**Returns**
176
177| Type| Description|
178| -- | -- |
179| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br>**IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The attribute is invalid or the image data is not supported.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.|
180
181### OH_PixelMap_CreateAlphaPixelMap()
182
183```
184int32_t OH_PixelMap_CreateAlphaPixelMap(napi_env env, napi_value source, napi_value* alpha)
185```
186
187**Description**
188
189Creates a PixelMap object that contains only alpha channel information.
190
191**Since**: 10
192
193
194**Parameters**
195
196| Name| Description|
197| -- | -- |
198| napi_env env | Pointer to the NAPI environment.|
199| napi_value source | PixelMap object at the application layer.|
200| napi_value* alpha | Pointer to the alpha channel.|
201
202**Returns**
203
204| Type| Description|
205| -- | -- |
206| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: The decoder fails to be created.<br> **IMAGE_RESULT_CREATE_ENCODER_FAILED**: The encoder fails to be created.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_INIT_ABNORMAL**: The image fails to be initialized.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_ENCODE_FAILED**: The image fails to be encoded.<br> **IMAGE_RESULT_HW_DECODE_UNSUPPORT**: Hardware decoding is not supported.<br> **IMAGE_RESULT_HW_DECODE_FAILED**: Hardware decoding fails.<br> **IMAGE_RESULT_INDEX_INVALID**: IPC fails.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
207
208### OH_PixelMap_InitNativePixelMap()
209
210```
211NativePixelMap* OH_PixelMap_InitNativePixelMap(napi_env env, napi_value source)
212```
213
214**Description**
215
216Initializes a NativePixelMap object.
217
218**Since**: 10
219
220
221**Parameters**
222
223| Name| Description|
224| -- | -- |
225| napi_env env | Pointer to the NAPI environment.|
226| napi_value source | PixelMap object at the application layer.|
227
228**Returns**
229
230| Type| Description|
231| -- | -- |
232| [NativePixelMap](capi-image-nativepixelmap-.md)* | Pointer to the NativePixelMap object. If the operation fails, an error code is returned.|
233
234### OH_PixelMap_GetBytesNumberPerRow()
235
236```
237int32_t OH_PixelMap_GetBytesNumberPerRow(const NativePixelMap* native, int32_t* num)
238```
239
240**Description**
241
242Obtains the number of bytes per row of a NativePixelMap object.
243
244**Since**: 10
245
246
247**Parameters**
248
249| Name| Description|
250| -- | -- |
251| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
252| int32_t* num | Pointer to the number of bytes per row.|
253
254**Returns**
255
256| Type| Description|
257| -- | -- |
258| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.|
259
260### OH_PixelMap_GetIsEditable()
261
262```
263int32_t OH_PixelMap_GetIsEditable(const NativePixelMap* native, int32_t* editable)
264```
265
266**Description**
267
268Checks whether a NativePixelMap object is editable.
269
270**Since**: 10
271
272
273**Parameters**
274
275| Name| Description|
276| -- | -- |
277| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
278| int32_t* editable |Pointer to the editing type of the NativePixelMap object.|
279
280**Returns**
281
282| Type| Description|
283| -- | -- |
284| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.|
285
286### OH_PixelMap_IsSupportAlpha()
287
288```
289int32_t OH_PixelMap_IsSupportAlpha(const NativePixelMap* native, int32_t* alpha)
290```
291
292**Description**
293
294Checks whether a NativePixelMap object supports alpha channels.
295
296**Since**: 10
297
298
299**Parameters**
300
301| Name| Description|
302| -- | -- |
303| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
304| int32_t* alpha | Pointer to the support for alpha channels.|
305
306**Returns**
307
308| Type| Description|
309| -- | -- |
310| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.|
311
312### OH_PixelMap_SetAlphaAble()
313
314```
315int32_t OH_PixelMap_SetAlphaAble(const NativePixelMap* native, int32_t alpha)
316```
317
318**Description**
319
320Sets an alpha channel for a NativePixelMap object.
321
322**Since**: 10
323
324
325**Parameters**
326
327| Name| Description|
328| -- | -- |
329| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
330| int32_t alpha | Alpha channel to set.|
331
332**Returns**
333
334| Type| Description|
335| -- | -- |
336| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.|
337
338### OH_PixelMap_GetDensity()
339
340```
341int32_t OH_PixelMap_GetDensity(const NativePixelMap* native, int32_t* density)
342```
343
344**Description**
345
346Obtains the pixel density of a NativePixelMap object.
347
348**Since**: 10
349
350
351**Parameters**
352
353| Name| Description|
354| -- | -- |
355| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
356| int32_t* density | Pointer to the pixel density.|
357
358**Returns**
359
360| Type| Description|
361| -- | -- |
362| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.|
363
364### OH_PixelMap_SetDensity()
365
366```
367int32_t OH_PixelMap_SetDensity(const NativePixelMap* native, int32_t density)
368```
369
370**Description**
371
372Sets the pixel density for a NativePixelMap object.
373
374**Since**: 10
375
376
377**Parameters**
378
379| Name| Description|
380| -- | -- |
381| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
382| int32_t density | Pixel density to set.|
383
384**Returns**
385
386| Type| Description|
387| -- | -- |
388| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.|
389
390### OH_PixelMap_SetOpacity()
391
392```
393int32_t OH_PixelMap_SetOpacity(const NativePixelMap* native, float opacity)
394```
395
396**Description**
397
398Sets the opacity for a NativePixelMap object.
399
400**Since**: 10
401
402
403**Parameters**
404
405| Name| Description|
406| -- | -- |
407| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
408| float opacity | Opacity to set.|
409
410**Returns**
411
412| Type| Description|
413| -- | -- |
414| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.|
415
416### OH_PixelMap_Scale()
417
418```
419int32_t OH_PixelMap_Scale(const NativePixelMap* native, float x, float y)
420```
421
422**Description**
423
424Scales a NativePixelMap object.
425
426You are advised to use the new function [OH_PixelmapNative_Scale](capi-pixelmap-native-h.md#oh_pixelmapnative_scale) since API version 12.
427
428**Since**: 10
429
430
431**Parameters**
432
433| Name| Description|
434| -- | -- |
435| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
436| float x | Scale ratio of the width.|
437| float y | Scale ratio of the height.|
438
439**Returns**
440
441| Type| Description|
442| -- | -- |
443| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_INIT_ABNORMAL**: The image fails to be initialized.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
444
445### OH_PixelMap_ScaleWithAntiAliasing()
446
447```
448int32_t OH_PixelMap_ScaleWithAntiAliasing(const NativePixelMap* native, float x, float y,OH_PixelMap_AntiAliasingLevel level)
449```
450
451**Description**
452
453Scales a NativePixelMap object based on the specified anti-aliasing level, width, and height.
454
455You are advised to use the new function [OH_PixelmapNative_ScaleWithAntiAliasing](capi-pixelmap-native-h.md#oh_pixelmapnative_scalewithantialiasing) since API version 12.
456
457**Since**: 12
458
459
460**Parameters**
461
462| Name| Description|
463| -- | -- |
464| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
465| float x | Scale ratio of the width.|
466| float y | Scale ratio of the height.|
467| [OH_PixelMap_AntiAliasingLevel](#oh_pixelmap_antialiasinglevel) level | Anti-aliasing level.|
468
469**Returns**
470
471| Type| Description|
472| -- | -- |
473| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br>**IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.|
474
475### OH_PixelMap_Translate()
476
477```
478int32_t OH_PixelMap_Translate(const NativePixelMap* native, float x, float y)
479```
480
481**Description**
482
483Translates a NativePixelMap object.
484
485You are advised to use the new function [OH_PixelmapNative_Translate](capi-pixelmap-native-h.md#oh_pixelmapnative_translate) since API version 12.
486
487**Since**: 10
488
489
490**Parameters**
491
492| Name| Description|
493| -- | -- |
494| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
495| float x | Horizontal distance to translate.|
496| float y | Vertical distance to translate.|
497
498**Returns**
499
500| Type| Description|
501| -- | -- |
502| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
503
504### OH_PixelMap_Rotate()
505
506```
507int32_t OH_PixelMap_Rotate(const NativePixelMap* native, float angle)
508```
509
510**Description**
511
512Rotates a NativePixelMap object.
513
514You are advised to use the new function [OH_PixelmapNative_Rotate](capi-pixelmap-native-h.md#oh_pixelmapnative_rotate) since API version 12.
515
516**Since**: 10
517
518
519**Parameters**
520
521| Name| Description|
522| -- | -- |
523| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
524| float angle | Angle to rotate.|
525
526**Returns**
527
528| Type| Description|
529| -- | -- |
530| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
531
532### OH_PixelMap_Flip()
533
534```
535int32_t OH_PixelMap_Flip(const NativePixelMap* native, int32_t x, int32_t y)
536```
537
538**Description**
539
540Flips a NativePixelMap object.
541
542You are advised to use the new function [OH_PixelmapNative_Flip](capi-pixelmap-native-h.md#oh_pixelmapnative_flip) since API version 12.
543
544**Since**: 10
545
546
547**Parameters**
548
549| Name| Description|
550| -- | -- |
551| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
552| int32_t x | Whether to flip around the x axis.|
553| int32_t y | Whether to flip around the y axis.|
554
555**Returns**
556
557| Type| Description|
558| -- | -- |
559| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
560
561### OH_PixelMap_Crop()
562
563```
564int32_t OH_PixelMap_Crop(const NativePixelMap* native, int32_t x, int32_t y, int32_t width, int32_t height)
565```
566
567**Description**
568
569Crops a NativePixelMap object.
570
571You are advised to use the new function [OH_PixelmapNative_Crop](capi-pixelmap-native-h.md#oh_pixelmapnative_crop) since API version 12.
572
573**Since**: 10
574
575
576**Parameters**
577
578| Name| Description|
579| -- | -- |
580| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
581| int32_t x | X-coordinate of the upper left corner of the target image.|
582| int32_t y | Y-coordinate of the upper left corner of the target image.|
583| int32_t width | Width of the cropped region.|
584| int32_t height | Height of the cropped region.|
585
586**Returns**
587
588| Type| Description|
589| -- | -- |
590| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
591
592### OH_PixelMap_GetImageInfo()
593
594```
595int32_t OH_PixelMap_GetImageInfo(const NativePixelMap* native, OhosPixelMapInfos *info)
596```
597
598**Description**
599
600Obtains the image information of a NativePixelMap object.
601
602You are advised to use the new function [OH_PixelmapNative_GetImageInfo](capi-pixelmap-native-h.md#oh_pixelmapnative_getimageinfo) since API version 12.
603
604**Since**: 10
605
606
607**Parameters**
608
609| Name| Description|
610| -- | -- |
611| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
612| [OhosPixelMapInfos](capi-image-ohospixelmapinfos.md) *info | Pointer to the image information.|
613
614**Returns**
615
616| Type| Description|
617| -- | -- |
618| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
619
620### OH_PixelMap_AccessPixels()
621
622```
623int32_t OH_PixelMap_AccessPixels(const NativePixelMap* native, void** addr)
624```
625
626**Description**
627
628Obtains the memory address of a NativePixelMap object and locks the memory.
629
630**Since**: 10
631
632
633**Parameters**
634
635| Name| Description|
636| -- | -- |
637| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
638| void** addr | Double pointer to the memory address.|
639
640**Returns**
641
642| Type| Description|
643| -- | -- |
644| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
645
646### OH_PixelMap_UnAccessPixels()
647
648```
649int32_t OH_PixelMap_UnAccessPixels(const NativePixelMap* native)
650```
651
652**Description**
653
654Unlocks the memory of a NativePixelMap object. This function is used with [OH_PixelMap_AccessPixels](#oh_pixelmap_accesspixels) in pairs.
655
656**Since**: 10
657
658
659**Parameters**
660
661| Name| Description|
662| -- | -- |
663| const [NativePixelMap](capi-image-nativepixelmap-.md)* native | Pointer to a NativePixelMap object.|
664
665**Returns**
666
667| Type| Description|
668| -- | -- |
669| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: An error occurs during image data retrieval.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The format check fails.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia decoding fails.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: Sharing the memory fails.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is incorrect.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: The image data is not supported.<br> **IMAGE_RESULT_CROP**: Cropping fails.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: The plugin fails to be registered.<br>**IMAGE_RESULT_PLUGIN_CREATE_FAILED**: The plugin fails to be created.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: A property is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.|
670