1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef C_INCLUDE_EFFECT_FILTER_H 17 #define C_INCLUDE_EFFECT_FILTER_H 18 19 /** 20 * @addtogroup image 21 * @{ 22 * 23 * @brief Provides APIs for obtaining effect filter and information. 24 * 25 * @syscap SystemCapability.Multimedia.Image.Core 26 * @since 12 27 */ 28 29 /** 30 * @file effect_filter.h 31 * 32 * @brief Declares the APIs that can access a effect filter. 33 * 34 * @kit ArkGraphics2D 35 * @library libnative_effect.so 36 * @syscap SystemCapability.Multimedia.Image.Core 37 * @since 12 38 */ 39 40 #include "effect_types.h" 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 /** 46 * @brief Creates an <b>OH_Filter</b> object. 47 * 48 * @syscap SystemCapability.Multimedia.Image.Core 49 * @param pixelmap The pixelmap pointer to create filter. 50 * @param filter The OH_Filter pointer will be operated. 51 * @return Returns {@link EffectErrorCode}. 52 * @since 12 53 * @version 1.0 54 */ 55 EffectErrorCode OH_Filter_CreateEffect(OH_PixelmapNative* pixelmap, OH_Filter** filter); 56 57 /** 58 * @brief Release an <b>OH_Filter</b> object. 59 * 60 * @syscap SystemCapability.Multimedia.Image.Core 61 * @param filter The OH_Filter pointer will be operated. 62 * @return Returns {@link EffectErrorCode} 63 * @since 12 64 * @version 1.0 65 */ 66 EffectErrorCode OH_Filter_Release(OH_Filter* filter); 67 68 /** 69 * @brief Creates a blur effect and then add to the filter. 70 * 71 * @syscap SystemCapability.Multimedia.Image.Core 72 * @param filter The OH_Filter pointer will be operated. 73 * @param radius The radius of the blur effect. 74 * @return Returns {@link EffectErrorCode}. 75 * @since 12 76 * @version 1.0 77 */ 78 EffectErrorCode OH_Filter_Blur(OH_Filter* filter, float radius); 79 80 /** 81 * @brief Creates a brighten effect and then add to the filter. 82 * 83 * @syscap SystemCapability.Multimedia.Image.Core 84 * @param filter The OH_Filter pointer will be operated. 85 * @param brightness The brightness of the brighten effect. 86 * @return Returns {@link EffectErrorCode}. 87 * @since 12 88 * @version 1.0 89 */ 90 EffectErrorCode OH_Filter_Brighten(OH_Filter* filter, float brightness); 91 92 /** 93 * @brief Creates a gray scale effect and then add to the filter. 94 * 95 * @syscap SystemCapability.Multimedia.Image.Core 96 * @param filter The OH_Filter pointer will be operated. 97 * @return Returns {@link EffectErrorCode}. 98 * @since 12 99 * @version 1.0 100 */ 101 EffectErrorCode OH_Filter_GrayScale(OH_Filter* filter); 102 103 /** 104 * @brief Creates a invert effect and then add to the filter. 105 * 106 * @syscap SystemCapability.Multimedia.Image.Core 107 * @param filter The OH_Filter pointer will be operated. 108 * @return Returns {@link EffectErrorCode}. 109 * @since 12 110 * @version 1.0 111 */ 112 EffectErrorCode OH_Filter_Invert(OH_Filter* filter); 113 114 /** 115 * @brief Creates a effect with a matrix and then add to the filter. 116 * 117 * @syscap SystemCapability.Multimedia.Image.Core 118 * @param filter The OH_Filter pointer will be operated. 119 * @param matrix The {@link OH_Filter_ColorMatrix} pointer to create a custom effect. 120 * @return Returns {@link EffectErrorCode}. 121 * @since 12 122 * @version 1.0 123 */ 124 EffectErrorCode OH_Filter_SetColorMatrix(OH_Filter* filter, OH_Filter_ColorMatrix* matrix); 125 126 /** 127 * @brief Get a pixelmap with the filter effect. 128 * 129 * @syscap SystemCapability.Multimedia.Image.Core 130 * @param filter The OH_Filter pointer will be operated. 131 * @param pixelmap The pixelmap pointer wiil be operated. 132 * @return Returns {@link EffectErrorCode}. 133 * @since 12 134 * @version 1.0 135 */ 136 EffectErrorCode OH_Filter_GetEffectPixelMap(OH_Filter* filter, OH_PixelmapNative** pixelmap); 137 138 #ifdef __cplusplus 139 } 140 #endif 141 142 /** @} */ 143 #endif