WEB开发网
开发学院手机开发Symbian 开发 Symbian 下让 BMP 图片旋转90度的方法 阅读

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;

}

Tags:Symbian BMP 图片

编辑录入:coldstar [复制链接] [打 印]
赞助商链接