📄 rgb64k216m.cpp
字号:
//
// Rgb64K216M
// Pipeline stage converts a 16-bit per pixel RGB image to 24-bit per pixel.
//
// Copyright (C) 2003, 2006 by Jon A. Webb (Contact via GMail; username is jonawebb)
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#include "Rgb64K216M.h"
#include "Debug.h"
#include "Image.h"
#include "ImageSize.h"
#include "Replicate.h"
#include "RGBImageIter.h"
#include "ShortImageIter.h"
#include <e32std.h>
#include <fbs.h>
using namespace Core;
namespace Algorithm
{
EXPORT_C CRgb64K216M* CRgb64K216M::NewL()
{
return new (ELeave) CRgb64K216M();
}
CRgb64K216M::~CRgb64K216M()
{
}
CRgb64K216M::CRgb64K216M() :
ibEmpty(true)
{
}
CImage CRgb64K216M::FrontL()
{
if (ibEmpty) {
User::Leave(KErrGeneral);
return CImage();
}
ibEmpty = true;
return iImage;
}
void CRgb64K216M::PushL(CImage image)
{
IReplicate rRepl(image);
rRepl.CastL(iImage, EColor16M);
image.LockLC();
IRgbImageIter rRgb(iImage);
IShortImageIter rShort(image);
for (; !rShort.End(); rShort.NextRow(), rRgb.NextRow()) {
for (; !rShort.REnd(); rShort++, rRgb++) {
// pixel layout for EColor64K is R=6 bits, G=6 bits, B=5 bits
unsigned char r = (unsigned char) ((rShort() & 0xf800) >> 8);
unsigned char g = (unsigned char) ((rShort() & 0x07e0) >> 3);
unsigned char b = (unsigned char) ((rShort() & 0x001f) << 3);
rRgb[R] = r;
rRgb[G] = g;
rRgb[B] = b;
}
}
CleanupStack::PopAndDestroy(); // unlock bitmaps
CDebug::ShowImage(iImage);
ibEmpty = false;
}
bool CRgb64K216M::Empty() const
{
return ibEmpty;
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -