harmony 鸿蒙image_effect_filter.h

2025-06-12 浏览 (1)

image_effect_filter.h

Overview

The image_effect_filter.h file declares the APIs related to an image effect filter.

With these APIs, you can quickly implement basic effect processing or connect multiple filters in series in an image effector to implement complex effect processing. The system provides basic effect processing filters such as brightness and crop filters.

Library: libimage_effect.so

File to include: <multimedia/image_effect/image_effect_filter.h>

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Related module: ImageEffect

Summary

Structs

NameDescription
union ImageEffect_DataValueDescribes the data values.
struct ImageEffect_AnyDescribes the image effect parameters.
struct ImageEffect_FilterNamesDescribes the filter name information.
struct ImageEffect_FilterDelegateDescribes the callback functions of a custom filter.
struct ImageEffect_RegionDescribes the image region.
struct ImageEffect_SizeDescribes the image size.

Macros

NameDescription
OH_EFFECT_BRIGHTNESS_FILTER "Brightness"Brightness filter. The corresponding parameter is OH_EFFECT_FILTER_INTENSITY_KEY and the parameter type is EFFECT_DATA_TYPE_FLOAT.
OH_EFFECT_CONTRAST_FILTER "Contrast"Contrast filter. The corresponding parameter is OH_EFFECT_FILTER_INTENSITY_KEY and the parameter type is EFFECT_DATA_TYPE_FLOAT.
OH_EFFECT_CROP_FILTER "Crop"Crop filter. The corresponding parameter is OH_EFFECT_FILTER_REGION_KEY, the parameter type is EFFECT_DATA_TYPE_PTR, and the parameter value is ImageEffect_Region.
OH_EFFECT_FILTER_INTENSITY_KEY "FilterIntensity"Intensity filter.
OH_EFFECT_FILTER_REGION_KEY "FilterRegion"Image region filter.

Types

NameDescription
typedef struct OH_EffectFilter OH_EffectFilterDefines a struct for the image effect filter.
typedef enum ImageEffect_DataType ImageEffect_DataTypeDefines an enum for the data types.
typedef union ImageEffect_DataValue ImageEffect_DataValueDefines a union for the data values.
typedef struct ImageEffect_Any ImageEffect_AnyDefines a struct for the image effect parameters.
typedef enum ImageEffect_Format ImageEffect_FormatDefines an enum for the pixel formats.
typedef enum ImageEffect_BufferType ImageEffect_BufferTypeDefines an enum for the buffer types.
typedef struct OH_EffectFilterInfo OH_EffectFilterInfoDefines a struct for the filter information.
typedef struct ImageEffect_FilterNames ImageEffect_FilterNamesDefines a struct for the filter name information.
typedef struct OH_EffectBufferInfo OH_EffectBufferInfoDefines a struct for the buffer information.
typedef bool(* OH_EffectFilterDelegate_SetValue) (OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value)Defines a pointer to the callback function for setting parameters of a custom filter. It is used to verify parameters and parameter values.
typedef void(* OH_EffectFilterDelegate_PushData) (OH_EffectFilter *filter, OH_EffectBufferInfo *info)Defines a pointer to the callback function used by a custom filter to push image data to the next-level filter.
typedef bool(* OH_EffectFilterDelegate_Render) (OH_EffectFilter *filter, OH_EffectBufferInfo *info, OH_EffectFilterDelegate_PushData pushData)Defines a pointer to the callback function for rendering an image using a custom filter.
typedef bool(* OH_EffectFilterDelegate_Save) (OH_EffectFilter *filter, char **info)Defines a pointer to the callback function for serializing a custom filter. Filters are serialized in JSON format.
typedef OH_EffectFilter *(* OH_EffectFilterDelegate_Restore) (const char *info)Defines a pointer to the callback function for deserializing a custom filter.
typedef struct ImageEffect_FilterDelegate ImageEffect_FilterDelegateDescribes the callback functions of a custom filter.
typedef struct ImageEffect_Region ImageEffect_RegionDefines a struct for the image region.
typedef struct ImageEffect_Size ImageEffect_SizeDefines a struct for the image size.

Enums

NameDescription
ImageEffect_DataType {
EFFECT_DATA_TYPE_UNKNOWN = 0, EFFECT_DATA_TYPE_INT32 = 1,
EFFECT_DATA_TYPE_FLOAT = 2, EFFECT_DATA_TYPE_DOUBLE = 3,
EFFECT_DATA_TYPE_CHAR = 4, EFFECT_DATA_TYPE_LONG = 5,
EFFECT_DATA_TYPE_BOOL = 6, EFFECT_DATA_TYPE_PTR = 7
}
Enumerates the data types.
ImageEffect_Format {
EFFECT_PIXEL_FORMAT_UNKNOWN = 0, EFFECT_PIXEL_FORMAT_RGBA8888 = 1,
EFFECT_PIXEL_FORMAT_NV21 = 2, EFFECT_PIXEL_FORMAT_NV12 = 3,
EFFECT_PIXEL_FORMAT_RGBA1010102 = 4, EFFECT_PIXEL_FORMAT_YCBCR_P010 = 5,
EFFECT_PIXEL_FORMAT_YCRCB_P010 = 6
}
Enumerates the pixel formats.
ImageEffect_BufferType { EFFECT_BUFFER_TYPE_UNKNOWN = 0,
EFFECT_BUFFER_TYPE_PIXEL = 1, EFFECT_BUFFER_TYPE_TEXTURE = 2 }
Enumerates the buffer types.

Functions

NameDescription
OH_EffectFilterInfo * OH_EffectFilterInfo_Create ()Creates an OH_EffectFilterInfo instance. The instance must be released by calling OH_EffectFilterInfo_Release when it is no longer needed.
ImageEffect_ErrorCode OH_EffectFilterInfo_SetFilterName (OH_EffectFilterInfo *info, const char *name)Sets a filter name.
ImageEffect_ErrorCode OH_EffectFilterInfo_GetFilterName (OH_EffectFilterInfo *info, char **name)Obtains a filter name.
ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedBufferTypes (OH_EffectFilterInfo *info, uint32_t size, ImageEffect_BufferType *bufferTypeArray)Sets the buffer types supported by a filter.
ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedBufferTypes (OH_EffectFilterInfo *info, uint32_t *size, ImageEffect_BufferType **bufferTypeArray)Obtains the buffer types supported by a filter.
ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedFormats (OH_EffectFilterInfo *info, uint32_t size, ImageEffect_Format *formatArray)Sets the pixel formats supported by a filter.
ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedFormats (OH_EffectFilterInfo *info, uint32_t *size, ImageEffect_Format **formatArray)Obtains the pixel formats supported by a filter.
ImageEffect_ErrorCode OH_EffectFilterInfo_Release (OH_EffectFilterInfo *info)Destroys an OH_EffectFilterInfo instance.
OH_EffectBufferInfo * OH_EffectBufferInfo_Create ()Creates an OH_EffectBufferInfo instance. The instance must be released by calling OH_EffectBufferInfo_Release when it is no longer needed.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetAddr (OH_EffectBufferInfo *info, void *addr)Sets the address of an effect buffer.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetAddr (OH_EffectBufferInfo *info, void **addr)Obtains the address of an effect buffer.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetWidth (OH_EffectBufferInfo *info, int32_t width)Sets the image width.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetWidth (OH_EffectBufferInfo *info, int32_t *width)Obtains the image width.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetHeight (OH_EffectBufferInfo *info, int32_t height)Sets the image height.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetHeight (OH_EffectBufferInfo *info, int32_t *height)Obtains the image height.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetRowSize (OH_EffectBufferInfo *info, int32_t rowSize)Sets the number of bytes per row for an image.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetRowSize (OH_EffectBufferInfo *info, int32_t *rowSize)Obtains the number of bytes per row of an image.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetEffectFormat (OH_EffectBufferInfo *info, ImageEffect_Format format)Sets the pixel format for an image.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetEffectFormat (OH_EffectBufferInfo *info, ImageEffect_Format *format)Obtains the pixel format of an image.
ImageEffect_ErrorCode OH_EffectBufferInfo_Release (OH_EffectBufferInfo *info)Destroys an OH_EffectBufferInfo instance.
OH_EffectFilter * OH_EffectFilter_Create (const char *name)Creates an OH_EffectFilter instance. The instance must be released by calling OH_EffectFilter_Release when it is no longer needed.
ImageEffect_ErrorCode OH_EffectFilter_SetValue (OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value)Sets a filter parameter.
ImageEffect_ErrorCode OH_EffectFilter_GetValue (OH_EffectFilter *filter, const char *key, ImageEffect_Any *value)Obtains a filter parameter.
ImageEffect_ErrorCode OH_EffectFilter_Register (const OH_EffectFilterInfo *info, const ImageEffect_FilterDelegate *delegate)Registers a custom filter.
ImageEffect_FilterNames * OH_EffectFilter_LookupFilters (const char *key)Obtains filters that meet given conditions.
void OH_EffectFilter_ReleaseFilterNames ()Releases filter name memory resources.
ImageEffect_ErrorCode OH_EffectFilter_LookupFilterInfo (const char *name, OH_EffectFilterInfo *info)Obtains the filter information.
ImageEffect_ErrorCode OH_EffectFilter_Render (OH_EffectFilter *filter, OH_PixelmapNative *inputPixelmap, OH_PixelmapNative *outputPixelmap)Starts image rendering.
ImageEffect_ErrorCode OH_EffectFilter_Release (OH_EffectFilter *filter)Destroys an OH_EffectFilter instance.

你可能感兴趣的鸿蒙文章

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

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/utLIcP