Revert "Implemented basic CPU image masking"
[platform/core/uifw/dali-core.git] / dali / devel-api / images / pixel-data-devel.h
1 #ifndef DALI_PIXEL_DATA_DEVEL_H
2 #define DALI_PIXEL_DATA_DEVEL_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
21 // INTERNAL INCLUDES
22 #include <dali/public-api/images/pixel-data.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/images/pixel-devel.h>
26
27 namespace Dali
28 {
29
30 namespace DevelPixelData
31 {
32
33 /**
34  * @brief Creates a PixelData object, using development pixel formats
35  *
36  * @param[in] buffer          The raw pixel data
37  * @param[in] bufferSize      The size of the buffer in bytes
38  * @param[in] width           Buffer width in pixels
39  * @param[in] height          Buffer height in pixels
40  * @param[in] pixelFormat     The pixel format
41  * @param[in] releaseFunction The function used to release the memory
42  * @return A handle to the PixelData
43  */
44 DALI_IMPORT_API PixelData New( unsigned char* buffer,
45                                unsigned int bufferSize,
46                                unsigned int width,
47                                unsigned int height,
48                                DevelPixel::Format pixelFormat,
49                                PixelData::ReleaseFunction releaseFunction );
50
51 /**
52  * Struct to keep the buffer pointer and the allocation method.
53  *
54  * @note Need to find a better solution - one library should not
55  * be freeing data from a different source with potentially
56  * different allocators.
57  */
58 struct PixelDataBuffer
59 {
60   unsigned char* buffer;
61   unsigned int bufferSize;
62   PixelData::ReleaseFunction releaseFunction;
63
64   PixelDataBuffer(  unsigned char* buffer,
65                     unsigned int bufferSize,
66                     PixelData::ReleaseFunction releaseFunction )
67   : buffer(buffer),
68     bufferSize(bufferSize),
69     releaseFunction(releaseFunction)
70   {
71   }
72 };
73
74 /**
75  * Get the buffer from a pixel data object, zero it in the pixel data object
76  * and release the handle.
77  * @param[in,out] pixelData The pixel data object to take the buffer from
78  * @return the buffer and the data release mechanism
79  */
80 PixelDataBuffer ReleasePixelDataBuffer( PixelData& pixelData );
81
82 } // namespace DevelPixelData
83
84 } // Dali
85
86 #endif // DALI_PIXEL_DATA_DEVEL_H