changed attributes of header files
[platform/core/location/maps-plugin-here.git] / inc / engine / graphic / Bitmap.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_BITMAP_H
18 #define HERE_GRAPHIC_BITMAP_H
19
20 #include "common/HereMaps_global.h"
21 #include "base/BaseObject.h"
22 #include "graphic/Dimension.h"
23 #include "graphic/Rectangle.h"
24 #include "graphic/BufferInfo.h"
25
26
27 TIZEN_MAPS_BEGIN_NAMESPACE
28
29 enum BitmapPixelFormat
30 {
31         BITMAP_PIXEL_FORMAT_RGB565 = 1, /**< The RGB565 pixel format */
32         BITMAP_PIXEL_FORMAT_ARGB8888, /**< The ARGB8888 pixel format */
33         BITMAP_PIXEL_FORMAT_R8G8B8A8, /**< The R8G8B8A8 pixel format, the order of the color component is guaranteed by the byte unit */
34         BITMAP_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.
35         BITMAP_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.
36 };
37
38 class EXPORT_API Bitmap : public Object
39 {
40 public:
41     Bitmap(void);
42
43     virtual ~Bitmap(void);
44
45     result Construct(const Dimension& dim, BitmapPixelFormat bitmapPixelFormat=BITMAP_PIXEL_FORMAT_R8G8B8A8);
46     result Construct(const Bitmap& bitmap, const Rectangle& rect);
47     result Construct(const byte* pBuffer, int bufferSize, const Dimension& dim, BitmapPixelFormat bitmapPixelFormat=BITMAP_PIXEL_FORMAT_R8G8B8A8);
48     result Lock(BufferInfo& info, long timeout = INFINITE);
49     result Unlock(void);
50
51     int GetWidth(void) const;
52     int GetHeight(void) const;
53     void SetAlphaConstant(int opacity);
54     unsigned char* GetBuffer() const;
55     BitmapPixelFormat GetPixelColorFormat() const;
56 private:
57     int width;
58     int height;
59     int bytes_per_pixel;
60     BitmapPixelFormat pixel_format;
61     unsigned char* buffer;
62     pthread_mutex_t mutex;
63
64     void BitBlt(int xDest, int yDest, unsigned char *pSrcBuffer, int xSour, int ySour, int wSour, int hSour, int nPitch, unsigned long opacity = 255);
65 };
66
67 TIZEN_MAPS_END_NAMESPACE
68
69 #endif /* HERE_GRAPHIC_BITMAP_H */