symbian 显示位图和SVG图
2010-08-31 00:09:00 来源:WEB开发网AknIconUtils::SetSize(iSoundSvg, TSize(50,50), EAspectRatioNotPreserved);
// 创建离屏位图、位图设备、位图设备上下文
iOffScreenBitmap = new ( ELeave ) CFbsBitmap(); //创建一个空的位图
CleanupStack::PushL( iOffScreenBitmap );
User::LeaveIfError( iOffScreenBitmap->Create( Rect().Size(),EColor4K ) ); //位图的尺寸设置 成与程序客户区的尺寸相同
CleanupStack::Pop();
iOffScreenBitmapDevice = CFbsBitmapDevice::NewL(iOffScreenBitmap ); //创建一个位图设备
iOffScreenBitmapDevice->CreateContext( iOffScreenBitmapGc ); //创建位图设备的位图设备上下文
3)在析构函数中加入
delete iOffScreenBitmapGc;
iOffScreenBitmapGc = NULL;
delete iOffScreenBitmapDevice;
iOffScreenBitmapDevice = NULL;
delete iOffScreenBitmap;
iOffScreenBitmap = NULL;
4)在位图上绘制图形
//清除位图设备下文中的背景
iOffScreenBitmapGc->SetPenStyle( CGraphicsContext::ENullPen );
iOffScreenBitmapGc->SetBrushColor( KRgbGray );
iOffScreenBitmapGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
iOffScreenBitmapGc->DrawRect( aRect );
iOffScreenBitmapGc->SetPenStyle(CGraphicsContext::ESolidPen);
iOffScreenBitmapGc->DrawEllipse(Rect());
iOffScreenBitmapGc->BitBlt(aRect.iTl,iSoundSvg);
//负责位图中已经绘制好的图形的到程序窗口客户区中
CWindowGc& gc = SystemGc();
gc.BitBlt( Rect().iTl,iOffScreenBitmap );
效果
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/linzhiji/archive/2010/01/29/5270522.aspx
更多精彩
赞助商链接