6bad4a97d82ad193601684dc8fc096256e24a278
[platform/core/location/maps-plugin-here.git] / inc / engine / graphic / BufferInfo.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #ifndef HERE_GRAPHIC_BUFFERINFO_H
18 #define HERE_GRAPHIC_BUFFERINFO_H
19
20 #include "common/HereMaps_global.h"
21 #include "base/BaseObject.h"
22 #include "graphic/Rectangle.h"
23
24 #if 0
25 typedef enum
26 {
27         PIXEL_FORMAT_RGB565 = 1, /**< The RGB565 pixel format */
28         PIXEL_FORMAT_ARGB8888, /**< The ARGB8888 pixel format */
29         PIXEL_FORMAT_R8G8B8A8, /**< The R8G8B8A8 pixel format @n
30                                             The order of color component is guaranteed by the byte unit. */
31         PIXEL_FORMAT_YCbCr420_PLANAR, /**< The 8-bit Y-plane followed by 8-bit 2x2 sub sampled U-plane and V-plane */
32         PIXEL_FORMAT_JPEG, /**< The encoded format */
33         PIXEL_FORMAT_NV12, /**< The NV12 pixel format */
34         PIXEL_FORMAT_UYVY, /**< The UYVY pixel format */
35         PIXEL_FORMAT_MAX, // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
36         PIXEL_FORMAT_MIN = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
37 } PixelFormat;
38 #endif
39
40 TIZEN_MAPS_BEGIN_NAMESPACE
41
42 class BufferInfo;
43
44 class _BufferInfoImpl
45 {
46 public:
47         enum
48         {
49                 INVALID_BUFFER_HANDLE = 0
50         };
51
52         enum Orientation
53         {
54                 ORIENTATION_PORTRAIT,
55                 ORIENTATION_LANDSCAPE,
56                 ORIENTATION_PORTRAIT_REVERSE,
57                 ORIENTATION_LANDSCAPE_REVERSE
58         };
59
60         enum HandleType
61         {
62                 HANDLE_TYPE_NONE,
63                 HANDLE_TYPE_OVERLAY_REGION,
64                 HANDLE_TYPE_VE_SURFACE,
65                 HANDLE_TYPE_CANVAS_TEXTURE,
66                 HANDLE_TYPE_NATIVE_PIXMAP
67         };
68
69         enum Rotation
70         {
71                 ROTATION_0,
72                 ROTATION_90,
73                 ROTATION_180,
74                 ROTATION_270
75         };
76
77         /**
78          * This is the default constructor for this class.
79          */
80         _BufferInfoImpl();
81
82         /**
83          * This is the destructor for this class.
84          */
85         virtual ~_BufferInfoImpl();
86
87         /*
88          * Gets the handle of the current instance of _BufferInfoImpl.
89          *
90          * @return      The runtime handle
91          *
92          */
93         int GetHandle(HandleType handleType) const;
94
95         void* GetUserData(HandleType handleType) const;
96
97         /*
98          * Sets the handle of the current instance of _BufferInfoImpl.
99          *
100          */
101         void SetHandle(HandleType handleType, int handle, void* pUserData = null);
102
103         /*
104          * Gets the orientation of the current instance of _BufferInfoImpl.
105          *
106          */
107         Orientation GetOrientation(void) const;
108
109         /*
110          * Sets the orientation of the current instance of _BufferInfoImpl.
111          *
112          */
113         void SetOrientation(Orientation orientation);
114
115         /*
116          * Gets the bounds of the current instance of _BufferInfoImpl.
117          *
118          */
119         Rectangle GetBounds(void) const;
120
121         /*
122          * Sets the bounds of the current instance of _BufferInfoImpl.
123          *
124          */
125         void SetBounds(const Rectangle& rect);
126
127         /*
128          * Gets the rotation of the current instance of _BufferInfoImpl.
129          *
130          */
131         Rotation GetRotation(void) const;
132
133         /*
134          * Sets the rotation of the current instance of _BufferInfoImpl.
135          *
136          */
137         void SetRotation(Rotation rotation);
138
139         static _BufferInfoImpl* GetInstance(BufferInfo& bufferInfo);
140         static const _BufferInfoImpl* GetInstance(const BufferInfo& bufferInfo);
141
142 private:
143         /**
144          * This is the default copy constructor for this class.
145          */
146         _BufferInfoImpl(const _BufferInfoImpl& src);
147
148         /**
149          * This is the default assignment operator for this class.
150          */
151         _BufferInfoImpl& operator =(const _BufferInfoImpl& rhs);
152
153         friend class BufferInfo;
154
155         HandleType __handleType;
156         int __handle;
157         void* __pUserData;
158         Orientation __orientation;
159         Rectangle __bounds;
160         Rotation __rotation;
161
162 }; // _BufferInfoImpl
163
164 class BufferInfo : public Object
165 {
166 public:
167         /**
168          * This is the default constructor for this class.
169          *
170          * @since       2.0
171          */
172         BufferInfo(void);
173
174         /**
175          * This is the copy constructor for the %BufferInfo class.
176          *
177          * @since 2.0
178          *
179          * @param[in]          rhs         An instance of %BufferInfo
180          */
181         BufferInfo(const BufferInfo& rhs);
182
183         /**
184          * This is the destructor for this class.
185          *
186          * @since       2.0
187          */
188         virtual ~BufferInfo(void);
189
190         /**
191          * This is the default assignment operator for this class.
192          *
193          * @since 2.0
194          *
195          * @param[in]          rhs         An instance of %BufferInfo
196          */
197         BufferInfo& operator =(const BufferInfo& rhs);
198
199         /**
200          *      Checks whether the value of the specified instance equals the value of the current instance.
201          *
202          * @since 2.0
203          *
204          *      @return                 @c true if the value of the current instance equals the value of the specified instance, @n
205          *           else @c false
206          *      @param[in]      rhs     The object to compare with the current instance
207          */
208         virtual bool Equals(const Object& rhs) const;
209
210         /**
211          *      Gets the hash value of the current instance.
212          *
213          * @since 2.0
214          *
215          *      @return         An integer value indicating the hash value of the current instance
216          */
217         virtual long GetHashCode(void) const;
218
219 public:
220         /**
221          * The width of the buffer's logical dimensions in pixels.
222          *
223          * @since       2.0
224          */
225         int width;
226
227         /**
228          * The height of the buffer's logical dimensions in pixels.
229          *
230          * @since       2.0
231          */
232         int height;
233
234         /**
235          * The length of the buffer scan-line in bytes.
236          *
237          * @since       2.0
238          */
239         int pitch;
240
241         /**
242          * The bits per pixel of the buffer.
243          *
244          * @since       2.0
245          */
246         int bitsPerPixel;
247
248         /**
249          * The color format of the buffer.
250          *
251          * @since       2.0
252          */
253         enum PixelFormat
254         {
255                 PIXEL_FORMAT_RGB565 = 1, /**< The RGB565 pixel format */
256                 PIXEL_FORMAT_ARGB8888, /**< The ARGB8888 pixel format */
257                 PIXEL_FORMAT_R8G8B8A8, /**< The R8G8B8A8 pixel format @n
258                                                     The order of color component is guaranteed by the byte unit. */
259                 PIXEL_FORMAT_YCbCr420_PLANAR, /**< The 8-bit Y-plane followed by 8-bit 2x2 sub sampled U-plane and V-plane */
260                 PIXEL_FORMAT_JPEG, /**< The encoded format */
261                 PIXEL_FORMAT_NV12, /**< The NV12 pixel format */
262                 PIXEL_FORMAT_UYVY, /**< The UYVY pixel format */
263                 PIXEL_FORMAT_MAX, // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
264                 PIXEL_FORMAT_MIN = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
265         };
266         
267         PixelFormat pixelFormat;
268
269         /**
270          * A pointer to the actual locked pixel bits.
271          *
272          * @since       2.0
273          */
274         void* pPixels;
275
276 private:
277         friend class _BufferInfoImpl;
278
279         //
280         // This variable is for internal use only.
281         // Using this variable can cause behavioral, security-related, and consistency-related issues in the application.
282         //
283         // @since 2.0
284         //
285         class _BufferInfoImpl * __pImpl;
286
287 }; // BufferInfo
288
289 TIZEN_MAPS_END_NAMESPACE
290
291 #endif /* HERE_GRAPHIC_BUFFERINFO_H */