2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef HERE_GRAPHIC_BITMAP_H
18 #define HERE_GRAPHIC_BITMAP_H
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"
27 TIZEN_MAPS_BEGIN_NAMESPACE
29 enum BitmapPixelFormat
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.
38 class EXPORT_API Bitmap : public Object
43 virtual ~Bitmap(void);
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);
51 int GetWidth(void) const;
52 int GetHeight(void) const;
53 void SetAlphaConstant(int opacity);
54 unsigned char* GetBuffer() const;
55 BitmapPixelFormat GetPixelColorFormat() const;
60 BitmapPixelFormat pixel_format;
61 unsigned char* buffer;
62 pthread_mutex_t mutex;
64 void BitBlt(int xDest, int yDest, unsigned char *pSrcBuffer, int xSour, int ySour, int wSour, int hSour, int nPitch, unsigned long opacity = 255);
67 TIZEN_MAPS_END_NAMESPACE
69 #endif /* HERE_GRAPHIC_BITMAP_H */