本文整理汇总了C++中CFbsBitmap类的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitmap类的具体用法?C++ CFbsBitmap怎么用?C++ CFbsBitmap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFbsBitmap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _LIT
// -----------------------------------------------------------------------------
// Ctestsdkindicators::TestIndiCntnerReplaceIndicatorIconL
// -----------------------------------------------------------------------------
//
TInt CTestSDKIndicators::TestIndiCntnerReplaceIndicatorIconL( CStifItemParser& /*aItem*/ )
{
// Print to UI
_LIT( Ktestsdkindicators, "testsdkindicators" );
_LIT( KTestIndiCntnerReplaceIndicatorIconL, "In TestIndiCntnerReplaceIndicatorIconL" );
TestModuleIf().Printf( 0, Ktestsdkindicators, KTestIndiCntnerReplaceIndicatorIconL );
// Print to log file
iLog->Log( KTestIndiCntnerReplaceIndicatorIconL );
TInt err = KErrNone;
TUid Id = { EAknIndicatorEnvelope };
_LIT( KFileName, "z:\\resource\\apps\\avkon2.mbm" );
CFbsBitmap* bmp = new (ELeave) CFbsBitmap();
bmp->Load( KFileName, EMbmAvkonQgn_stat_cyphering_on );
CFbsBitmap* bmpMask = new (ELeave) CFbsBitmap();
bmpMask->Load( KFileName, EMbmAvkonQgn_stat_cyphering_on_mask );
iIndicatorContn->CreateIndicatorFromResourceL( R_TEST_INDICATOR,
CAknIndicatorContainer::EMultiColorIndicator );
iIndicatorContn->ReplaceIndicatorIconL(
Id,
EAknIndicatorStateOn,
CAknIndicatorContainer::ELayoutModeUsual,
bmp, bmpMask);
return err;
}
示例2: new
/**
Create a checked board
@param aPixelFormat The pixel format for create the target bitmap
@param aSize The size of the bitmap
@param aChecksPerAxis Number of checks on X and Y.
*/
CFbsBitmap* CTe_graphicsperformanceSuiteStepBase::CreateCheckedBoardL(TDisplayMode aDisplayMode, TSize aSize, TSize aChecksPerAxis) const
{
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
bitmap->Create(aSize, aDisplayMode);
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap);
CleanupStack::PushL(bitmapDevice);
CFbsBitGc* bitGc = NULL;
User::LeaveIfError(bitmapDevice->CreateContext(bitGc));
CleanupStack::PushL(bitGc);
bitGc->Clear();
bitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
bitGc->SetPenStyle(CGraphicsContext::ENullPen);
TPoint point(0,0);
const TSize checkerSize((TReal)aSize.iWidth/aChecksPerAxis.iWidth,(TReal)aSize.iHeight/aChecksPerAxis.iHeight);
TInt brushColour = 0;
for(point.iY = 0; point.iY < aSize.iHeight; point.iY += checkerSize.iHeight)
{
for(point.iX = 0; point.iX < aSize.iWidth; point.iX += checkerSize.iWidth)
{
bitGc->SetBrushColor(KColor16Table[brushColour++ & 0x0F]);
TRect rect(point, checkerSize);
bitGc->DrawRect(rect);
}
}
CleanupStack::PopAndDestroy(2, bitmapDevice);
CleanupStack::Pop(bitmap);
return bitmap;
}
示例3: new
// ---------------------------------------------------------------------------
// CBCTestButtonCase::CreateIconL
// ---------------------------------------------------------------------------
//
CGulIcon* CBCTestButtonCase::CreateIconL()
{
CFbsBitmap *bitmap = new( ELeave ) CFbsBitmap();
bitmap->Load( AknIconUtils::AvkonIconFileName(),
EMbmAvkonQgn_prop_set_button );
return CGulIcon::NewL( bitmap );
}
示例4: _LIT
// --------------------------------------------------------------------------
// Ctestpubscalableicons::TestAknIconUtilsScaleBitmapL
// --------------------------------------------------------------------------
//
TInt Ctestpubscalableicons::TestAknIconUtilsScaleBitmapL( CStifItemParser& /*aItem*/ )
{
_LIT(Kctestpubscalableicons, "Ctestpubscalableicons");
_LIT(Ktestakniconutilsscalebitmapl, "In TestAknIconUtilsScaleBitmapL");
TestModuleIf().Printf(0, Kctestpubscalableicons, Ktestakniconutilsscalebitmapl);
iLog->Log(Ktestakniconutilsscalebitmapl);
TFileName file( KMbmFile );
User::LeaveIfError( CompleteWithAppPath( file ) );
CFbsBitmap* aSrcBitmap = AknIconUtils::CreateIconL( file, EMbmAvkonQgn_indi_mic );
CleanupStack::PushL( aSrcBitmap );
TRect aTrgRect( TSize( KWidth, KHeight ) );
CFbsBitmap* aTrgBitmap = new( ELeave ) CFbsBitmap;
aTrgBitmap->Create(TSize( KWidth, KHeight), ENone );
AknIconUtils::ScaleBitmapL( aTrgRect, aTrgBitmap, aSrcBitmap );
STIF_ASSERT_NOT_NULL( aTrgBitmap );
CleanupStack::PopAndDestroy( aSrcBitmap );
return KErrNone;
}
示例5: GetVgImageFromBitmap
/**
Retrieves the VGImage from the cache that was created from the supplied CFbsBitmap.
The cache is first searched to find the item containing the VGImage that was created from the CFbsBitmap.
If no matching item is found, no VGImage is returned.
If the matching item is found, the touch count is checked to determine whether the
CFbsBitmap has been updated since the stored VGImage was created from it. If it has, the matching item
and VGImage is deleted from the cache and no VGImage is returned.
If the matching item is found and the CFbsitmap has not been updated sionce the VGImage was created,
the associated VGImage is returned.
@param aBitmap The bitmap used to reference the item containing the VGImage.
@param aOrigin The origin of the VGImage, relative to the top left corner of the source image.
@return VG_INVALID_HANDLE if no VGImage exists for the supplied CFbsBitmap or if the stored VGImage is out of date.
Otherwise the VGImage associated with the CFbsBitmap is returned.
*/
VGImage CVgImageCache::GetVgImageFromBitmap(const CFbsBitmap& aBitmap, const TPoint& aOrigin)
{
// search through cache to find the item with a matching bitmap ID
CVgImageCacheItem** itemPtr = iCacheItemMap.Find(aBitmap.SerialNumber());
++iNumMatchTries;
if(itemPtr == NULL)
{
// searched all the way through cache and there is no matching image
++iNumMatchMisses;
return VG_INVALID_HANDLE;
}
CVgImageCacheItem* item = *itemPtr;
// Check whether the VGImage held by the item is up-to-date
// - check touch counts are equal.
// - check origins used for creating VGImage are equal.
if (aBitmap.TouchCount() != item->iTouchCount || aOrigin != item->iOrigin)
{
// VGImage in item needs updating, so remove and delete the entry
// and return NULL to indicate that a new entry needs to be created.
DeleteItem(item);
return VG_INVALID_HANDLE;
}
// VGImage is up-to date.
// If item is not already at front of list, move it there
if(!iVgImageCache.IsFirst(item))
{
item->iLink.Deque();
iVgImageCache.AddFirst(*item);
}
return item->iImage;
}
示例6: new
CGulIcon* CTap2MenuAppUi::LoadAppIconHard(TUid aUid)
{
RApaLsSession ls;
ls.Connect();
CGulIcon *retval = NULL;
CArrayFixFlat<TSize> *array = new CArrayFixFlat<TSize>(3);
CleanupStack::PushL(array);
TInt err = ls.GetAppIconSizes(aUid, *array);
if(err == KErrNone && array->Count() > 0)
{
CApaMaskedBitmap *bitmap = CApaMaskedBitmap::NewLC();
err = ls.GetAppIcon(aUid, (*array)[0], *bitmap);
if(err == KErrNone)
{
CFbsBitmap* bmp = new (ELeave) CFbsBitmap();
CleanupStack::PushL(bmp);
CFbsBitmap* bmp_mask = new (ELeave) CFbsBitmap();
CleanupStack::PushL(bmp_mask);
User::LeaveIfError(bmp->Create(bitmap->SizeInPixels(), bitmap->DisplayMode()));
User::LeaveIfError(bmp_mask->Create(bitmap->Mask()->SizeInPixels(), bitmap->Mask()->DisplayMode()));
CopyBitmapL(bitmap, bmp);
CopyBitmapL(bitmap->Mask(), bmp_mask);
retval = CGulIcon::NewL(bmp, bmp_mask);
CleanupStack::Pop(2); // bmp, bmp_mask
}
CleanupStack::PopAndDestroy(bitmap);
}
CleanupStack::PopAndDestroy(array);
ls.Close();
return retval;
}
示例7: new
TBool CTestContainer::CompareScreenContentWithTestBitmapL(const CBitmapFrameData& aBkgdFrame, const CBitmapFrameData& aFrame1, const TPoint& aPos)
{
TSize size = aFrame1.Bitmap()->SizeInPixels();
// Create test bitmap for comparison
CFbsBitmap* testBitmap = new (ELeave) CFbsBitmap;
CleanupStack::PushL(testBitmap);
User::LeaveIfError( testBitmap->Create(size, iEikonEnv->DefaultDisplayMode()));
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(testBitmap);
CleanupStack::PushL(bitmapDevice);
CFbsBitGc* bitmapGc = CFbsBitGc::NewL();
CleanupStack::PushL(bitmapGc);
bitmapGc->Activate(bitmapDevice);
// Blit the background bitmap
bitmapGc->BitBlt(aPos, aBkgdFrame.Bitmap());
// Blit the frame bitmap with mask
bitmapGc->BitBltMasked(aPos, aFrame1.Bitmap(), size, aFrame1.Mask(), ETrue);
// Create bitmap and blit the screen contents into it for comparing it with test bitmap created above
TRect rect(aPos,size);
CFbsBitmap* scrBitmap = new (ELeave) CFbsBitmap;
CleanupStack::PushL(scrBitmap);
User::LeaveIfError(scrBitmap->Create(size, iEikonEnv->DefaultDisplayMode()) );
User::LeaveIfError( iEikonEnv->ScreenDevice()->CopyScreenToBitmap(scrBitmap,rect) );
TBool ret=CompareBitmapsL(testBitmap,scrBitmap);
CleanupStack::PopAndDestroy(4); //scrBitmap, bitmapGc, bitmapDevice, testBitmap
return ret;
}
示例8: createBlitCopy
static CFbsBitmap* createBlitCopy(CFbsBitmap* bitmap)
{
CFbsBitmap *copy = q_check_ptr(new CFbsBitmap);
if(!copy)
return 0;
if (copy->Create(bitmap->SizeInPixels(), bitmap->DisplayMode()) != KErrNone) {
delete copy;
copy = 0;
return 0;
}
CFbsBitmapDevice* bitmapDevice = 0;
CFbsBitGc *bitmapGc = 0;
QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(copy));
QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
bitmapGc->Activate(bitmapDevice);
bitmapGc->BitBlt(TPoint(), bitmap);
delete bitmapGc;
delete bitmapDevice;
return copy;
}
示例9: deleteLocalSurface
void WindowSurfaceImpl::handleSymbianWindowVisibilityChange(bool aVisible)
{
if(mPaintingStarted)
{
// TODO window getting invisible in the middle of paint
return;
}
if (!aVisible)
{
// Switch to sw rendering
if(!isLocalSurfaceValid())
{
if(mMainSurface.localSurfaceInUse)
{
deleteLocalSurface();
}
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
int err = bitmap->Create(TSize(mMainSurface.widget->width(), mMainSurface.widget->height()),
CCoeEnv::Static()->ScreenDevice()->DisplayMode());
eglCopyBuffers(mEgl.display, mEgl.readSurface, bitmap);
mMainSurface.localSurface = new QImage(QPixmap::fromSymbianCFbsBitmap(bitmap).toImage());
CleanupStack::Pop(bitmap);
mMainSurface.qSurface = NULL;
mMainSurface.device = mMainSurface.localSurface;
mMainSurface.type = WsTypeQtImage;
mMainSurface.localSurfaceInUse = true;
}
}
// Otherwise updateSurfaceData() will switch back to hw rendering
}
示例10: new
void CAlfPerfAppAvkonTestCaseBasic::ConstructL(
CAlfEnv& aEnv, TInt aCaseId, const TRect& aVisibleArea )
{
CAlfPerfAppBaseTestCaseControl::ConstructL( aEnv, aCaseId, aVisibleArea );
iWinRect = aVisibleArea;
iAvkonControl = new(ELeave) CAvkonTestCoeControl();
iAvkonControl->ConstructL(iWinRect);
iAnimTimer = CPeriodic::NewL(CActive::EPriorityStandard);
TFontSpec myFontSpec(_L("Arial"), 3*120);
CCoeEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iFont, myFontSpec);
// Find my private path
TFileName pathWithoutDrive;
TFileName driveAndPath;
CEikonEnv::Static()->FsSession().PrivatePath( pathWithoutDrive );
driveAndPath.Copy(CEikonEnv::Static()->EikAppUi()->Application()->AppFullName().Left(2));
driveAndPath.Append(pathWithoutDrive);
// Create pictures
iPictureBm = new(ELeave) CFbsBitmap;
driveAndPath.Append(_L("alfperfapp_test1.mbm"));
User::LeaveIfError(iPictureBm->Load(driveAndPath));
iMaskBm = new(ELeave) CFbsBitmap;
User::LeaveIfError(iMaskBm->Create(iPictureBm->SizeInPixels(), EGray256));
iTestCaseStartTime_ys.UniversalTime();
iTestCaseFrameCount = 0;
}
示例11: new
void CSliderControl::LoadPicture()
{
CFbsBitmap* BitMap = new (ELeave) CFbsBitmap();
BitMap->Create(Size(),EColor16M);
CAknsBasicBackgroundControlContext* iContext =
CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,Rect(),ETrue);
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(BitMap);
CBitmapContext* bitGc = NULL;
bitmapDevice->CreateBitmapContext(bitGc);
///
CleanupStack::PushL(iContext);
CleanupStack::PushL(bitmapDevice);
CleanupStack::PushL(bitGc);
AknsDrawUtils::DrawBackground(AknsUtils::SkinInstance(),iContext,NULL,*bitGc,TPoint(0,0),Rect(),0);
CleanupStack::PopAndDestroy(3);
iIcon=BitMap;
/*
CFbsBitmap* mask;
CFbsBitmap* icon;
_LIT(KPath,"\\resource\\apps\\TweakS_ui.mif");
AknIconUtils::CreateIconL(icon,mask,KPath,EMbmTweaks_uiButton_dlg_bg,EMbmTweaks_uiButton_dlg_bg_mask);
AknIconUtils::SetSize(icon,Size(),EAspectRatioNotPreserved);
AknIconUtils::SetSize(mask,Size(),EAspectRatioNotPreserved);
iIcon=CGulIcon::NewL(icon,mask);
*/
}
示例12: DrawIconL
static void DrawIconL(CWindowGc& aGc, CGulIcon& aIcon, const TJuikLayoutItem& aL, TBool aDoCenter=ETrue)
{
CALLSTACKITEMSTATIC_N(_CL(""), _CL("DrawIconL"));
CFbsBitmap* bmp = aIcon.Bitmap();
CFbsBitmap* mask = aIcon.Mask();
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
// center
TInt bmpW = bmp->SizeInPixels().iWidth;
TInt areaW = aL.Size().iWidth;
TInt dx = 0;
TInt dy = 0;
if ( aDoCenter && bmpW < areaW )
{
dx = (areaW - bmpW) / 2;
}
TPoint tl = aL.TopLeft();
tl += TPoint(dx,dy);
TRect r(TPoint(0,0), bmp->SizeInPixels());
if ( mask )
{
aGc.BitBltMasked( tl, bmp, r, mask, ETrue);
}
else
{
aGc.BitBlt( tl, bmp, r);
}
}
示例13: SpriteUpdateMemberNegTestsL
/**
@SYMTestCaseID GRAPHICS-CODEBASE-WSERV-0054-0001
@SYMPREQ PGM027
@SYMTestCaseDesc Negative Tests RWsSpriteBase::UpdateMember API.
@SYMTestPriority 1
@SYMTestStatus Implemented
@SYMTestActions This test calls RWsPointerCursor::UpdateMember
@SYMTestExpectedResults Should run properly with out any Panics.
*/
void CTTSprite::SpriteUpdateMemberNegTestsL()
{
RWsPointerCursor iCursor1;
CFbsBitmap bitmap;
bitmap.Load(TEST_BITMAP_NAME,0);
RWindow win(TheClient->iWs);
win.Construct(*TheClient->iGroup->GroupWin(),1);
win.Activate();
iCursor1=RWsPointerCursor(TheClient->iWs);
TSpriteMember member;
SetUpMember(member);
member.iBitmap=&bitmap;
User::LeaveIfError(iCursor1.Construct(0));
User::LeaveIfError(iCursor1.AppendMember(member));
User::LeaveIfError(iCursor1.Activate());
win.SetCustomPointerCursor(iCursor1);
iCursor1.UpdateMember(-100);
RWsPointerCursor iCursor2;
bitmap.Load(TEST_NEW_BITMAP_NAME,0);
iCursor2=RWsPointerCursor(TheClient->iWs);
User::LeaveIfError(iCursor2.Construct(0));
User::LeaveIfError(iCursor2.AppendMember(member));
User::LeaveIfError(iCursor2.Activate());
win.SetCustomPointerCursor(iCursor2);
iCursor2.UpdateMember(10000);
iCursor1.Close();
iCursor2.Close();
win.Close();
}
示例14: new
void CMMABitmapWindow::SetDestinationBitmapL(CFbsBitmap* aBitmap)
{
CFbsBitmap* bitmap = new(ELeave)CFbsBitmap();
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap->Duplicate(aBitmap->Handle()));
// create context for bitmap
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(aBitmap);
CleanupStack::PushL(bitmapDevice);
CGraphicsContext* bitmapContext = NULL;
User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext));
CleanupStack::Pop(bitmapDevice); // bitmapDevice
CleanupStack::Pop(bitmap); // bitmap
delete iBitmap;
iBitmap = bitmap;
delete iBitmapDevice;
iBitmapDevice = bitmapDevice;
delete iBitmapContext;
iBitmapContext = bitmapContext;
if (iDrawRect.IsEmpty())
{
iDrawRect.SetSize(iBitmap->SizeInPixels());
}
}
示例15: img1
void tst_QVolatileImage::sharing()
{
QVolatileImage img1(100, 100, QImage::Format_ARGB32);
QVolatileImage img2 = img1;
img1.beginDataAccess();
img2.beginDataAccess();
QVERIFY(img1.constBits() == img2.constBits());
img2.endDataAccess();
img1.endDataAccess();
img1.imageRef(); // non-const call, should detach
img1.beginDataAccess();
img2.beginDataAccess();
QVERIFY(img1.constBits() != img2.constBits());
img2.endDataAccess();
img1.endDataAccess();
// toImage() should return a copy of the internal QImage.
// imageRef() is a reference to the internal QImage.
QVERIFY(img1.imageRef().constBits() != img1.toImage().constBits());
#ifdef Q_OS_SYMBIAN
CFbsBitmap *bmp = new CFbsBitmap;
QVERIFY(bmp->Create(TSize(100, 50), EColor16MAP) == KErrNone);
QVolatileImage bmpimg(bmp);
QVolatileImage bmpimg2;
bmpimg2 = bmpimg;
QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
QCOMPARE(bmpimg2.constBits(), (const uchar *) bmp->DataAddress());
// Now force a detach, which should copy the pixel data under-the-hood.
bmpimg.imageRef();
QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress());
QCOMPARE(bmpimg2.constBits(), (const uchar *) bmp->DataAddress());
delete bmp;
#endif
}