void CMainView::DrawLineOnBitmapL()
{
CFbsBitmap* aOriBitmap = new(ELeave) CFbsBitmap;
//从mbm文件中载入位图
HBufC* path = CPathConfig::GetMbmPathLC();
aOriBitmap->Load(path->Des(), EMbmZtqJyzs, EFalse);
CleanupStack::PopAndDestroy();
//创建新的位图
CFbsBitmap* aNewBitmap = new(ELeave) CFbsBitmap;
aNewBitmap->Create(aOriBitmap->SizeInPixels(), aOriBitmap->DisplayMode());
CFbsBitmapDevice* grahicsDevice = CFbsBitmapDevice::NewL(aNewBitmap);
CFbsBitGc* agrahicsGc;
TInt aErr = User::LeaveIfError(grahicsDevice->CreateContext(agrahicsGc));
TPoint aZero(0, 0);
//在新位图上加载原位图,然后画线
agrahicsGc->BitBlt(aZero, aOriBitmap);
agrahicsGc->DrawLine(aZero, TPoint(30, 30));
//保存位图,CFbsBitmap的Save()API保存的是.mbm格式的图片,可以用\Symbian\9.1\S60_3rd_MR\S60Tools\mbmviewer工具查看,也可以用imageload 转换为制定格式(jpg...)后查看
TInt err = aNewBitmap->Save(_L("c:\\data\\bitmap.mbm"));
}
{
CFbsBitmap* aOriBitmap = new(ELeave) CFbsBitmap;
//从mbm文件中载入位图
HBufC* path = CPathConfig::GetMbmPathLC();
aOriBitmap->Load(path->Des(), EMbmZtqJyzs, EFalse);
CleanupStack::PopAndDestroy();
//创建新的位图
CFbsBitmap* aNewBitmap = new(ELeave) CFbsBitmap;
aNewBitmap->Create(aOriBitmap->SizeInPixels(), aOriBitmap->DisplayMode());
CFbsBitmapDevice* grahicsDevice = CFbsBitmapDevice::NewL(aNewBitmap);
CFbsBitGc* agrahicsGc;
TInt aErr = User::LeaveIfError(grahicsDevice->CreateContext(agrahicsGc));
TPoint aZero(0, 0);
//在新位图上加载原位图,然后画线
agrahicsGc->BitBlt(aZero, aOriBitmap);
agrahicsGc->DrawLine(aZero, TPoint(30, 30));
//保存位图,CFbsBitmap的Save()API保存的是.mbm格式的图片,可以用\Symbian\9.1\S60_3rd_MR\S60Tools\mbmviewer工具查看,也可以用imageload 转换为制定格式(jpg...)后查看
TInt err = aNewBitmap->Save(_L("c:\\data\\bitmap.mbm"));
}