Symbian 下让 BMP 图片旋转90度的方法
2010-03-18 21:00:00 来源:WEB开发网核心提示:CFbsBitmap* CameraManager::rotateBitmap90 (CFbsBitmap& src){CFbsBitmap* pDstBmp = new (ELeave) CFbsBitmap ();TSize srcSize = src.SizeInPixels();TDisplayMode mod
CFbsBitmap* CameraManager::rotateBitmap90 (CFbsBitmap& src)
{
CFbsBitmap* pDstBmp = new (ELeave) CFbsBitmap ();
TSize srcSize = src.SizeInPixels();
TDisplayMode mode = src.DisplayMode();
User::LeaveIfError(pDstBmp->Create(TSize(srcSize.iHeight,srcSize.iWidth), src.DisplayMode()));
TBitmapUtil srcUtil ( &src );
TBitmapUtil dstUtil ( pDstBmp );
srcUtil.Begin(TPoint(0,0));
dstUtil.Begin(TPoint(0,0));
if ( mode == EColor16MU )
{
TUint32* pDataSrc = src.DataAddress();
TUint32* pDataDst = pDstBmp->DataAddress();
for (TInt32 j = 0 ; j < srcSize.iWidth ; j++)
{
for ( TInt32 i = 0; i < srcSize.iHeight; i++ )
{
pDataDst [ j* srcSize.iHeight + i ] = pDataSrc [ ( srcSize.iHeight - i - 1 ) * srcSize.iWidth + j ];
}
}
}
srcUtil.End();
dstUtil.End();
return pDstBmp;
}
更多精彩
赞助商链接