17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci/** 177777dab0Sopenharmony_ci * @addtogroup ImageEffect 187777dab0Sopenharmony_ci * @{ 197777dab0Sopenharmony_ci * 207777dab0Sopenharmony_ci * @brief Provides APIs for obtaining and using a image effect. 217777dab0Sopenharmony_ci * 227777dab0Sopenharmony_ci * @since 12 237777dab0Sopenharmony_ci */ 247777dab0Sopenharmony_ci 257777dab0Sopenharmony_ci/** 267777dab0Sopenharmony_ci * @file image_effect.h 277777dab0Sopenharmony_ci * 287777dab0Sopenharmony_ci * @brief Declares the functions for rendering image. 297777dab0Sopenharmony_ci * 307777dab0Sopenharmony_ci * @library libimage_effect.so 317777dab0Sopenharmony_ci * @kit ImageKit 327777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 337777dab0Sopenharmony_ci * @since 12 347777dab0Sopenharmony_ci */ 357777dab0Sopenharmony_ci 367777dab0Sopenharmony_ci#ifndef NATIVE_IMAGE_EFFECT_H 377777dab0Sopenharmony_ci#define NATIVE_IMAGE_EFFECT_H 387777dab0Sopenharmony_ci 397777dab0Sopenharmony_ci#include "image_effect_errors.h" 407777dab0Sopenharmony_ci#include "image_effect_filter.h" 417777dab0Sopenharmony_ci#include "native_buffer/native_buffer.h" 427777dab0Sopenharmony_ci#include "native_window/external_window.h" 437777dab0Sopenharmony_ci#include "multimedia/image_framework/image/picture_native.h" 447777dab0Sopenharmony_ci 457777dab0Sopenharmony_ci#ifdef __cplusplus 467777dab0Sopenharmony_ciextern "C" { 477777dab0Sopenharmony_ci#endif 487777dab0Sopenharmony_ci 497777dab0Sopenharmony_ci/** 507777dab0Sopenharmony_ci * @brief Define the new type name OH_ImageEffect for struct OH_ImageEffect 517777dab0Sopenharmony_ci * 527777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 537777dab0Sopenharmony_ci * @since 12 547777dab0Sopenharmony_ci */ 557777dab0Sopenharmony_citypedef struct OH_ImageEffect OH_ImageEffect; 567777dab0Sopenharmony_ci 577777dab0Sopenharmony_ci/** 587777dab0Sopenharmony_ci * @brief Create an OH_ImageEffect instance. It should be noted that the life cycle of the OH_ImageEffect instance 597777dab0Sopenharmony_ci * pointed to by the return value * needs to be manually released by {@link OH_ImageEffect_Release} 607777dab0Sopenharmony_ci * 617777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 627777dab0Sopenharmony_ci * @param name The name of image effect 637777dab0Sopenharmony_ci * @return Returns a pointer to an OH_ImageEffect instance if the execution is successful, otherwise returns nullptr 647777dab0Sopenharmony_ci * @since 12 657777dab0Sopenharmony_ci */ 667777dab0Sopenharmony_ciOH_ImageEffect *OH_ImageEffect_Create(const char *name); 677777dab0Sopenharmony_ci 687777dab0Sopenharmony_ci/** 697777dab0Sopenharmony_ci * @brief Create and add the OH_EffectFilter to the OH_ImageEffect 707777dab0Sopenharmony_ci * 717777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 727777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 737777dab0Sopenharmony_ci * @param filterName Indicates the name of the filter that can be customized by the developer or supported by the system 747777dab0Sopenharmony_ci * @return Returns a pointer to an OH_EffectFilter instance if the filter name is valid, otherwise returns nullptr 757777dab0Sopenharmony_ci * @since 12 767777dab0Sopenharmony_ci */ 777777dab0Sopenharmony_ciOH_EffectFilter *OH_ImageEffect_AddFilter(OH_ImageEffect *imageEffect, const char *filterName); 787777dab0Sopenharmony_ci 797777dab0Sopenharmony_ci/** 807777dab0Sopenharmony_ci * @brief Add the OH_EffectFilter to the OH_ImageEffect by the OH_EffectFilter instance pointer 817777dab0Sopenharmony_ci * 827777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 837777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 847777dab0Sopenharmony_ci * @param filter Indicates the filter instance that created by invoking OH_EffectFilter_Create 857777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 867777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 877777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer 887777dab0Sopenharmony_ci * @since 12 897777dab0Sopenharmony_ci */ 907777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_AddFilterByFilter(OH_ImageEffect *imageEffect, OH_EffectFilter *filter); 917777dab0Sopenharmony_ci 927777dab0Sopenharmony_ci/** 937777dab0Sopenharmony_ci * @brief Create and add the OH_EffectFilter to the OH_ImageEffect by specified position 947777dab0Sopenharmony_ci * 957777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 967777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 977777dab0Sopenharmony_ci * @param index Indicates the position of the OH_EffectFilter witch is created and added 987777dab0Sopenharmony_ci * @param filterName Indicates the name of the filter that can be customized by the developer or supported by the system 997777dab0Sopenharmony_ci * @return Returns a pointer to an OH_EffectFilter instance if the index and filter name is valid, otherwise returns 1007777dab0Sopenharmony_ci * nullptr 1017777dab0Sopenharmony_ci * @since 12 1027777dab0Sopenharmony_ci */ 1037777dab0Sopenharmony_ciOH_EffectFilter *OH_ImageEffect_InsertFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName); 1047777dab0Sopenharmony_ci 1057777dab0Sopenharmony_ci/** 1067777dab0Sopenharmony_ci * @brief Insert the OH_EffectFilter to the OH_ImageEffect by the OH_EffectFilter instance pointer 1077777dab0Sopenharmony_ci * 1087777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 1097777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 1107777dab0Sopenharmony_ci * @param index Indicates the position of the OH_EffectFilter witch is added 1117777dab0Sopenharmony_ci * @param filter Indicates the filter instance that created by invoking OH_EffectFilter_Create 1127777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 1137777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 1147777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer or the index is invalid value 1157777dab0Sopenharmony_ci * @since 12 1167777dab0Sopenharmony_ci */ 1177777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_InsertFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index, 1187777dab0Sopenharmony_ci OH_EffectFilter *filter); 1197777dab0Sopenharmony_ci 1207777dab0Sopenharmony_ci/** 1217777dab0Sopenharmony_ci * @brief Remove all filters of the specified filter name 1227777dab0Sopenharmony_ci * 1237777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 1247777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 1257777dab0Sopenharmony_ci * @param filterName Indicates the name of the filter that can be customized by the developer or supported by the system 1267777dab0Sopenharmony_ci * @return Returns the number of the filters that matches the specified filter name 1277777dab0Sopenharmony_ci * @since 12 1287777dab0Sopenharmony_ci */ 1297777dab0Sopenharmony_ciint32_t OH_ImageEffect_RemoveFilter(OH_ImageEffect *imageEffect, const char *filterName); 1307777dab0Sopenharmony_ci 1317777dab0Sopenharmony_ci/** 1327777dab0Sopenharmony_ci * @brief Remove the filter of the specified position 1337777dab0Sopenharmony_ci * 1347777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 1357777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 1367777dab0Sopenharmony_ci * @param index Indicates the position of the OH_EffectFilter witch is removed 1377777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 1387777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 1397777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer or the index is invalid value 1407777dab0Sopenharmony_ci * @since 12 1417777dab0Sopenharmony_ci */ 1427777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_RemoveFilterByIndex(OH_ImageEffect *imageEffect, uint32_t index); 1437777dab0Sopenharmony_ci 1447777dab0Sopenharmony_ci/** 1457777dab0Sopenharmony_ci * @brief Create and replace the OH_EffectFilter in the OH_ImageEffect by the filter name 1467777dab0Sopenharmony_ci * 1477777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 1487777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 1497777dab0Sopenharmony_ci * @param index Indicates the position of the OH_EffectFilter witch is created and replaced 1507777dab0Sopenharmony_ci * @param filterName Indicates the name of the filter that can be customized by the developer or supported by the system 1517777dab0Sopenharmony_ci * @return Returns a pointer to an OH_EffectFilter instance if the index and filter name is valid, otherwise returns 1527777dab0Sopenharmony_ci * nullptr 1537777dab0Sopenharmony_ci * @since 12 1547777dab0Sopenharmony_ci */ 1557777dab0Sopenharmony_ciOH_EffectFilter *OH_ImageEffect_ReplaceFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName); 1567777dab0Sopenharmony_ci 1577777dab0Sopenharmony_ci/** 1587777dab0Sopenharmony_ci * @brief Replace the OH_EffectFilter in the OH_ImageEffect by the OH_EffectFilter instance pointer 1597777dab0Sopenharmony_ci * 1607777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 1617777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 1627777dab0Sopenharmony_ci * @param index Indicates the position of the OH_EffectFilter witch is replaced 1637777dab0Sopenharmony_ci * @param filter Indicates the filter instance that created by invoking OH_EffectFilter_Create 1647777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 1657777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 1667777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer or the index is invalid value 1677777dab0Sopenharmony_ci * @since 12 1687777dab0Sopenharmony_ci */ 1697777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_ReplaceFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index, 1707777dab0Sopenharmony_ci OH_EffectFilter *filter); 1717777dab0Sopenharmony_ci 1727777dab0Sopenharmony_ci/** 1737777dab0Sopenharmony_ci * @brief Get the number of the filters in OH_ImageEffect 1747777dab0Sopenharmony_ci * 1757777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 1767777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 1777777dab0Sopenharmony_ci * @return Returns the number of the filters in OH_ImageEffect 1787777dab0Sopenharmony_ci * @since 12 1797777dab0Sopenharmony_ci */ 1807777dab0Sopenharmony_ciint32_t OH_ImageEffect_GetFilterCount(OH_ImageEffect *imageEffect); 1817777dab0Sopenharmony_ci 1827777dab0Sopenharmony_ci/** 1837777dab0Sopenharmony_ci * @brief Get an OH_EffectFilter instance that add to OH_ImageEffect by the index 1847777dab0Sopenharmony_ci * 1857777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 1867777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 1877777dab0Sopenharmony_ci * @param index Indicates the position of the OH_EffectFilter that add to OH_ImageEffect 1887777dab0Sopenharmony_ci * @return Returns a pointer to an OH_EffectFilter instance if the index is valid, otherwise returns nullptr 1897777dab0Sopenharmony_ci * @since 12 1907777dab0Sopenharmony_ci */ 1917777dab0Sopenharmony_ciOH_EffectFilter *OH_ImageEffect_GetFilter(OH_ImageEffect *imageEffect, uint32_t index); 1927777dab0Sopenharmony_ci 1937777dab0Sopenharmony_ci/** 1947777dab0Sopenharmony_ci * @brief Set configuration information to the OH_ImageEffect 1957777dab0Sopenharmony_ci * 1967777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 1977777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 1987777dab0Sopenharmony_ci * @param key Indicates the key of the configuration 1997777dab0Sopenharmony_ci * @param value Indicates the value corresponding to the key of the configuration 2007777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 2017777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 2027777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 2037777dab0Sopenharmony_ci * {@link EFFECT_KEY_ERROR}, the key of the configuration parameter is invalid. 2047777dab0Sopenharmony_ci * {@link EFFECT_PARAM_ERROR}, the value of the configuration parameter is invalid. 2057777dab0Sopenharmony_ci * @since 12 2067777dab0Sopenharmony_ci */ 2077777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_Configure(OH_ImageEffect *imageEffect, const char *key, 2087777dab0Sopenharmony_ci const ImageEffect_Any *value); 2097777dab0Sopenharmony_ci 2107777dab0Sopenharmony_ci/** 2117777dab0Sopenharmony_ci * @brief Set the Surface to the image effect, this interface must be called before 2127777dab0Sopenharmony_ci * @{link OH_ImageEffect_GetInputSurface} is called 2137777dab0Sopenharmony_ci * 2147777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 2157777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 2167777dab0Sopenharmony_ci * @param nativeWindow A pointer to a OHNativeWindow instance, see {@link OHNativeWindow} 2177777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 2187777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 2197777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 2207777dab0Sopenharmony_ci * @since 12 2217777dab0Sopenharmony_ci */ 2227777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_SetOutputSurface(OH_ImageEffect *imageEffect, OHNativeWindow *nativeWindow); 2237777dab0Sopenharmony_ci 2247777dab0Sopenharmony_ci/** 2257777dab0Sopenharmony_ci * @brief Get the input Surface from the image effect, this interface must be called after 2267777dab0Sopenharmony_ci * @{link OH_ImageEffect_SetOutputSurface} is called 2277777dab0Sopenharmony_ci * 2287777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 2297777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 2307777dab0Sopenharmony_ci * @param nativeWindow A pointer to a OHNativeWindow instance, see {@link OHNativeWindow} 2317777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 2327777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 2337777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 2347777dab0Sopenharmony_ci * @since 12 2357777dab0Sopenharmony_ci */ 2367777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_GetInputSurface(OH_ImageEffect *imageEffect, OHNativeWindow **nativeWindow); 2377777dab0Sopenharmony_ci 2387777dab0Sopenharmony_ci/** 2397777dab0Sopenharmony_ci * @brief Set input pixelmap that contains the image information. It should be noted that the input pixel map will be 2407777dab0Sopenharmony_ci * directly rendered and modified if the output is not set 2417777dab0Sopenharmony_ci * 2427777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 2437777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 2447777dab0Sopenharmony_ci * @param pixelmap Indicates the OH_PixelmapNative that contains the image information 2457777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 2467777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 2477777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 2487777dab0Sopenharmony_ci * @since 12 2497777dab0Sopenharmony_ci */ 2507777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_SetInputPixelmap(OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap); 2517777dab0Sopenharmony_ci 2527777dab0Sopenharmony_ci/** 2537777dab0Sopenharmony_ci * @brief Set output pixelmap that contains the image information 2547777dab0Sopenharmony_ci * 2557777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 2567777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 2577777dab0Sopenharmony_ci * @param pixelmap Indicates the OH_PixelmapNative that contains the image information 2587777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 2597777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 2607777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 2617777dab0Sopenharmony_ci * @since 12 2627777dab0Sopenharmony_ci */ 2637777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_SetOutputPixelmap(OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap); 2647777dab0Sopenharmony_ci 2657777dab0Sopenharmony_ci/** 2667777dab0Sopenharmony_ci * @brief Set input NativeBuffer that contains the image information. It should be noted that the input NativeBuffer 2677777dab0Sopenharmony_ci * will be directly rendered and modified if the output is not set 2687777dab0Sopenharmony_ci * 2697777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 2707777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 2717777dab0Sopenharmony_ci * @param nativeBuffer Indicates the NativeBuffer that contains the image information 2727777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 2737777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 2747777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 2757777dab0Sopenharmony_ci * @since 12 2767777dab0Sopenharmony_ci */ 2777777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_SetInputNativeBuffer(OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer); 2787777dab0Sopenharmony_ci 2797777dab0Sopenharmony_ci/** 2807777dab0Sopenharmony_ci * @brief Set output NativeBuffer that contains the image information 2817777dab0Sopenharmony_ci * 2827777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 2837777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 2847777dab0Sopenharmony_ci * @param nativeBuffer Indicates the NativeBuffer that contains the image information 2857777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 2867777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 2877777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 2887777dab0Sopenharmony_ci * @since 12 2897777dab0Sopenharmony_ci */ 2907777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_SetOutputNativeBuffer(OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer); 2917777dab0Sopenharmony_ci 2927777dab0Sopenharmony_ci/** 2937777dab0Sopenharmony_ci * @brief Set input URI of the image. It should be noted that the image resource will be directly rendered and modified 2947777dab0Sopenharmony_ci * if the output is not set 2957777dab0Sopenharmony_ci * 2967777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 2977777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 2987777dab0Sopenharmony_ci * @param uri An URI for a image resource 2997777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 3007777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 3017777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 3027777dab0Sopenharmony_ci * @since 12 3037777dab0Sopenharmony_ci */ 3047777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_SetInputUri(OH_ImageEffect *imageEffect, const char *uri); 3057777dab0Sopenharmony_ci 3067777dab0Sopenharmony_ci/** 3077777dab0Sopenharmony_ci * @brief Set output URI of the image 3087777dab0Sopenharmony_ci * 3097777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 3107777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 3117777dab0Sopenharmony_ci * @param uri An URI for a image resource 3127777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 3137777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 3147777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 3157777dab0Sopenharmony_ci * @since 12 3167777dab0Sopenharmony_ci */ 3177777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_SetOutputUri(OH_ImageEffect *imageEffect, const char *uri); 3187777dab0Sopenharmony_ci 3197777dab0Sopenharmony_ci/** 3207777dab0Sopenharmony_ci * @brief Set input picture that contains the image information. It should be noted that the input picture will be 3217777dab0Sopenharmony_ci * directly rendered and modified if the output is not set 3227777dab0Sopenharmony_ci * 3237777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 3247777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 3257777dab0Sopenharmony_ci * @param picture Indicates the OH_PictureNative that contains the image information 3267777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 3277777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 3287777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 3297777dab0Sopenharmony_ci * @since 13 3307777dab0Sopenharmony_ci */ 3317777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_SetInputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture); 3327777dab0Sopenharmony_ci 3337777dab0Sopenharmony_ci/** 3347777dab0Sopenharmony_ci * @brief Set output picture that contains the image information 3357777dab0Sopenharmony_ci * 3367777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 3377777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 3387777dab0Sopenharmony_ci * @param picture Indicates the OH_PictureNative that contains the image information 3397777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 3407777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 3417777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 3427777dab0Sopenharmony_ci * @since 13 3437777dab0Sopenharmony_ci */ 3447777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture); 3457777dab0Sopenharmony_ci 3467777dab0Sopenharmony_ci/** 3477777dab0Sopenharmony_ci * @brief Render the filter effects that can be a single filter or a chain of filters 3487777dab0Sopenharmony_ci * 3497777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 3507777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 3517777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 3527777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 3537777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 3547777dab0Sopenharmony_ci * {@link EFFECT_INPUT_OUTPUT_NOT_SUPPORTED}, the data types of the input and output images 3557777dab0Sopenharmony_ci * to be processed are different. 3567777dab0Sopenharmony_ci * {@link EFFECT_COLOR_SPACE_NOT_MATCH}, the color spaces of the input and output images are different. 3577777dab0Sopenharmony_ci * {@link EFFECT_ALLOCATE_MEMORY_FAILED}, the buffer fails to be allocated. 3587777dab0Sopenharmony_ci * @since 12 3597777dab0Sopenharmony_ci */ 3607777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_Start(OH_ImageEffect *imageEffect); 3617777dab0Sopenharmony_ci 3627777dab0Sopenharmony_ci/** 3637777dab0Sopenharmony_ci * @brief Stop rendering the filter effects for next image frame data 3647777dab0Sopenharmony_ci * 3657777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 3667777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 3677777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 3687777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 3697777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 3707777dab0Sopenharmony_ci * @since 12 3717777dab0Sopenharmony_ci */ 3727777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_Stop(OH_ImageEffect *imageEffect); 3737777dab0Sopenharmony_ci 3747777dab0Sopenharmony_ci/** 3757777dab0Sopenharmony_ci * @brief Clear the internal resources of the OH_ImageEffect and destroy the OH_ImageEffect instance 3767777dab0Sopenharmony_ci * 3777777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 3787777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 3797777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 3807777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 3817777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 3827777dab0Sopenharmony_ci * @since 12 3837777dab0Sopenharmony_ci */ 3847777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_Release(OH_ImageEffect *imageEffect); 3857777dab0Sopenharmony_ci 3867777dab0Sopenharmony_ci/** 3877777dab0Sopenharmony_ci * @brief Convert the OH_ImageEffect and the information of the filters in OH_ImageEffect to JSON string 3887777dab0Sopenharmony_ci * 3897777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 3907777dab0Sopenharmony_ci * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer 3917777dab0Sopenharmony_ci * @param info Indicates the serialized information that is obtained by converting the information of the filters in 3927777dab0Sopenharmony_ci * OH_ImageEffect to JSON string 3937777dab0Sopenharmony_ci * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to 3947777dab0Sopenharmony_ci * {@link ImageEffect_ErrorCode} 3957777dab0Sopenharmony_ci * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. 3967777dab0Sopenharmony_ci * @since 12 3977777dab0Sopenharmony_ci */ 3987777dab0Sopenharmony_ciImageEffect_ErrorCode OH_ImageEffect_Save(OH_ImageEffect *imageEffect, char **info); 3997777dab0Sopenharmony_ci 4007777dab0Sopenharmony_ci/** 4017777dab0Sopenharmony_ci * @brief Create an OH_ImageEffect instance by deserializing the JSON string info 4027777dab0Sopenharmony_ci * 4037777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.ImageEffect.Core 4047777dab0Sopenharmony_ci * @param info Indicates the serialized information that is obtained by converting the information of the filters in 4057777dab0Sopenharmony_ci * OH_ImageEffect to JSON string 4067777dab0Sopenharmony_ci * @return Returns a pointer to an OH_ImageEffect instance if the execution is successful, otherwise returns nullptr 4077777dab0Sopenharmony_ci * @since 12 4087777dab0Sopenharmony_ci */ 4097777dab0Sopenharmony_ciOH_ImageEffect *OH_ImageEffect_Restore(const char *info); 4107777dab0Sopenharmony_ci 4117777dab0Sopenharmony_ci#ifdef __cplusplus 4127777dab0Sopenharmony_ci} 4137777dab0Sopenharmony_ci#endif 4147777dab0Sopenharmony_ci#endif // NATIVE_IMAGE_EFFECT_H 4157777dab0Sopenharmony_ci/** @} */