2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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);
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(void) 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);
99 void _SetOwnership(bool ownership);
100 void _ChangeBuffer(bool ownership, unsigned char* pBuffer);
103 _Bitmap(const _Bitmap& src);
104 _Bitmap& operator =(const _Bitmap& value);
106 result __Scale(int width, int height);
107 result __ScaleEx(int width, int height, BitmapScalingQuality quality);
108 result __Merge(int destX, int destY, const _Bitmap& src, int srcX, int srcY, int srcWidth, int srcHeight);
110 result __Lock(BufferInfo& info, long timeout = INFINITE);
111 result __Unlock(void);
114 unsigned long __timeStamp;
116 long __isOpaqueAllOver;
119 unsigned char* __pBuffer;
120 bool __isPremultiplied;
121 bool __hasMaskingColor;
122 unsigned long __maskingColor;
124 BitmapPixelFormat __bitmapPixelFormat;
125 BitmapScalingQuality __scalingQuality;
127 _Util::ScratchPad <unsigned long>* __pScratchPad32;
128 _Util::ScratchPad <unsigned short>* __pScratchPad16;
130 void (* __pLockCallbackFunc)(void*);
131 void* __pLockCallbackParam;
132 void (* __pUnlockCallbackFunc)(void*);
133 void* __pUnlockCallbackParam;
135 friend class _Canvas;
136 friend class _BitmapImpl;
140 }} // Tizen::Graphics
142 #endif // _FGRP_INTERNAL_BITMAP_H_