[3.0] Update doxygen tags
[platform/core/uifw/dali-core.git] / dali / public-api / images / pixel-data.h
1 #ifndef DALI_PIXEL_DATA_H
2 #define DALI_PIXEL_DATA_H
3
4 /*
5  * Copyright (c) 2016 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 #include <dali/public-api/images/pixel.h>
22 #include <dali/public-api/object/base-handle.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29 class PixelData;
30 }
31
32 /**
33  * @brief The PixelData object holds a pixel buffer .
34  * The PixelData takes over the ownership of the pixel buffer.
35  * The buffer memory must NOT be released outside of this class, instead, the PixelData object will release it automatically when the reference count falls to zero.
36  *
37  * @SINCE_1_1.43
38  */
39 class DALI_IMPORT_API PixelData : public BaseHandle
40 {
41 public:
42
43   /**
44    * @brief Function to release the pixel buffer
45    * @SINCE_1_1.43
46    */
47   enum ReleaseFunction
48   {
49     FREE,          ///< Use free function to release the pixel buffer     @SINCE_1_1.43
50     DELETE_ARRAY,  ///< Use delete[] operator to release the pixel buffer @SINCE_1_1.43
51   };
52
53   /**
54    * @brief Create a PixelData object.
55    *
56    * @SINCE_1_1.43
57    * @param[in] buffer           The raw pixel data.
58    * @param[in] bufferSize       The size of the buffer in bytes
59    * @param[in] width            Buffer width in pixels
60    * @param[in] height           Buffer height in pixels
61    * @param[in] pixelFormat      The pixel format
62    * @param[in] releaseFunction  The function used to release the memory.
63    * @return A handle to the PixelData
64    */
65   static PixelData New( unsigned char* buffer,
66                         unsigned int bufferSize,
67                         unsigned int width,
68                         unsigned int height,
69                         Pixel::Format pixelFormat,
70                         ReleaseFunction releaseFunction);
71
72   /**
73    * @brief Create an empty handle.
74    * Use PixelData::New() to create an initialized object.
75    *
76    * @SINCE_1_1.43
77    */
78   PixelData();
79
80   /**
81    * @brief Destructor.
82    *
83    * @SINCE_1_1.43
84    */
85   ~PixelData();
86
87   /**
88    * @brief This copy constructor is required for (smart) pointer semantics.
89    *
90    * @SINCE_1_1.43
91    * @param[in] handle A reference to the copied handle
92    */
93   PixelData(const PixelData& handle);
94
95   /**
96    * @brief This assignment operator is required for (smart) pointer semantics.
97    *
98    * @SINCE_1_1.43
99    * @param[in] rhs A reference to the copied handle
100    * @return A reference to this object
101    */
102   PixelData& operator=(const PixelData& rhs);
103
104   /**
105    * @brief Get the width of the buffer in pixels.
106    *
107    * @SINCE_1_1.43
108    * @return The width of the buffer in pixels
109    */
110   unsigned int GetWidth() const;
111
112   /**
113    * @brief Get the height of the buffer in pixels.
114    *
115    * @SINCE_1_1.43
116    * @return The height of the buffer in pixels
117    */
118   unsigned int GetHeight() const;
119
120   /**
121    * @brief Get the pixel format.
122    *
123    * @SINCE_1_1.43
124    * @return The pixel format
125    */
126   Pixel::Format GetPixelFormat() const;
127
128 public:
129
130   /**
131    * @brief The constructor
132    * @note  Not intended for application developers.
133    * @SINCE_1_1.43
134    * @param[in] pointer A pointer to a newly allocated PixelData
135    */
136   explicit DALI_INTERNAL PixelData( Internal::PixelData* pointer );
137 };
138
139
140 } //namespace Dali
141
142 #endif // DALI_PIXEL_DATA_H