harmony 鸿蒙image_packer_mdk.h

  • 2025-06-12
  • 浏览 (4)

image_packer_mdk.h

Overview

The image_packer_mdk.h file declares the APIs used to pack an image or a PixelMap into a buffer or file.

The packing process is as follows:

  1. Call OH_ImagePacker_Create to create an ImagePacker object.

  2. Call OH_ImagePacker_InitNative to convert the ImagePacker object to an ImagePacker_Native object.

  3. Call OH_ImagePacker_PackToData or OH_ImagePacker_PackToFile to pack the source into the target area with the specified packing options.

  4. Call OH_ImagePacker_Release to release an ImagePacker_Native object.

Library: libimage_packer_ndk.z.so

File to include: <multimedia/image_framework/image_packer_mdk.h>

System capability: SystemCapability.Multimedia.Image

Since: 11

Related module: Image

Summary

Structs

Name Description
struct ImagePackerOpts Defines the image packing options.

Types

Name Description
typedef struct ImagePackerNative ImagePacker_Native Defines the ImagePacker instance at the native layer.
typedef struct ImagePackerOpts ImagePacker_Opts Defines the alias of the image packing options.

Functions

Name Description
int32_t OH_ImagePacker_Create (napi_env env, napi_value *res) Obtains an ImagePacker object at the JavaScript native layer.
ImagePacker_Native * OH_ImagePacker_InitNative (napi_env env, napi_value packer) Converts an ImagePacker object at the JavaScript native layer into an ImagePacker_Native object.
int32_t OH_ImagePacker_PackToData (ImagePacker_Native *native, napi_value source, ImagePacker_Opts *opts, uint8_t *outData, size_t *size) Packs a PixelMap object or an ImagePacker object at the JavaScript native layer to a buffer (defined by outData) based on the specified ImagePacker_Opts struct.
int32_t OH_ImagePacker_PackToFile (ImagePacker_Native *native, napi_value source, ImagePacker_Opts *opts, int fd) Packs a PixelMap object or an ImagePacker object at the JavaScript native layer to a file based on the specified ImagePacker_Opts struct.
int32_t OH_ImagePacker_Release (ImagePacker_Native *native) Releases an ImagePacker_Native object.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Image Kit

harmony 鸿蒙_image___native_module

harmony 鸿蒙Image_Region

harmony 鸿蒙Image_Size

harmony 鸿蒙Image_String

harmony 鸿蒙ImageEffect

harmony 鸿蒙ImageEffect_Any

harmony 鸿蒙ImageEffect_FilterDelegate

harmony 鸿蒙ImageEffect_FilterNames

harmony 鸿蒙ImageEffect_Region

0  赞