• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# image_packer_mdk.h
2
3
4## Overview
5
6The **image_packer_mdk.h** file declares the APIs used to pack an image or a pixel map into a buffer or file.
7
8The packing process is as follows:
9
101. Call **OH_ImagePacker_Create** to create an **ImagePacker** object.
11
122. Call **OH_ImagePacker_InitNative** to convert the **ImagePacker** object to an **ImagePacker_Native** object.
13
143. Call **OH_ImagePacker_PackToData** or **OH_ImagePacker_PackToFile** to pack the source into the target area with the specified packing options.
15
164. Call **OH_ImagePacker_Release** to release an **ImagePacker_Native** object.
17
18
19**Library**: libimage_packer_ndk.z.so
20
21**System capability**: SystemCapability.Multimedia.Image
22
23**Since**: 11
24
25**Related module**: [Image](image.md)
26
27
28## Summary
29
30
31### Structs
32
33| Name| Description|
34| -------- | -------- |
35| [ImagePacker_Opts_](_image_packer___opts__.md) | Defines the image packing options.|
36
37
38### Types
39
40| Name| Description|
41| -------- | -------- |
42| [ImagePacker_Native](image.md#imagepacker_native) | Defines the **ImagePacker** instance at the native layer.|
43| [ImagePacker_Opts](image.md#imagepacker_opts) | Defines the alias of the image packing options.|
44
45
46### Functions
47
48| Name| Description|
49| -------- | -------- |
50| [OH_ImagePacker_Create](image.md#oh_imagepacker_create) (napi_env env, napi_value \*res) | Obtains an **ImagePacker** object at the JavaScript native layer.|
51| [OH_ImagePacker_InitNative](image.md#oh_imagepacker_initnative) (napi_env env, napi_value packer) | Converts an **ImagePacker** object at the JavaScript native layer to an **ImagePacker_Native** object.|
52| [OH_ImagePacker_PackToData](image.md#oh_imagepacker_packtodata) ([ImagePacker_Native](image.md#imagepacker_native) \*native, napi_value source, [ImagePacker_Opts](image.md#imagepacker_opts) \*opts, uint8_t \*outData, size_t \*size) | Packs a **PixelMap** object at the JavaScript native layer or an **ImagePacker_Native** object to a buffer (defined by **outData**) based on the specified **ImagePacker_Opts** struct.|
53| [OH_ImagePacker_PackToFile](image.md#oh_imagepacker_packtofile) ([ImagePacker_Native](image.md#imagepacker_native) \*native, napi_value source, [ImagePacker_Opts](image.md#imagepacker_opts) \*opts, int fd) | Packs a **PixelMap** object at the JavaScript native layer or an **ImagePacker_Native** object to a file based on the specified **ImagePacker_Opts** struct.|
54| [OH_ImagePacker_Release](image.md#oh_imagepacker_release) ([ImagePacker_Native](image.md#imagepacker_native) \*native) | Releases an [ImagePacker_Native](image.md#imagepacker_native) object. |
55