本文整理汇总了C++中CFbsBitGc类的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitGc类的具体用法?C++ CFbsBitGc怎么用?C++ CFbsBitGc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFbsBitGc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: DrawOpaqueMaskBackground
// CFepLayoutChoiceList::DrawChoiceListBackground
// Draw choice list background.
// (other items were commented in a header).
// ---------------------------------------------------------------------------
//
void CFepLayoutChoiceList::DrawChoiceListBackground(const TRect& aRect)//, TBool aDrawBorder)
{
if( iBackgroundSkinID.iMajor != EAknsMajorNone &&
iBackgroundSkinID.iMinor != EAknsMinorNone )
{
//draw bitmap
DrawOpaqueMaskBackground( aRect );
TRect rtInnerRect( aRect );
rtInnerRect.Shrink( 1, 1 );
CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
gc->Activate( BitmapDevice() );
AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(),
*gc,
aRect,
rtInnerRect,
iBackgroundSkinID,
KAknsIIDDefault );
}
else
{
//draw bitmap
DrawOpaqueMaskBackground();
//front bitmaps-------
DrawBackground();
}
}
示例3: new
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;
}
示例4: DrawBitmap
// CFepLayoutChoiceList::DrawBitmap
// Draw bitmap helper function.
// (other items were commented in a header).
// ---------------------------------------------------------------------------
//
void CFepLayoutChoiceList::DrawBitmap(const TRect& aDestRect, const TRect& aSrcRect,
CFbsBitmap* aBmp, TBool aFast)
{
CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
if( aFast )
{
gc->BitBlt(aDestRect.iTl, aBmp, aSrcRect);
}
else
{
gc->DrawBitmap(aDestRect, aBmp, aSrcRect);
}
}
示例5: STATIC_CAST
void CEmTubeSplashViewContainer::ConstructL(const TRect& aRect)
{
iAlpha = KAlphaMax;
iAppUi = STATIC_CAST(CEmTubeAppUi*, CEikonEnv::Static()->EikAppUi());
CreateWindowL();
TSize size( KBitmapSize, KBitmapSize );
CFbsBitmap *bmp = AknIconUtils::CreateIconL( KBitmapFileName, EMbmOpenvideohubLogo_white );
CleanupStack::PushL( bmp );
AknIconUtils::SetSize( bmp, size );
iBitmap = new (ELeave) CFbsBitmap();
iBitmap->Create( size, EColor16MU );
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( iBitmap );
CleanupStack::PushL( bitmapDevice );
CFbsBitGc* bitmapGc = CFbsBitGc::NewL();
CleanupStack::PushL( bitmapGc );
bitmapGc->Activate( bitmapDevice );
bitmapGc->DrawBitmap( size, bmp );
CleanupStack::PopAndDestroy( bitmapGc );
CleanupStack::PopAndDestroy( bitmapDevice );
CleanupStack::PopAndDestroy( bmp );
iTmpBitmap = new (ELeave) CFbsBitmap;
iTmpBitmap->Create( TSize(KBitmapSize, KBitmapSize), EColor16MU );
SetRect(aRect);
iClientRect = aRect;
ActivateL();
SetExtentToWholeScreen();
iAppUi->StopDisplayingPopupToolbar();
iFadeTimer = CEmTubeTimeOutTimer::NewL( *this );
iFadeTimer->After( KFadePeriod, ECommandFadeIn );
iTimer = CEmTubeTimeOutTimer::NewL( *this );
iTimer->After( KSplashTime, ECommandFinish );
#ifdef __S60_50__
MTouchFeedback* feedback = MTouchFeedback::Instance();
if ( feedback )
{
feedback->EnableFeedbackForControl( this, ETrue );
}
#endif
}
示例6: CreateSoftwareBitmapLC
/**
Draws a stretched bitmap with or without a mask.
@param aUseMask set to ETrue to use a alpha mask. Normally used for 16MU display modes that do not store the alpha.
@param aSrcMode is the source display mode
@param aDstMode is the destination display mode
@param aSession is the windows server session
@param aWindow is a reference to the window
@param aGc is the graphics context of the window
@param aNumIterations is the number of iterations to run the test
*/
void CAlphaBlendTest::DoDrawBitmapL(TBool aUseMask, TDisplayMode aSrcMode, TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
{
const TSize bitmapSize = aWindow.Size();
// Construct target bitmap.
CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
CleanupStack::PushL(bitmapDevice);
// Construct GC.
CFbsBitGc* bitmapGc = NULL;
User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));
CleanupStack::PushL(bitmapGc);
// Construct source bitmap.
TSize smallerSize(bitmapSize.iWidth/2, bitmapSize.iHeight/2);
CFbsBitmap* source = CreateSoftwareBitmapLC(smallerSize, aSrcMode);
VerticalGradientAlphaL(source, TRgb(0x00000000), TRgb(0xffffffff));
CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(smallerSize, EGray256); // match size to src
VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
bitmapGc->SetBrushColor(TRANSPARENT_BLACK);
bitmapGc->Clear();
bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
aGc->Activate(aWindow);
TPoint point(0,0);
bitmapGc->BitBlt(point, bitmapTarget);
aGc->Deactivate();
aSession.Flush();
TBuf <20> testName;
if (!aUseMask)
{
testName=_L("DrawBitmap");
iProfiler->InitResults();
for(int i=0; i<aNumIterations; i++)
{
bitmapGc->DrawBitmap(TRect(point, bitmapSize), source);
iProfiler->MarkResultSetL();
}
}
else
{
testName=_L("DrawBitmapMasked");
iProfiler->InitResults();
for(int i=0; i<aNumIterations; i++)
{
bitmapGc->DrawBitmapMasked(TRect(point, bitmapSize), source,TRect(point, smallerSize), sourceAlpha, EFalse);
iProfiler->MarkResultSetL();
}
}
INFO_PRINTF4(_L("%S(Stretched) with src = %S, dst = %S"), &testName, &ColorModeName(aSrcMode), &ColorModeName(aDstMode));
iProfiler->ResultsAnalysis(testName, 0, aSrcMode, aDstMode, aNumIterations);
// copy up to screen for sanity check
BitBlt(aSession, aWindow, aGc, *bitmapTarget);
CleanupStack::PopAndDestroy(5, bitmapTarget);
}
示例7:
void CTap2MenuAppUi::CopyBitmapL(CFbsBitmap *aSource, CFbsBitmap *aTarget)
{
if(aSource != NULL && aTarget != NULL)
{
if(aSource->SizeInPixels() != aTarget->SizeInPixels() || aSource->DisplayMode() != aTarget->DisplayMode())
{User::Leave(KErrArgument);}
CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(aTarget);
CleanupStack::PushL(device);
CFbsBitGc* gc = NULL;
User::LeaveIfError(device->CreateContext(gc));
CleanupStack::PushL(gc);
gc->BitBlt(TPoint(0, 0), aSource);
CleanupStack::PopAndDestroy(gc);
CleanupStack::PopAndDestroy(device);
}
}
示例8: TRAP_IGNORE
// -----------------------------------------------------------------------------
// CMaskedBitmap::TileInBitmapRect
// -----------------------------------------------------------------------------
void CMaskedBitmap::TileInBitmapRect( CFbsBitGc& gc, const TRect& bmpRect, const TPoint& srcPt )
{
if (!HasMask())
{
TRAP_IGNORE(
CFbsBitGc* copy = CFbsBitGc::NewL();
CleanupStack::PushL( copy );
copy->Activate( (CFbsDevice*) gc.Device() );
copy->CopySettings( gc );
copy->UseBrushPattern(iBitmap);
copy->SetPenStyle(CGraphicsContext::ENullPen);
copy->SetBrushStyle(CGraphicsContext::EPatternedBrush);
copy->SetBrushOrigin(srcPt);
copy->DrawRect(bmpRect);
copy->DiscardBrushPattern();
CleanupStack::PopAndDestroy( copy );
);
示例9: new
/**
Copy a source bitmap into a new bitmap with the specified display mode
*/
CFbsBitmap* CTe_graphicsperformanceSuiteStepBase::CopyIntoNewBitmapL(CFbsBitmap* aSrc, TDisplayMode aDisplayMode)
{
CFbsBitmap* dstBmp = new(ELeave) CFbsBitmap;
CleanupStack::PushL(dstBmp);
TInt ret=dstBmp->Create(aSrc->SizeInPixels(), aDisplayMode);
User::LeaveIfError(ret);
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(dstBmp);
CleanupStack::PushL(bitmapDevice);
CFbsBitGc* gc;
ret = bitmapDevice->CreateContext(gc);
User::LeaveIfError(ret);
CleanupStack::PushL(gc);
gc->BitBlt(TPoint(0,0), aSrc);
CleanupStack::PopAndDestroy(2, bitmapDevice); // gc, bitmapDevice
CleanupStack::Pop(dstBmp);
return dstBmp;
}
示例10: new
class CFbsBitmap* WFBitmapUtil::CopyBitmapL(class CFbsBitmap* aBitmap)
{
if (!aBitmap) {
return NULL;
}
class CFbsBitmap* copiedBitmap = new (ELeave) CFbsBitmap();
copiedBitmap->Create(aBitmap->SizeInPixels(), aBitmap->DisplayMode());
CFbsBitmapDevice* fbsdev = CFbsBitmapDevice::NewL(copiedBitmap);
CleanupStack::PushL(fbsdev);
CFbsBitGc* fbsgc = CFbsBitGc::NewL();
CleanupStack::PushL(fbsgc);
fbsgc->Activate(fbsdev);
fbsgc->BitBlt(TPoint(0,0),aBitmap);
CleanupStack::PopAndDestroy(2);
return copiedBitmap;
}
示例11: ClearRect
// ---------------------------------------------------------------------------
// CFepUiLayoutRootCtrl::DrawFrame
// Draw moving frame
// (other items were commented in a header).
// ---------------------------------------------------------------------------
//
TRect CFepUiLayoutRootCtrl::DrawFrame(const TRect& aFrameRect, TBool aDrawFlag)
{
//clear shadow when moving
TBool updateShadowArea = EFalse;
TRect dirtyRect;
if(iShadowShown)
{
ClearRect(iShadowRect);
iShadowShown = EFalse;
updateShadowArea = ETrue;
}
TRect bmpRect;
TPoint bmpPos;
CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
//draw mask background
TRgb maskPenCol = aDrawFlag ? TRgb(KOpaqueColor) : TRgb(KTransparentColor);
DrawBackgroundToDevice(aFrameRect,MaskBitmapDevice(), 0,
//TRgb(KTransparentColor), TRgb(KOpaqueColor),EFalse);
TRgb(KTransparentColor), maskPenCol,EFalse);
//draw background
TRgb penCor = aDrawFlag ? KRgbBlack : KRgbWhite;
TAknsQsnOtherColorsIndex clrIndex;
clrIndex = EAknsCIQsnOtherColorsCG9;
if ( AknsUtils::AvkonSkinEnabled() )
{
AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
penCor, KAknsIIDQsnTextColors, clrIndex );
}
DrawBackgroundToDevice(aFrameRect,BitmapDevice(),0,TRgb(KRgbWhite),penCor,EFalse);
gc->RectDrawnTo(dirtyRect);
if(updateShadowArea)
return iShadowRect;
else
return dirtyRect;
}
示例12: bitmap
/**
Copy a bitmap into another bitmap (generally in a different displaymode)
tiles destination bitmap with source
*/
void CTe_graphicsperformanceSuiteStepBase::CopyBitmapL(CFbsBitmap* aDst, CFbsBitmap* aSrc)
{
TSize srcSize = aSrc->SizeInPixels();
TSize dstSize = aDst->SizeInPixels();
CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(aDst);
CleanupStack::PushL(dev);
CFbsBitGc* gc = NULL;
if ( 0 == dev->CreateContext(gc) )
{
CleanupStack::PushL(gc);
TPoint point;
gc->SetBrushColor(TRANSPARENT_BLACK);
gc->SetBrushStyle(CGraphicsContext::ENullBrush);
gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
gc->Clear();
gc->SetDrawMode(CGraphicsContext::EDrawModePEN);
for(point.iY=0; point.iY<dstSize.iHeight; point.iY+=srcSize.iHeight)
{
for(point.iX=0; point.iX<dstSize.iWidth; point.iX+=srcSize.iWidth)
{
gc->BitBlt(point, aSrc);
}
}
CleanupStack::PopAndDestroy(gc);
}
CleanupStack::PopAndDestroy(dev);
}
示例13: bitmap
/**
Auxilary function called to Copy the screen to bitmap (mbm) file.
@param aHashIndex contains hashID. Bitmap is created with the aHashIndex as name
*/
EXPORT_C void CTHashReferenceImages::CopyScreenToBitmapL(const TDesC& aHashIndex)
{
CFbsBitmap *bitmap = new(ELeave)CFbsBitmap();
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap->Create(iBitmapDevice->SizeInPixels(), iBitmapDevice->DisplayMode()));
TRect rect = TRect(iBitmapDevice->SizeInPixels());
CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
CleanupStack::PushL(device);
CFbsBitGc *gc;
User::LeaveIfError(device->CreateContext(gc));
gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
gc->BitBlt(TPoint(), iBitmap, rect);
TFileName mbmFile;
mbmFile.Format(iPath->Des(), &aHashIndex);
bitmap->Save(mbmFile);
delete gc;
CleanupStack::PopAndDestroy(2);
}
示例14: Draw
void CTransparentBitmap::Draw(CFbsBitGc& gc,TInt aX, TInt aY)
{
// gc.BitBlt(TPoint(aX,aY),iMaskBitmap);
if (iSrcBitmap && iMaskBitmap)
{
TRect sourceRect( TPoint( 0,0 ),iSrcBitmap->SizeInPixels() );
gc.BitBltMasked(TPoint(aX,aY),iSrcBitmap,sourceRect,iMaskBitmap,ETrue);
}
}
示例15: BitBlt
// -----------------------------------------------------------------------------
// CMaskedBitmap::BitBlt
// -----------------------------------------------------------------------------
void CMaskedBitmap::BitBlt( CFbsBitGc& aContext, const TPoint& aPoint ) const
{
TSize s(iBitmap->SizeInPixels());
if (!(s.iWidth>0 && s.iHeight>0))
{
return;
}
if( iBitmap->Handle() )
{
if( iMask->Handle() )
{
aContext.BitBltMasked( aPoint, iBitmap, s, iMask, iInvertMask );
}
else
{
aContext.BitBlt( aPoint, iBitmap, s );
}
}
}