• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
17  * @addtogroup image
18  * @{
19  *
20  * @brief Provides APIs for obtaining effect filter and information.
21  *
22  * @syscap SystemCapability.Multimedia.Image.Core
23  * @since 12
24  */
25 
26 /**
27  * @file effect_filter.h
28  *
29  * @brief Declares the APIs that can access a effect filter.
30  *
31  * @kit ArkGraphics2D
32  * @library libnative_effect.so
33  * @syscap SystemCapability.Multimedia.Image.Core
34  * @since 12
35  */
36 
37 #ifndef C_INCLUDE_EFFECT_FILTER_H
38 #define C_INCLUDE_EFFECT_FILTER_H
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 blur 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 radius The radius of the blur effect.
86  * @param tileMode The tileMode of the blur effect.
87  * @return BlurWithTileMode result code.
88  *        {@link EFFECT_SUCCESS} if the operation is successful.
89  *        {@link EFFECT_BAD_PARAMETER} if parameter is invalid.
90  * @since 14
91  */
92 EffectErrorCode OH_Filter_BlurWithTileMode(OH_Filter* filter, float radius, EffectTileMode tileMode);
93 
94 /**
95  * @brief Creates a brighten effect and then add to the filter.
96  *
97  * @syscap SystemCapability.Multimedia.Image.Core
98  * @param filter The OH_Filter pointer will be operated.
99  * @param brightness The brightness of the brighten effect.
100  * @return Returns {@link EffectErrorCode}.
101  * @since 12
102  * @version 1.0
103  */
104 EffectErrorCode OH_Filter_Brighten(OH_Filter* filter, float brightness);
105 
106 /**
107  * @brief Creates a gray scale effect and then add to the filter.
108  *
109  * @syscap SystemCapability.Multimedia.Image.Core
110  * @param filter The OH_Filter pointer will be operated.
111  * @return Returns {@link EffectErrorCode}.
112  * @since 12
113  * @version 1.0
114  */
115 EffectErrorCode OH_Filter_GrayScale(OH_Filter* filter);
116 
117 /**
118  * @brief Creates a invert effect and then add to the filter.
119  *
120  * @syscap SystemCapability.Multimedia.Image.Core
121  * @param filter The OH_Filter pointer will be operated.
122  * @return Returns {@link EffectErrorCode}.
123  * @since 12
124  * @version 1.0
125  */
126 EffectErrorCode OH_Filter_Invert(OH_Filter* filter);
127 
128 /**
129  * @brief Creates a effect with a matrix and then add to the filter.
130  *
131  * @syscap SystemCapability.Multimedia.Image.Core
132  * @param filter The OH_Filter pointer will be operated.
133  * @param matrix The {@link OH_Filter_ColorMatrix} pointer to create a custom effect.
134  * @return Returns {@link EffectErrorCode}.
135  * @since 12
136  * @version 1.0
137  */
138 EffectErrorCode OH_Filter_SetColorMatrix(OH_Filter* filter, OH_Filter_ColorMatrix* matrix);
139 
140 /**
141  * @brief Get a pixelmap with the filter effect.
142  *
143  * @syscap SystemCapability.Multimedia.Image.Core
144  * @param filter The OH_Filter pointer will be operated.
145  * @param pixelmap The pixelmap pointer wiil be operated.
146  * @return Returns {@link EffectErrorCode}.
147  * @since 12
148  * @version 1.0
149  */
150 EffectErrorCode OH_Filter_GetEffectPixelMap(OH_Filter* filter, OH_PixelmapNative** pixelmap);
151 
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 /** @} */
157 #endif