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.
19 * @file FGrp_UtilPixmap.h
20 * @brief This is the header file for internal _Util Pixmap class.
24 #ifndef _FGRP_INTERNAL_UTIL_PIXMAP_H_
25 #define _FGRP_INTERNAL_UTIL_PIXMAP_H_
28 namespace Tizen { namespace Graphics
33 ////////////////////////////////////////////////////////////////////////////////
38 long type; // image buffer type. this value is always 0
39 long width; // width of image
40 long height; // height of image
41 long bytesPerLine; // bytes per line
42 long depth; // pixel depth of buffer
43 long enableColorKey; // is color key available?
44 unsigned long colorKey; // color key
45 long enableReplaceColor; // is replacement color available?
46 unsigned long replaceColor; // replacement color
47 long isOpaque; // it is opaque if TRUE
48 long isPremultiplied; // it has premultiplied alpha if TRUE
49 unsigned char* pBitmap; // start pointer to buffer
50 mutable long reserved; // do you have ownership?
53 // if 'reserved' is not 0, buffer is released automatically
58 Pixmap(int width, int height, int depth, int bytesPerLine = 0);
59 Pixmap(int width, int height, int depth, void* pBitmap, int bytesPerLine = 0);
60 Pixmap(PixmapBase& refImage);
61 Pixmap(const PixmapBase& refImage);
62 Pixmap(const Pixmap& refImage);
65 Pixmap& operator =(const Pixmap& refImage);
67 PixmapBase GetSubBitmap(long x, long y, long w, long h) const;
68 PixmapBase GetSubBitmapUnsafe(long x, long y, long w, long h) const;
69 Pixmap* GetClone(unsigned long depth) const;
70 Pixmap* GetPremultipliedPixmap(void) const;
71 void ConvertPremultiplied(void);
74 ////////////////////////////////////////////////////////////////////////////////
75 // buffer manipulation
77 template<typename Pixel>
78 class GenericBufferBase
93 virtual ~GenericBufferBase(void)
97 inline Pixel* GetBufferAddr(void) const
102 inline int GetPitch(void) const
107 inline int GetPadding(void) const
112 inline int GetWidth(void) const
117 inline int GetHeight(void) const
122 inline void* GetHandle(void) const
142 }; // GenericBufferBase
144 template<typename Pixel>
148 GenericBuffer(const GenericBufferBase <Pixel>* pInst)
153 virtual ~GenericBuffer(void)
158 inline bool IsValid(void) const
160 return (__pInst != 0);
163 inline Pixel* GetBufferAddr(void) const
165 return __pInst->GetBufferAddr();
168 inline int GetPitch(void) const
170 return __pInst->GetPitch();
173 inline int GetPadding(void) const
175 return __pInst->GetPadding();
178 inline int GetWidth(void) const
180 return __pInst->GetWidth();
183 inline int GetHeight(void) const
185 return __pInst->GetHeight();
188 inline void* GetHandle(void) const
190 return __pInst->GetHandle();
194 const GenericBufferBase <Pixel>* __pInst;
197 } // Tizen::Graphics::_Util
199 }} // Tizen::Graphics
201 #endif // #ifndef _FGRP_INTERNAL_UTIL_PIXMAP_H_