本文整理汇总了C++中CFbsBitGc::DrawBitmapMasked方法的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitGc::DrawBitmapMasked方法的具体用法?C++ CFbsBitGc::DrawBitmapMasked怎么用?C++ CFbsBitGc::DrawBitmapMasked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFbsBitGc
的用法示例。
在下文中一共展示了CFbsBitGc::DrawBitmapMasked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoDrawBitmapL
/**
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);
}
示例2: DrawBitmap
// -----------------------------------------------------------------------------
// CMaskedBitmap::DrawBitmap
// -----------------------------------------------------------------------------
void CMaskedBitmap::DrawBitmap( CFbsBitGc& aContext, const TRect& aTarget, const TRect& aSource) const
{
if (!(aSource.Width()>0 && aSource.Height()>0 && aTarget.Width()>0 && aTarget.Height()>0))
{
return;
}
if( iBitmap->Handle() )
{
// ### FIXME DrawBitmapMasked is too buggy to use 2.8/week52, so no transparency with scaling
if( iMask->Handle() )
{
aContext.DrawBitmapMasked( aTarget, iBitmap, aSource, iMask, iInvertMask );
}
else
{
aContext.DrawBitmap( aTarget, iBitmap, aSource );
}
}
}