harmony 鸿蒙ImageEffect
ImageEffect
Overview
The ImageEffect module provides the APIs for editing an image.
For details about the development guide and sample, see Using ImageEffect to Edit Images.
Since: 12
Summary
Files
Name | Description |
---|---|
image_effect.h | Declares the APIs related to the image effector. |
image_effect_errors.h | Declares the error codes used by the image effector. |
image_effect_filter.h | Declare the APIs related to the image effect filter. |
Structs
Name | Description |
---|---|
union ImageEffect_DataValue | Describes the data values. |
struct ImageEffect_Any | Describes the image effect parameters. |
struct ImageEffect_FilterNames | Describes the filter name information. |
struct ImageEffect_FilterDelegate | Describes the callback functions of a custom image effect filter. |
struct ImageEffect_Region | Describes the image region. |
struct ImageEffect_Size | Describes the image size. |
Macros
Name | Description |
---|---|
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
Name | Description |
---|---|
typedef struct OH_ImageEffect OH_ImageEffect | Defines a struct for the image effector. |
typedef enum ImageEffect_ErrorCode ImageEffect_ErrorCode | Defines an enum for the error codes used by the image effector. |
typedef struct OH_EffectFilter OH_EffectFilter | Defines a struct for the image effect filter. |
typedef enum ImageEffect_DataType ImageEffect_DataType | Defines an enum for the data types. |
typedef union ImageEffect_DataValue ImageEffect_DataValue | Defines a union for the data values. |
typedef struct ImageEffect_Any ImageEffect_Any | Defines a struct for the image effect parameters. |
typedef enum ImageEffect_Format ImageEffect_Format | Defines an enum for the pixel formats. |
typedef enum ImageEffect_BufferType ImageEffect_BufferType | Defines an enum for the buffer types. |
typedef struct OH_EffectFilterInfo OH_EffectFilterInfo | Defines a struct for the image effect filter information. |
typedef struct ImageEffect_FilterNames ImageEffect_FilterNames | Defines a struct for the filter name information. |
typedef struct OH_EffectBufferInfo OH_EffectBufferInfo | Defines a struct for the image 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_FilterDelegate | Defines a struct for the callback functions of a custom image effect filter. |
typedef struct ImageEffect_Region ImageEffect_Region | Defines a struct for the image region. |
typedef struct ImageEffect_Size ImageEffect_Size | Defines a struct for the image size. |
Enums
Name | Description |
---|---|
ImageEffect_ErrorCode { EFFECT_SUCCESS = 0, EFFECT_ERROR_PERMISSION_DENIED = 201, EFFECT_ERROR_PARAM_INVALID = 401, EFFECT_BUFFER_SIZE_NOT_MATCH = 29000001, EFFECT_COLOR_SPACE_NOT_MATCH = 29000002, EFFECT_INPUT_OUTPUT_NOT_MATCH = 29000101, EFFECT_EFFECT_NUMBER_LIMITED = 29000102, EFFECT_INPUT_OUTPUT_NOT_SUPPORTED = 29000103, EFFECT_ALLOCATE_MEMORY_FAILED = 29000104, EFFECT_PARAM_ERROR = 29000121, EFFECT_KEY_ERROR = 29000122, EFFECT_UNKNOWN = 29000199 } |
Enumerates the error codes used by the image effector. |
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
Name | Description |
---|---|
OH_ImageEffect * OH_ImageEffect_Create (const char *name) | Creates an OH_ImageEffect instance. The instance must be released by calling OH_ImageEffect_Release when it is no longer needed. |
OH_EffectFilter * OH_ImageEffect_AddFilter (OH_ImageEffect *imageEffect, const char *filterName) | Adds a filter. |
ImageEffect_ErrorCode OH_ImageEffect_AddFilterByFilter (OH_ImageEffect *imageEffect, OH_EffectFilter *filter) | Adds a specified filter. |
OH_EffectFilter * OH_ImageEffect_InsertFilter (OH_ImageEffect *imageEffect, uint32_t index, const char *filterName) | Inserts a filter. |
ImageEffect_ErrorCode OH_ImageEffect_InsertFilterByFilter (OH_ImageEffect *imageEffect, uint32_t index, OH_EffectFilter *filter) | Inserts a filter to the specified position. |
int32_t OH_ImageEffect_RemoveFilter (OH_ImageEffect *imageEffect, const char *filterName) | Removes a filter. |
ImageEffect_ErrorCode OH_ImageEffect_RemoveFilterByIndex (OH_ImageEffect *imageEffect, uint32_t index) | Removes a filter from the specified position. |
OH_EffectFilter * OH_ImageEffect_ReplaceFilter (OH_ImageEffect *imageEffect, uint32_t index, const char *filterName) | Replaces a filter. |
ImageEffect_ErrorCode OH_ImageEffect_ReplaceFilterByFilter (OH_ImageEffect *imageEffect, uint32_t index, const char *filterName) | Replaces a filter at the specified position. |
int32_t OH_ImageEffect_GetFilterCount (OH_ImageEffect *imageEffect) | Obtains the number of added filters. |
OH_EffectFilter * OH_ImageEffect_GetFilter (OH_ImageEffect *imageEffect, uint32_t index) | Obtains the information about a filter. |
ImageEffect_ErrorCode OH_ImageEffect_Configure (OH_ImageEffect *imageEffect, const char *key, const ImageEffect_Any *value) | Configures an image effector. |
ImageEffect_ErrorCode OH_ImageEffect_SetOutputSurface (OH_ImageEffect *imageEffect, OHNativeWindow *nativeWindow) | Sets an output surface. |
ImageEffect_ErrorCode OH_ImageEffect_GetInputSurface (OH_ImageEffect *imageEffect, OHNativeWindow **nativeWindow) | Obtains an input surface. |
ImageEffect_ErrorCode OH_ImageEffect_SetInputPixelmap (OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap) | Sets an input PixelMap. |
ImageEffect_ErrorCode OH_ImageEffect_SetOutputPixelmap (OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap) | Sets an output PixelMap. |
ImageEffect_ErrorCode OH_ImageEffect_SetInputNativeBuffer (OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer) | Sets an input native buffer. |
ImageEffect_ErrorCode OH_ImageEffect_SetOutputNativeBuffer (OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer) | Sets an output native buffer. |
ImageEffect_ErrorCode OH_ImageEffect_SetInputUri (OH_ImageEffect *imageEffect, const char *uri) | Sets an input URI. |
ImageEffect_ErrorCode OH_ImageEffect_SetOutputUri (OH_ImageEffect *imageEffect, const char *uri) | Sets an output URI. |
ImageEffect_ErrorCode OH_ImageEffect_SetInputPicture (OH_ImageEffect *imageEffect, OH_PictureNative *picture) | Sets an input picture. |
ImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture (OH_ImageEffect *imageEffect, OH_PictureNative *picture) | Sets an output picture. |
ImageEffect_ErrorCode OH_ImageEffect_Start (OH_ImageEffect *imageEffect) | Starts an image effector. |
ImageEffect_ErrorCode OH_ImageEffect_Stop (OH_ImageEffect *imageEffect) | Stops an image effector. |
ImageEffect_ErrorCode OH_ImageEffect_Release (OH_ImageEffect *imageEffect) | Releases an OH_ImageEffect instance. |
ImageEffect_ErrorCode OH_ImageEffect_Save (OH_ImageEffect *imageEffect, char **info) | Serializes an image effector. |
OH_ImageEffect * OH_ImageEffect_Restore (const char *info) | Deserializes an image effector. |
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. |
Macro Description
OH_EFFECT_BRIGHTNESS_FILTER
#define OH_EFFECT_BRIGHTNESS_FILTER "Brightness"
Description
Brightness filter. The corresponding parameter is OH_EFFECT_FILTER_INTENSITY_KEY and the parameter type is EFFECT_DATA_TYPE_FLOAT.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
OH_EFFECT_CONTRAST_FILTER
#define OH_EFFECT_CONTRAST_FILTER "Contrast"
Description
Contrast filter. The corresponding parameter is OH_EFFECT_FILTER_INTENSITY_KEY and the parameter type is EFFECT_DATA_TYPE_FLOAT.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
OH_EFFECT_CROP_FILTER
#define OH_EFFECT_CROP_FILTER "Crop"
Description
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.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
OH_EFFECT_FILTER_INTENSITY_KEY
#define OH_EFFECT_FILTER_INTENSITY_KEY "FilterIntensity"
Description
Intensity filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
OH_EFFECT_FILTER_REGION_KEY
#define OH_EFFECT_FILTER_REGION_KEY "FilterRegion"
Description
Image region filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Type Description
ImageEffect_Any
typedef struct ImageEffect_Any ImageEffect_Any
Description
Defines a struct for the image effect parameters.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
ImageEffect_BufferType
typedef enum ImageEffect_BufferType ImageEffect_BufferType
Description
Defines an enum for the buffer types.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
ImageEffect_DataType
typedef enum ImageEffect_DataType ImageEffect_DataType
Description
Defines an enum for the data types.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
ImageEffect_DataValue
typedef union ImageEffect_DataValue ImageEffect_DataValue
Description
Defines a union for the data values.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
ImageEffect_ErrorCode
typedef enum ImageEffect_ErrorCode ImageEffect_ErrorCode
Description
Defines an enum for the error codes used by the image effector.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
ImageEffect_FilterDelegate
typedef struct ImageEffect_FilterDelegate ImageEffect_FilterDelegate
Description
Defines a struct for the callback functions of a custom image effect filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
ImageEffect_FilterNames
typedef struct ImageEffect_FilterNames ImageEffect_FilterNames
Description
Defines a struct for the filter name information.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
ImageEffect_Format
typedef enum ImageEffect_Format ImageEffect_Format
Description
Defines an enum for the pixel formats.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
ImageEffect_Region
typedef struct ImageEffect_Region ImageEffect_Region
Description
Defines a struct for the image region.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
ImageEffect_Size
typedef struct ImageEffect_Size ImageEffect_Size
Description
Defines a struct for the image size.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
OH_EffectBufferInfo
typedef struct OH_EffectBufferInfo OH_EffectBufferInfo
Description
Defines a struct for the image buffer information.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
OH_EffectFilter
typedef struct OH_EffectFilter OH_EffectFilter
Description
Defines a struct for the image effect filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
OH_EffectFilterDelegate_PushData
typedef void(* OH_EffectFilterDelegate_PushData) (OH_EffectFilter *filter, OH_EffectBufferInfo *info)
Description
Defines a pointer to the callback function used by a custom filter to push image data to the next-level filter. The function pointer must be actively called in the callback of OH_EffectFilterDelegate_Render.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
info | Pointer to the buffer information, which is OH_EffectBufferInfo. |
OH_EffectFilterDelegate_Render
typedef bool(* OH_EffectFilterDelegate_Render) (OH_EffectFilter *filter, OH_EffectBufferInfo *info, OH_EffectFilterDelegate_PushData pushData)
Description
Defines a pointer to the callback function for rendering an image using a custom filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
info | Pointer to the buffer information, which is OH_EffectBufferInfo. |
pushData | Callback function OH_EffectFilterDelegate_PushData used by the custom filter to push image data to the next-level filter. |
Returns
Returns true if the operation is successful; returns false otherwise.
OH_EffectFilterDelegate_Restore
typedef OH_EffectFilter*(* OH_EffectFilterDelegate_Restore) (const char *info)
Description
Defines a pointer to the callback function for deserializing a custom filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to a serialized JSON string. |
Returns
Returns an OH_EffectFilter instance if the operation is successful; returns a null pointer otherwise.
OH_EffectFilterDelegate_Save
typedef bool(* OH_EffectFilterDelegate_Save) (OH_EffectFilter *filter, char **info)
Description
Defines a pointer to the callback function for serializing a custom filter. Filters are serialized in JSON format.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
info | Double pointer to a char array holding a serialized JSON string. |
Returns
Returns true if the operation is successful; returns false otherwise.
OH_EffectFilterDelegate_SetValue
typedef bool(* OH_EffectFilterDelegate_SetValue) (OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value)
Description
Defines a pointer to the callback function for setting parameters of a custom filter. It is used to verify parameters and parameter values.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
key | Pointer to the key of a filter parameter. |
value | Pointer to the value of the filter parameter. |
Returns
Returns true if the parameter is valid; returns false otherwise.
OH_EffectFilterInfo
typedef struct OH_EffectFilterInfo OH_EffectFilterInfo
Description
Defines a struct for the image effect filter information.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
OH_ImageEffect
typedef struct OH_ImageEffect OH_ImageEffect
Description
Defines a struct for the image effector.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Enum Description
ImageEffect_BufferType
enum ImageEffect_BufferType
Description
Enumerates the buffer types.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Value | Description |
---|---|
EFFECT_BUFFER_TYPE_UNKNOWN | Undefined type. |
EFFECT_BUFFER_TYPE_PIXEL | Pixel image type. |
EFFECT_BUFFER_TYPE_TEXTURE | Texture type. |
ImageEffect_DataType
enum ImageEffect_DataType
Description
Enumerates the data types.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Value | Description |
---|---|
EFFECT_DATA_TYPE_UNKNOWN | Undefined type. |
EFFECT_DATA_TYPE_INT32 | Integer. |
EFFECT_DATA_TYPE_FLOAT | Single-precision floating point. |
EFFECT_DATA_TYPE_DOUBLE | Double-precision floating point. |
EFFECT_DATA_TYPE_CHAR | Byte. |
EFFECT_DATA_TYPE_LONG | Long integer. |
EFFECT_DATA_TYPE_BOOL | Boolean. |
EFFECT_DATA_TYPE_PTR | Pointer. |
ImageEffect_ErrorCode
enum ImageEffect_ErrorCode
Description
Enumerates the error codes used by the image effector.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Value | Description |
---|---|
EFFECT_SUCCESS | The operation is successful. |
EFFECT_ERROR_PERMISSION_DENIED | Permission verification fails. |
EFFECT_ERROR_PARAM_INVALID | Parameter check fails. |
EFFECT_BUFFER_SIZE_NOT_MATCH | The output buffer size does not match. |
EFFECT_COLOR_SPACE_NOT_MATCH | The input and output color spaces do not match. |
EFFECT_INPUT_OUTPUT_NOT_MATCH | The input and output configurations do not match. For example, the input is a surface, but the output is a PixelMap. |
EFFECT_EFFECT_NUMBER_LIMITED | The maximum number is reached. |
EFFECT_INPUT_OUTPUT_NOT_SUPPORTED | The input or output configuration is not supported. |
EFFECT_ALLOCATE_MEMORY_FAILED | Requesting for the buffer fails. |
EFFECT_PARAM_ERROR | Invalid parameter value. For example, the filter parameter value is invalid. |
EFFECT_KEY_ERROR | Invalid parameter. For example, the filter parameter is invalid. |
EFFECT_UNKNOWN | Undefined error. |
ImageEffect_Format
enum ImageEffect_Format
Description
Enumerates the pixel formats.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Value | Description |
---|---|
EFFECT_PIXEL_FORMAT_UNKNOWN | Undefined format. |
EFFECT_PIXEL_FORMAT_RGBA8888 | RGBA8888. |
EFFECT_PIXEL_FORMAT_NV21 | NV21. |
EFFECT_PIXEL_FORMAT_NV12 | NV12. |
EFFECT_PIXEL_FORMAT_RGBA1010102 | 10-bit RGBA. |
EFFECT_PIXEL_FORMAT_YCBCR_P010 | 10-bit YCBCR420. |
EFFECT_PIXEL_FORMAT_YCRCB_P010 | 10-bit YCRCB420. |
Function Description
OH_EffectBufferInfo_Create()
OH_EffectBufferInfo* OH_EffectBufferInfo_Create ()
Description
Creates an OH_EffectBufferInfo instance. The instance must be released by calling OH_EffectBufferInfo_Release when it is no longer needed.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Returns
Returns the pointer to the OH_EffectBufferInfo instance created if the operation is successful; returns a null pointer otherwise.
OH_EffectBufferInfo_GetAddr()
ImageEffect_ErrorCode OH_EffectBufferInfo_GetAddr (OH_EffectBufferInfo * info, void ** addr )
Description
Obtains the address of an effect buffer.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
addr | Double pointer to the virtual address of the image buffer. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_GetEffectFormat()
ImageEffect_ErrorCode OH_EffectBufferInfo_GetEffectFormat (OH_EffectBufferInfo * info, ImageEffect_Format * format )
Description
Obtains the pixel format of an image.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
format | Pointer to the pixel format, which is ImageEffect_Format. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_GetHeight()
ImageEffect_ErrorCode OH_EffectBufferInfo_GetHeight (OH_EffectBufferInfo * info, int32_t * height )
Description
Obtains the image height.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
height | Pointer to the image height, in px. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_GetRowSize()
ImageEffect_ErrorCode OH_EffectBufferInfo_GetRowSize (OH_EffectBufferInfo * info, int32_t * rowSize )
Description
Obtains the number of bytes per row of an image.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
rowSize | Pointer to the number of bytes per row, in bytes. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_GetWidth()
ImageEffect_ErrorCode OH_EffectBufferInfo_GetWidth (OH_EffectBufferInfo * info, int32_t * width )
Description
Obtains the image width.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
width | Pointer to the image width, in px. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_Release()
ImageEffect_ErrorCode OH_EffectBufferInfo_Release (OH_EffectBufferInfo * info)
Description
Destroys an OH_EffectBufferInfo instance.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_SetAddr()
ImageEffect_ErrorCode OH_EffectBufferInfo_SetAddr (OH_EffectBufferInfo * info, void * addr )
Description
Sets the address of an effect buffer.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
addr | Pointer to the virtual address of the image buffer. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_SetEffectFormat()
ImageEffect_ErrorCode OH_EffectBufferInfo_SetEffectFormat (OH_EffectBufferInfo * info, ImageEffect_Format format )
Description
Sets the pixel format for an image.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
format | Pixel format, which is ImageEffect_Format. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_SetHeight()
ImageEffect_ErrorCode OH_EffectBufferInfo_SetHeight (OH_EffectBufferInfo * info, int32_t height )
Description
Sets the image height.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
height | Image height, in px. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_SetRowSize()
ImageEffect_ErrorCode OH_EffectBufferInfo_SetRowSize (OH_EffectBufferInfo * info, int32_t rowSize )
Description
Sets the number of bytes per row for an image.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
rowSize | Number of bytes per row, in bytes. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectBufferInfo_SetWidth()
ImageEffect_ErrorCode OH_EffectBufferInfo_SetWidth (OH_EffectBufferInfo * info, int32_t width )
Description
Sets the image width.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the image information. |
width | Image width, in px. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilter_Create()
OH_EffectFilter* OH_EffectFilter_Create (const char * name)
Description
Creates an OH_EffectFilter instance. The instance must be released by calling OH_EffectFilter_Release when it is no longer needed.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
name | Pointer to the filter name, for example, OH_EFFECT_BRIGHTNESS_FILTER. |
Returns
Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer otherwise.
OH_EffectFilter_GetValue()
ImageEffect_ErrorCode OH_EffectFilter_GetValue (OH_EffectFilter * filter, const char * key, ImageEffect_Any * value )
Description
Obtains a filter parameter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
key | Pointer to the key of the filter parameter, for example, OH_EFFECT_FILTER_INTENSITY_KEY. |
value | Pointer to the value of the filter parameter. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer; returns EFFECT_KEY_ERROR if the key of a parameter is invalid.
OH_EffectFilter_LookupFilterInfo()
ImageEffect_ErrorCode OH_EffectFilter_LookupFilterInfo (const char * name, OH_EffectFilterInfo * info )
Description
Obtains the filter information.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
name | Pointer to the filter name. |
info | Pointer to the filter information, which is OH_EffectFilterInfo. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer or an invalid value.
OH_EffectFilter_LookupFilters()
ImageEffect_FilterNames* OH_EffectFilter_LookupFilters (const char * key)
Description
Obtains filters that meet given conditions.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
key | Pointer to the conditions. You can use the keyword Default to obtain all filters. |
Returns
Returns a list of filter names, which is ImageEffect_FilterNames.
OH_EffectFilter_Register()
ImageEffect_ErrorCode OH_EffectFilter_Register (const OH_EffectFilterInfo * info, const ImageEffect_FilterDelegate * delegate )
Description
Registers a custom filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the filter information, which is OH_EffectFilterInfo. |
delegate | Pointer to the callback function ImageEffect_FilterDelegate of the filter. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilter_Release()
ImageEffect_ErrorCode OH_EffectFilter_Release (OH_EffectFilter * filter)
Description
Destroys an OH_EffectFilter instance.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilter_ReleaseFilterNames()
void OH_EffectFilter_ReleaseFilterNames ()
Description
Releases filter name memory resources.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
OH_EffectFilter_Render()
ImageEffect_ErrorCode OH_EffectFilter_Render (OH_EffectFilter * filter, OH_PixelmapNative * inputPixelmap, OH_PixelmapNative * outputPixelmap )
Description
Starts image rendering.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
inputPixelmap | Pointer to the input image. |
outputPixelmap | Pointer to the output image. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilter_SetValue()
ImageEffect_ErrorCode OH_EffectFilter_SetValue (OH_EffectFilter * filter, const char * key, const ImageEffect_Any * value )
Description
Sets a filter parameter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
key | Pointer to the key of the filter parameter, for example, OH_EFFECT_FILTER_INTENSITY_KEY. |
value | Pointer to the value of the filter parameter. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer; returns EFFECT_KEY_ERROR if the key of a parameter is invalid; returns EFFECT_PARAM_ERROR if the value of a parameter is invalid.
OH_EffectFilterInfo_Create()
OH_EffectFilterInfo* OH_EffectFilterInfo_Create ()
Description
Creates an OH_EffectFilterInfo instance. The instance must be released by calling OH_EffectFilterInfo_Release when it is no longer needed.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Returns
Returns the pointer to the OH_EffectFilterInfo instance created if the operation is successful; returns a null pointer otherwise.
OH_EffectFilterInfo_GetFilterName()
ImageEffect_ErrorCode OH_EffectFilterInfo_GetFilterName (OH_EffectFilterInfo * info, char ** name )
Description
Obtains a filter name.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the filter information. |
name | Double pointer to the char array holding the filter name. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilterInfo_GetSupportedBufferTypes()
ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedBufferTypes (OH_EffectFilterInfo * info, uint32_t * size, ImageEffect_BufferType ** bufferTypeArray )
Description
Obtains the buffer types supported by a filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the filter information. |
size | Pointer to the number of buffer types supported, each of which is ImageEffect_BufferType. |
bufferTypeArray | Double pointer to the array holding the buffer types supported, each of which is ImageEffect_BufferType. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilterInfo_GetSupportedFormats()
ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedFormats (OH_EffectFilterInfo * info, uint32_t * size, ImageEffect_Format ** formatArray )
Description
Obtains the pixel formats supported by a filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the filter information. |
size | Pointer to the number of pixel formats supported, each of which is ImageEffect_Format. |
formatArray | Double pointer to the array holding the pixel formats supported, each of which is ImageEffect_Format. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilterInfo_Release()
ImageEffect_ErrorCode OH_EffectFilterInfo_Release (OH_EffectFilterInfo * info)
Description
Destroys an OH_EffectFilterInfo instance.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the filter information. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilterInfo_SetFilterName()
ImageEffect_ErrorCode OH_EffectFilterInfo_SetFilterName (OH_EffectFilterInfo * info, const char * name )
Description
Sets a filter name.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the filter information. |
name | Pointer to the filter name, for example, OH_EFFECT_BRIGHTNESS_FILTER. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilterInfo_SetSupportedBufferTypes()
ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedBufferTypes (OH_EffectFilterInfo * info, uint32_t size, ImageEffect_BufferType * bufferTypeArray )
Description
Sets the buffer types supported by a filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the filter information. |
size | Number of buffer types supported, each of which is ImageEffect_BufferType. |
bufferTypeArray | Pointer to the array holding the buffer types supported, each of which is ImageEffect_BufferType. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_EffectFilterInfo_SetSupportedFormats()
ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedFormats (OH_EffectFilterInfo * info, uint32_t size, ImageEffect_Format * formatArray )
Description
Sets the pixel formats supported by a filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to the filter information. |
size | Number of pixel formats supported, each of which is ImageEffect_Format. |
formatArray | Pointer to the array holding the pixel formats supported, each of which is ImageEffect_Format. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_AddFilter()
OH_EffectFilter* OH_ImageEffect_AddFilter (OH_ImageEffect * imageEffect, const char * filterName )
Description
Adds a filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
filterName | Pointer to the filter name. |
Returns
Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer if the effector is invalid.
OH_ImageEffect_AddFilterByFilter()
ImageEffect_ErrorCode OH_ImageEffect_AddFilterByFilter(OH_ImageEffect *imageEffect, OH_EffectFilter *filter)
Description
Adds a specified filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
filter | Pointer to the filter. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_Configure()
ImageEffect_ErrorCode OH_ImageEffect_Configure (OH_ImageEffect * imageEffect, const char * key, const ImageEffect_Any * value )
Description
Configures an image effector.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
key | Pointer to the key of a configuration parameter. |
value | Pointer to the value of a configuration parameter. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer; returns EFFECT_KEY_ERROR if the key of a parameter is invalid; returns EFFECT_PARAM_ERROR if the value of a parameter is invalid.
OH_ImageEffect_Create()
OH_ImageEffect* OH_ImageEffect_Create (const char * name)
Description
Creates an OH_ImageEffect instance. The instance must be released by calling OH_ImageEffect_Release when it is no longer needed.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
name | Pointer to the image effector name, which is used to identify the effector and can be customized. You are advised to set it to a non-empty string. |
Returns
Returns the pointer to the OH_ImageEffect instance created if the operation is successful; returns a null pointer otherwise.
OH_ImageEffect_GetFilter()
OH_EffectFilter* OH_ImageEffect_GetFilter (OH_ImageEffect * imageEffect, uint32_t index )
Description
Obtains the information about a filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
index | Index of the filter. |
Returns
Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer if an input parameter is invalid.
OH_ImageEffect_GetFilterCount()
int32_t OH_ImageEffect_GetFilterCount (OH_ImageEffect * imageEffect)
Description
Obtains the number of added filters.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
Returns
Returns the number of filters.
OH_ImageEffect_GetInputSurface()
ImageEffect_ErrorCode OH_ImageEffect_GetInputSurface (OH_ImageEffect * imageEffect, OHNativeWindow ** nativeWindow )
Description
Obtains an input surface.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
nativeWindow | Double pointer to the OHNativeWindow instance. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_InsertFilter()
OH_EffectFilter* OH_ImageEffect_InsertFilter (OH_ImageEffect * imageEffect, uint32_t index, const char * filterName )
Description
Inserts a filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
index | Index of the filter. |
filterName | Pointer to the filter name. |
Returns
Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer if an input parameter is invalid.
OH_ImageEffect_InsertFilterByFilter()
ImageEffect_ErrorCode OH_ImageEffect_InsertFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index, OH_EffectFilter *filter);
Description
Inserts a filter to the specified position.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
index | Index of the filter. |
filter | Pointer to the filter. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_Release()
ImageEffect_ErrorCode OH_ImageEffect_Release (OH_ImageEffect * imageEffect)
Description
Releases an OH_ImageEffect instance.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_RemoveFilter()
int32_t OH_ImageEffect_RemoveFilter (OH_ImageEffect * imageEffect, const char * filterName )
Description
Removes a filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
filterName | Pointer to the filter name. |
Returns
Returns the number of filters.
OH_ImageEffect_RemoveFilterByIndex()
ImageEffect_ErrorCode OH_ImageEffect_RemoveFilterByIndex(OH_ImageEffect *imageEffect, uint32_t index)
Description
Removes a filter from the specified position.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
index | Index of the filter. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_ReplaceFilter()
OH_EffectFilter *OH_ImageEffect_ReplaceFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName)
Description
Replaces a filter.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
filterName | Pointer to the filter name. |
Returns
Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer otherwise.
OH_ImageEffect_ReplaceFilterByFilter()
ImageEffect_ErrorCode OH_ImageEffect_ReplaceFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName);
Description
Replaces a filter at the specified position.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
index | Index of the filter. |
filterName | Pointer to the filter name. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_Restore()
OH_ImageEffect* OH_ImageEffect_Restore (const char * info)
Description
Deserializes an image effector.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
info | Pointer to a serialized JSON string. |
Returns
Returns an OH_ImageEffect instance if the deserialization is successful; returns a null pointer otherwise.
OH_ImageEffect_Save()
ImageEffect_ErrorCode OH_ImageEffect_Save (OH_ImageEffect * imageEffect, char ** info )
Description
Serializes an image effector.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
info | Double pointer to a char array holding a serialized JSON string. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_SetInputNativeBuffer()
ImageEffect_ErrorCode OH_ImageEffect_SetInputNativeBuffer (OH_ImageEffect * imageEffect, OH_NativeBuffer * nativeBuffer )
Description
Sets an input native buffer.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
nativeBuffer | Pointer to the OH_NativeBuffer instance. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_SetInputPicture()
ImageEffect_ErrorCode OH_ImageEffect_SetInputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture)
Description
Sets an input picture.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 13
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
picture | Pointer to an OH_PictureNative instance. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_SetInputPixelmap()
ImageEffect_ErrorCode OH_ImageEffect_SetInputPixelmap (OH_ImageEffect * imageEffect, OH_PixelmapNative * pixelmap )
Description
Sets an input PixelMap.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
pixelmap | Pointer to the OH_PixelmapNative instance. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_SetInputUri()
ImageEffect_ErrorCode OH_ImageEffect_SetInputUri (OH_ImageEffect * imageEffect, const char * uri )
Description
Sets an input URI.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
uri | Pointer to the URI of the image. Only JPEG and HEIF images are supported. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_SetOutputNativeBuffer()
ImageEffect_ErrorCode OH_ImageEffect_SetOutputNativeBuffer (OH_ImageEffect * imageEffect, OH_NativeBuffer * nativeBuffer )
Description
Sets an output native buffer.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
nativeBuffer | Pointer to an OH_NativeBuffer instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input OH_NativeBuffer object. |
Returns
Returns EFFECT_SUCCESS if the operation is successful.
Returns EFFECT_ERROR_PARAM_INVALID if the input parameter of the effector is a null pointer.
Returns EFFECT_PARAM_ERROR if the call fails because of abnormal parameters.
OH_ImageEffect_SetOutputPicture()
ImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture)
Description
Sets an output picture.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 13
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
picture | Pointer to an OH_PictureNative instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input OH_PictureNative object. |
Returns
Returns EFFECT_SUCCESS if the operation is successful.
Returns EFFECT_ERROR_PARAM_INVALID if the input parameter of the effector is a null pointer.
Returns EFFECT_PARAM_ERROR if the call fails because of abnormal parameters.
OH_ImageEffect_SetOutputPixelmap()
ImageEffect_ErrorCode OH_ImageEffect_SetOutputPixelmap (OH_ImageEffect * imageEffect, OH_PixelmapNative * pixelmap )
Description
Sets an output PixelMap.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
pixelmap | Pointer to an OH_PixelmapNative instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input OH_PixelmapNative object. |
Returns
Returns EFFECT_SUCCESS if the operation is successful.
Returns EFFECT_ERROR_PARAM_INVALID if the input parameter of the effector is a null pointer.
Returns EFFECT_PARAM_ERROR if the call fails because of abnormal parameters.
OH_ImageEffect_SetOutputSurface()
ImageEffect_ErrorCode OH_ImageEffect_SetOutputSurface (OH_ImageEffect * imageEffect, OHNativeWindow * nativeWindow )
Description
Sets an output surface.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
nativeWindow | Pointer to the OHNativeWindow instance. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_SetOutputUri()
ImageEffect_ErrorCode OH_ImageEffect_SetOutputUri (OH_ImageEffect * imageEffect, const char * uri )
Description
Sets an output URI.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
uri | Pointer to the URI of the image. The format of the output URI is the same as that of the input URI. If HEIF encoding is not supported, JPEG encoding is used. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
OH_ImageEffect_Start()
ImageEffect_ErrorCode OH_ImageEffect_Start (OH_ImageEffect * imageEffect)
Description
Starts an image effector.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer; returns EFFECT_INPUT_OUTPUT_NOT_SUPPORTED if the data types of the input and output images to be processed are different; returns EFFECT_COLOR_SPACE_NOT_MATCH if the color spaces of the input and output images are different; returns EFFECT_ALLOCATE_MEMORY_FAILED if the buffer fails to be allocated.
OH_ImageEffect_Stop()
ImageEffect_ErrorCode OH_ImageEffect_Stop (OH_ImageEffect * imageEffect)
Description
Stops an image effector.
System capability: SystemCapability.Multimedia.ImageEffect.Core
Since: 12
Parameters
Name | Description |
---|---|
imageEffect | Pointer to the image effector. |
Returns
Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.
你可能感兴趣的鸿蒙文章
harmony 鸿蒙_image___native_module
harmony 鸿蒙ImageEffect_FilterDelegate
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦