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  * @library libnative_effect.so
35  * @syscap SystemCapability.Multimedia.Image.Core
36  * @since 12
37  */
38 
39 #include "effect_types.h"
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**
45  * @brief Creates an <b>OH_Filter</b> object.
46  *
47  * @syscap SystemCapability.Multimedia.Image.Core
48  * @param pixelmap The pixelmap pointer to create filter.
49  * @param filter The OH_Filter pointer will be operated.
50  * @return Returns {@link EffectErrorCode}.
51  * @since 12
52  * @version 1.0
53  */
54 EffectErrorCode OH_Filter_CreateEffect(OH_PixelmapNative* pixelmap, OH_Filter** filter);
55 
56 /**
57  * @brief Release an <b>OH_Filter</b> object.
58  *
59  * @syscap SystemCapability.Multimedia.Image.Core
60  * @param filter The OH_Filter pointer will be operated.
61  * @return Returns {@link EffectErrorCode}
62  * @since 12
63  * @version 1.0
64  */
65 EffectErrorCode OH_Filter_Release(OH_Filter* filter);
66 
67 /**
68  * @brief Creates a blur effect and then add to the filter.
69  *
70  * @syscap SystemCapability.Multimedia.Image.Core
71  * @param filter The OH_Filter pointer will be operated.
72  * @param radius The radius of the blur effect.
73  * @return Returns {@link EffectErrorCode}.
74  * @since 12
75  * @version 1.0
76  */
77 EffectErrorCode OH_Filter_Blur(OH_Filter* filter, float radius);
78 
79 /**
80  * @brief Creates a blur effect and then add to the filter.
81  *
82  * @syscap SystemCapability.Multimedia.Image.Core
83  * @param filter The OH_Filter pointer will be operated.
84  * @param radius The radius of the blur effect.
85  * @param tileMode The tileMode of the blur effect.
86  * @return BlurWithTileMode result code.
87  *        {@link EFFECT_SUCCESS} if the operation is successful.
88  *        {@link EFFECT_BAD_PARAMETER} if parameter is invalid.
89  * @since 14
90  */
91 EffectErrorCode OH_Filter_BlurWithTileMode(OH_Filter* filter, float radius, EffectTileMode tileMode);
92 
93 /**
94  * @brief Creates a brighten effect and then add to the filter.
95  *
96  * @syscap SystemCapability.Multimedia.Image.Core
97  * @param filter The OH_Filter pointer will be operated.
98  * @param brightness The brightness of the brighten effect.
99  * @return Returns {@link EffectErrorCode}.
100  * @since 12
101  * @version 1.0
102  */
103 EffectErrorCode OH_Filter_Brighten(OH_Filter* filter, float brightness);
104 
105 /**
106  * @brief Creates a gray scale effect and then add to the filter.
107  *
108  * @syscap SystemCapability.Multimedia.Image.Core
109  * @param filter The OH_Filter pointer will be operated.
110  * @return Returns {@link EffectErrorCode}.
111  * @since 12
112  * @version 1.0
113  */
114 EffectErrorCode OH_Filter_GrayScale(OH_Filter* filter);
115 
116 /**
117  * @brief Creates a invert effect and then add to the filter.
118  *
119  * @syscap SystemCapability.Multimedia.Image.Core
120  * @param filter The OH_Filter pointer will be operated.
121  * @return Returns {@link EffectErrorCode}.
122  * @since 12
123  * @version 1.0
124  */
125 EffectErrorCode OH_Filter_Invert(OH_Filter* filter);
126 
127 /**
128  * @brief Creates a effect with a matrix and then add to the filter.
129  *
130  * @syscap SystemCapability.Multimedia.Image.Core
131  * @param filter The OH_Filter pointer will be operated.
132  * @param matrix The {@link OH_Filter_ColorMatrix} pointer to create a custom effect.
133  * @return Returns {@link EffectErrorCode}.
134  * @since 12
135  * @version 1.0
136  */
137 EffectErrorCode OH_Filter_SetColorMatrix(OH_Filter* filter, OH_Filter_ColorMatrix* matrix);
138 
139 /**
140  * @brief Get a pixelmap with the filter effect.
141  *
142  * @syscap SystemCapability.Multimedia.Image.Core
143  * @param filter The OH_Filter pointer will be operated.
144  * @param pixelmap The pixelmap pointer wiil be operated.
145  * @return Returns {@link EffectErrorCode}.
146  * @since 12
147  * @version 1.0
148  */
149 EffectErrorCode OH_Filter_GetEffectPixelMap(OH_Filter* filter, OH_PixelmapNative** pixelmap);
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 /** @} */
155 #endif
156