[4.0] Add gaussian blur support in PixelBuffer
[platform/core/uifw/dali-adaptor.git] / platform-abstractions / portable / gaussian-blur.h
1 #ifndef DALI_INTERNAL_ADAPTOR_GAUSSIAN_BLUR_H
2 #define DALI_INTERNAL_ADAPTOR_GAUSSIAN_BLUR_H
3
4 /*
5  * Copyright (c) 2017 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 "pixel-buffer-impl.h"
21
22 namespace Dali
23 {
24
25 namespace Internal
26 {
27
28 namespace Adaptor
29 {
30
31 /**
32  * Perform a one dimension Gaussian blur convolution and write its output buffer transposed.
33  *
34  * @param[in] inBuffer The input buffer with the source image
35  * @param[in] outBuffer The output buffer with the Gaussian blur applied and transposed
36  * @param[in] bufferWidth The width of the buffer
37  * @param[in] bufferHeight The height of the buffer
38  * @param[in] blurRadius The radius for Gaussian blur
39  */
40 void ConvoluteAndTranspose( unsigned char* inBuffer, unsigned char* outBuffer, const unsigned int bufferWidth, const unsigned int bufferHeight, const float blurRadius );
41
42 /**
43  * Perform Gaussian blur on a buffer.
44  *
45  * A Gaussian blur is generated by replacing each pixel’s color values with the average of the surrounding pixels’
46  * colors. This region is a circle with the given radius. Thus, a bigger radius yields a blurrier image.
47  *
48  * @note The pixel format of the buffer must be RGBA8888
49  *
50  * @param[in] buffer The buffer to apply the Gaussian blur to
51  * @param[in] blurRadius The radius for Gaussian blur
52  */
53 void PerformGaussianBlurRGBA( PixelBuffer& buffer, const float blurRadius );
54
55 } //namespace Adaptor
56
57 } //namespace Internal
58
59 } //namespace Dali
60
61 #endif // DALI_INTERNAL_ADAPTOR_GAUSSIAN_BLUR_H