[dali_2.3.30] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / common / gaussian-blur.h
1 #ifndef DALI_INTERNAL_ADAPTOR_GAUSSIAN_BLUR_H
2 #define DALI_INTERNAL_ADAPTOR_GAUSSIAN_BLUR_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #include <dali/internal/imaging/common/pixel-buffer-impl.h>
21
22 namespace Dali
23 {
24 namespace Internal
25 {
26 namespace Adaptor
27 {
28 /**
29  * Perform a one dimension Gaussian blur convolution and write its output buffer transposed.
30  *
31  * @param[in] inBuffer The input buffer with the source image
32  * @param[in] outBuffer The output buffer with the Gaussian blur applied and transposed
33  * @param[in] bufferWidth The width of the buffer
34  * @param[in] bufferHeight The height of the buffer
35  * @param[in] blurRadius The radius for Gaussian blur
36  */
37 void ConvoluteAndTranspose(unsigned char* inBuffer, unsigned char* outBuffer, const unsigned int bufferWidth, const unsigned int bufferHeight, const float blurRadius);
38
39 /**
40  * Perform Gaussian blur on a buffer.
41  *
42  * A Gaussian blur is generated by replacing each pixel’s color values with the average of the surrounding pixels’
43  * colors. This region is a circle with the given radius. Thus, a bigger radius yields a blurrier image.
44  *
45  * @note The pixel format of the buffer must be RGBA8888
46  *
47  * @param[in] buffer The buffer to apply the Gaussian blur to
48  * @param[in] blurRadius The radius for Gaussian blur
49  */
50 void PerformGaussianBlurRGBA(PixelBuffer& buffer, const float blurRadius);
51
52 } //namespace Adaptor
53
54 } //namespace Internal
55
56 } //namespace Dali
57
58 #endif // DALI_INTERNAL_ADAPTOR_GAUSSIAN_BLUR_H