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_UtilScratchpad.cpp
20 * @brief This is the header file for internal utility class.
24 #include "FGrp_UtilScratchpad.h"
27 namespace Tizen { namespace Graphics
35 ScratchPad <unsigned long>::__FillRect(unsigned long* pDest32, int w, int h, int pitch, unsigned long color,
36 unsigned long opacity)
38 typedef unsigned long Pixel;
40 opacity += (opacity >> 7);
41 opacity = ((opacity * (color >> 24)) << 16) & 0xFF000000;
50 *pDest32++ = Pixel((color & 0x00FFFFFF) | opacity);
53 pDest32 += (pitch - w);
59 ScratchPad <unsigned long>::__BitBlt(unsigned long* pDest32, int w, int h, int pitch, unsigned long* pSour32, int imagePitch,
60 unsigned long opacity,
63 typedef unsigned long Pixel;
65 opacity += (opacity >> 7);
68 Pixel alpha = 0xFF000000;
70 if (!srcColorKey.isValid)
78 alpha = Pixel(opacity * (*pSour32 >> 24));
79 *pDest32++ = (*pSour32++ & 0x00FFFFFF) | (alpha & 0xFF000000);
82 pDest32 += (pitch - w);
83 pSour32 += (imagePitch - w);
94 if (*pSour32 != srcColorKey.colorKey)
96 alpha = Pixel(opacity * (*pSour32 >> 24));
97 *pDest32++ = (*pSour32++ & 0x00FFFFFF) | (alpha & 0xFF000000);
105 pDest32 += (pitch - w);
106 pSour32 += (imagePitch - w);
111 ////////////////////////////////////////
112 // implementation (unsined short)
116 ScratchPad <unsigned short>::__FillRect(unsigned short* pDest16, int w, int h, int pitch, unsigned long color,
117 unsigned long opacity)
119 typedef unsigned short Pixel;
121 Pixel color16bit = (Pixel) color;
129 *pDest16++ = color16bit;
132 pDest16 += (pitch - w);
138 ScratchPad <unsigned short>::__BitBlt(unsigned short* pDest16, int w, int h, int pitch, unsigned short* pSour16, int imagePitch,
139 unsigned long opacity,
140 ColorKey srcColorKey)
142 typedef unsigned short Pixel;
144 if (!srcColorKey.isValid)
152 *pDest16++ = *pSour16++;
155 pDest16 += (pitch - w);
156 pSour16 += (imagePitch - w);
167 if (*pSour16 != srcColorKey.colorKey)
169 *pDest16++ = *pSour16++;
177 pDest16 += (pitch - w);
178 pSour16 += (imagePitch - w);
183 ////////////////////////////////////////
184 // implementation (unsined char)
188 ScratchPad <unsigned char>::__FillRect(unsigned char* pDest08, int w, int h, int pitch, unsigned long color,
189 unsigned long opacity)
191 unsigned char color08bit = (unsigned char) color;
199 *pDest08++ = color08bit;
202 pDest08 += (pitch - w);
208 ScratchPad <unsigned char>::__BitBlt(unsigned char* pDest08, int w, int h, int pitch, unsigned char* pSour08, int imagePitch,
209 unsigned long opacity,
210 ColorKey srcColorKey)
218 *pDest08++ = *pSour08++;
221 pDest08 += (pitch - w);
222 pSour08 += (imagePitch - w);
228 }} // Tizen::Graphics::_Util