本文整理汇总了C++中CFbsBitmap::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitmap::Create方法的具体用法?C++ CFbsBitmap::Create怎么用?C++ CFbsBitmap::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFbsBitmap
的用法示例。
在下文中一共展示了CFbsBitmap::Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareScreenContentWithTestBitmapL
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;
}
示例2: ReadSVGL
// ----------------------------------------------------------------------------
// CSysApShutdownImage::ShowShutdownImage()
// ----------------------------------------------------------------------------
CFbsBitmap* CSysApShutdownImage::ReadSVGL (TFileName aFileName)
{
TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL:start" ) ) );
TFontSpec fontspec;
TDisplayMode mode = EColor16MA;
TInt SIZE_X(360), SIZE_Y(360);
TSize size(SIZE_X, SIZE_Y);
//if ( mode >= (TDisplayMode)13 ) { mode = EColor16MA; }
CFbsBitmap* frameBuffer = new ( ELeave ) CFbsBitmap;
CleanupStack::PushL( frameBuffer );
frameBuffer->Create( size, mode );
CSvgEngineInterfaceImpl* svgEngine = NULL;
svgEngine = CSvgEngineInterfaceImpl::NewL(frameBuffer, NULL, fontspec );
if (svgEngine == NULL)
{
TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL:SVG engine creation failed" ) ) );
}
CleanupStack::PushL( svgEngine );
TInt domHandle = 0;
svgEngine->PrepareDom( aFileName, domHandle ) ;
if (domHandle == 0)
{
TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL():DOM handle creation failed" ) ) );
}
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
CleanupStack::PushL( bitmap );
User::LeaveIfError( bitmap->Create( size, EColor64K ) );
svgEngine->UseDom( domHandle, bitmap, NULL ) ;
MSvgError* err;
svgEngine->Start( err );
if (err->HasError())
{
TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL(): SVG Engine Start failed" ) ) );
}
svgEngine->DeleteDom( domHandle );
CleanupStack::Pop( bitmap );
CleanupStack::PopAndDestroy( svgEngine );
CleanupStack::PopAndDestroy( frameBuffer );
TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL:End" ) ) );
return bitmap;
}
示例3: handleSymbianWindowVisibilityChange
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
}
示例4: LoadPicture
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);
*/
}
示例5: 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;
}
示例6: sharing
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
}
示例7: 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;
}
示例8: TestAknIconUtilsScaleBitmapL
// --------------------------------------------------------------------------
// 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;
}
示例9: ConstructL
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;
}
示例10: CreateSoftwareBitmapLC
/**
Creates a bitmap for given size and display mode and leaves it on the cleanup stack
@return pointer to a created CFbsBitmap
*/
CFbsBitmap* CTe_graphicsperformanceSuiteStepBase::CreateSoftwareBitmapLC(const TSize& aSize, TDisplayMode aMode)
{
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap->Create(aSize, aMode));
return bitmap;
}
示例11: CreateCheckedBoardL
/**
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;
}
示例12: group
/**
* Runs the test in a second thread.
*
* @param aFunctionIndex The drawing function command to be executed. All commands are defined in TestFunctionIndex.
*/
TInt CTW32CmdBuf::DoTestCmdBufFunctionL(TTestFunctionIndex aFunctionIndex)
{
RWsSession session;
User::LeaveIfError(session.Connect());
CleanupClosePushL(session);
CWsScreenDevice *device = new(ELeave) CWsScreenDevice(session);
CleanupStack::PushL(device);
User::LeaveIfError(device->Construct(CTestBase::iScreenNo));
CWindowGc* gc;
User::LeaveIfError(device->CreateContext(gc));
CleanupStack::PushL(gc);
RWindowGroup group(session);
User::LeaveIfError(group.Construct(1, EFalse));
CleanupClosePushL(group);
RWindow window(session);
User::LeaveIfError(window.Construct(group, 2));
CleanupClosePushL(window);
window.SetExtent(TPoint(0,0), TSize(200, 200));
User::LeaveIfError(window.SetRequiredDisplayMode(EColor64K));
window.Activate();
gc->Activate(window);
session.SetAutoFlush(EFalse);
window.Invalidate();
window.BeginRedraw();
for(TInt i=KMinTestIterations; i<KMaxTestIterations; ++i)
{
for(TInt j=0; j<i; ++j)
{
gc->Clear();
}
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap->Create(TSize(100, 100), EColor64K));
CFbsBitmap* mask = new(ELeave) CFbsBitmap;
CleanupStack::PushL(mask);
User::LeaveIfError(mask->Create(TSize(100, 100), EColor64K));
KTestFunctions[aFunctionIndex](gc, bitmap, mask);
CleanupStack::PopAndDestroy(2);
session.Flush();
}
window.EndRedraw();
gc->Deactivate();
CleanupStack::PopAndDestroy(5);
return KErrNone;
}
示例13: CreateBitmapL
CFbsBitmap* AknBitmapMirrorUtils::CreateBitmapL(CFbsBitmap* aSourceBitmap, TInt aMirrorDirection)
{
User::LeaveIfNull(aSourceBitmap);
CFbsBitmap* destinationBitmap = new (ELeave) CFbsBitmap();
CleanupStack::PushL(destinationBitmap);
TSize sourceBitmapSize = aSourceBitmap->SizeInPixels();
TRect sourceRect = TRect(TPoint(0,0), sourceBitmapSize);
TSize destinationBitmapSize(sourceRect.Width(), sourceRect.Height());
User::LeaveIfError(destinationBitmap->Create(destinationBitmapSize, aSourceBitmap->DisplayMode()));
CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL( destinationBitmap );
CleanupStack::PushL(destinationDevice);
CFbsBitGc* destinationGc;
User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
switch (aMirrorDirection)
{
case EAknVerticalMirroring:
{
TRect sourceBitmapBlittingRect( sourceRect.iTl.iX,sourceRect.iTl.iY,sourceRect.iBr.iX,sourceRect.iTl.iY + 1 );
for ( TInt yPos=destinationBitmapSize.iHeight-1; yPos >= 0; yPos-- )
{
destinationGc->BitBlt( TPoint(0,yPos), aSourceBitmap, sourceBitmapBlittingRect );
sourceBitmapBlittingRect.iTl.iY++;
sourceBitmapBlittingRect.iBr.iY++;
}
break;
}
case EAknHorizontalMirroring:
{
TRect sourceBitmapBlittingRect( sourceRect.iTl.iX,sourceRect.iTl.iY,sourceRect.iTl.iX + 1,sourceRect.iBr.iY );
for ( TInt xPos=destinationBitmapSize.iWidth-1; xPos >= 0; xPos-- )
{
destinationGc->BitBlt( TPoint(xPos,0), aSourceBitmap, sourceBitmapBlittingRect );
sourceBitmapBlittingRect.iTl.iX++;
sourceBitmapBlittingRect.iBr.iX++;
}
break;
}
default:
{
destinationGc->BitBlt( TPoint(0,0), aSourceBitmap, sourceRect );
break;
}
}
delete destinationGc;
CleanupStack::Pop(2); // destinationBitmap, destinationDevice
delete destinationDevice;
return destinationBitmap;
}
示例14: BitmapCreationSimpleL
/**
Creates and destroys bitmaps of the same size KIterationsToTest times.
@param aWidth The width of the created bitmaps.
@param aHeight The height of the created bitmaps.
@param aDisplayMode The display mode to create bitmaps with.
@param aTestDescription The description of the test.
*/
void CTFbsBitmapHandlePerf::BitmapCreationSimpleL(const TInt aWidth, const TInt aHeight, const TDisplayMode aDisplayMode, const TDesC& aTestDescription)
{
iProfiler->InitResults();
for (TInt count = KIterationsToTest; count > 0; --count)
{
CFbsBitmap bitmap;
TInt err = bitmap.Create(TSize(aWidth, aHeight), aDisplayMode);
User::LeaveIfError(err);
iProfiler->MarkResultSetL();
}
iProfiler->ResultsAnalysis(aTestDescription, aDisplayMode, 0, 0, KIterationsToTest);
}
示例15: CreatePlaceholderIconL
//-----------------------------------------------------------------------------
// CBrowserViewImagesListBox::CreatePlaceholderIconL()
//-----------------------------------------------------------------------------
//
CGulIcon* CBrowserViewImagesListBox::CreatePlaceholderIconL()
{
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
if(KErrNone != bitmap->Create(TSize(42,32), EColor16M))
User::Leave(KErrNoMemory);
// create icon
CGulIcon* icon = CGulIcon::NewL(bitmap); // bitmap is owned, no mask used
CleanupStack::Pop(); // bitmap
return icon;
}