2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
20 * @brief This is the header file for _Bitmap class.
24 #ifndef _FGRP_INTERNAL_BITMAP_H_
25 #define _FGRP_INTERNAL_BITMAP_H_
27 #include <FBaseByteBuffer.h>
28 #include <FGrpBitmapCommon.h>
30 #include "util/FGrp_UtilScratchpad.h"
33 namespace Tizen { namespace Graphics
49 result Construct(const Rectangle& rect);
50 result Construct(const Dimension& dim, BitmapPixelFormat format);
51 result Construct(const _Canvas& canvas, const Rectangle& rect);
52 result Construct(const _Bitmap& bitmap, const Rectangle& rect);
53 result Construct(const Tizen::Base::ByteBuffer& buffer, const Dimension& dim, BitmapPixelFormat pixelFormat);
54 result Construct(const byte* pBuffer, int bufSize, const Dimension& rq_dim, BitmapPixelFormat pixelFormat);
55 result Construct(const void* pExtBuffer, int width, int height, int bitsPerPixel, int pixelsPerLine = 0);
57 bool IsValid(void) const;
59 result Scale(const Dimension& dim);
60 result ScaleEx(const Dimension& dim, BitmapScalingQuality quality);
61 result Merge(const Point& destPoint, const _Bitmap& srcBitmap, const Rectangle& srcRect);
63 int GetHeight(void) const;
64 int GetWidth(void) const;
65 int GetBitsPerPixel(void) const;
66 BitmapPixelFormat GetPixelColorFormat(void) const;
68 result SetMaskingColor(const Color* pColor);
69 result GetMaskingColor(Color& color) const;
71 void SetAlphaConstant(int opacity);
72 int GetAlphaConstant(void) const;
74 void SetScalingQuality(BitmapScalingQuality quality);
75 BitmapScalingQuality GetScalingQuality(void) const;
77 bool IsNinePatchedBitmap(bool checkStrictly = false) const;
79 result Lock(BufferInfo& info, long timeout = INFINITE);
82 result LockFast(BufferInfo& info, long timeout = INFINITE);
83 result UnlockFast(void);
85 void UpdateOpaqueInfo(void);
87 void SetTimeStamp(unsigned long timeStamp);
88 int GetTimeStamp(void) const;
90 bool IsPremultiplied(void) const;
92 // for the Pixmap only
93 void AssignUserBuffer(unsigned char* pBuffer, int bytesPerLine);
95 void SetCallback(void (* LockCallback)(void*), void* pLockCallbackParam,
96 void (* UnlockCallback)(void*), void* pUnlockCallbackParam,
97 void (* PostlockCallback)(BufferInfo&, void*), void* pPostlockCallbackParam);
100 void _SetOwnership(bool ownership);
101 void _ChangeBuffer(bool ownership, unsigned char* pBuffer);
104 _Bitmap(const _Bitmap& src);
105 _Bitmap& operator =(const _Bitmap& value);
107 result __Scale(int width, int height);
108 result __ScaleEx(int width, int height, BitmapScalingQuality quality);
109 result __Merge(int destX, int destY, const _Bitmap& src, int srcX, int srcY, int srcWidth, int srcHeight);
111 result __Lock(BufferInfo& info, long timeout = INFINITE);
112 result __Unlock(void);
115 unsigned long __magicKey;
116 unsigned long __timeStamp;
118 long __isOpaqueAllOver;
121 unsigned char* __pBuffer;
122 bool __isPremultiplied;
123 bool __hasMaskingColor;
124 unsigned long __maskingColor;
126 BitmapPixelFormat __bitmapPixelFormat;
127 BitmapScalingQuality __scalingQuality;
129 _Util::ScratchPad <unsigned long>* __pScratchPad32;
130 _Util::ScratchPad <unsigned short>* __pScratchPad16;
132 void (* __pLockCallbackFunc)(void*);
133 void* __pLockCallbackParam;
134 void (* __pUnlockCallbackFunc)(void*);
135 void* __pUnlockCallbackParam;
136 void (* __pPostlockCallbackFunc)(BufferInfo&, void*);
137 void* __pPostlockCallbackParam;
139 friend class _Canvas;
140 friend class _BitmapImpl;
144 }} // Tizen::Graphics
146 #endif // _FGRP_INTERNAL_BITMAP_H_