本文整理汇总了C++中CFbsBitGc::SetBrushStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitGc::SetBrushStyle方法的具体用法?C++ CFbsBitGc::SetBrushStyle怎么用?C++ CFbsBitGc::SetBrushStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFbsBitGc
的用法示例。
在下文中一共展示了CFbsBitGc::SetBrushStyle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyBitmapL
/**
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);
}
示例2: 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;
}
示例3: 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);
}
示例4: DoBitBltAlphaBitmapTestL
/**
Bitblt test
@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::DoBitBltAlphaBitmapTestL(TDisplayMode aSrcMode,TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
{
const TSize bitmapSize = aWindow.Size();
CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
CleanupStack::PushL(bitmapDevice);
CFbsBitGc* bitmapGc = NULL;
User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));
CleanupStack::PushL(bitmapGc);
CFbsBitmap* source = CreateSoftwareBitmapLC(bitmapSize, aSrcMode);
CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(bitmapSize, EGray256); // match size to src
VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
VerticalGradientAlphaL(source, TRgb(0x00000000), TRgb(0xffffffff));
TPoint point(0,0);
bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
bitmapGc->SetBrushColor(TRANSPARENT_BLACK);
bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
bitmapGc->Clear();
bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
bitmapGc->BitBlt(point, source);
aGc->Activate(aWindow);
aGc->BitBlt(point, bitmapTarget);
aGc->Deactivate();
aSession.Flush();
iProfiler->InitResults();
for(TInt i=0; i<aNumIterations; i++)
{
bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
bitmapGc->Clear();
bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
bitmapGc->BitBlt(point, source);
iProfiler->MarkResultSetL();
}
iProfiler->ResultsAnalysis(_L("DoBitBltAlphaBitmapTestL"), 0, aSrcMode, aDstMode, aNumIterations);
// copy up to screen for sanity check
aGc->Activate(aWindow);
aGc->BitBlt(TPoint(), bitmapTarget);
aGc->Deactivate();
CleanupStack::PopAndDestroy(5, bitmapTarget); //sourceAlpha, source, bitmapGc, bitmapDevice, bitmapTarget
}
示例5: DrawL
void CTSpriteAnim::DrawL(TInt aOpcode)
{
CFbsBitmap *bitmap=iSpriteFunctions->GetSpriteMember(0)->iBitmap;
CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
CleanupStack::PushL(device);
CFbsBitGc *gc;
User::LeaveIfError(device->CreateContext(gc));
CleanupStack::PushL(gc);
gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
gc->SetPenSize(TSize());
TSize bitmapSize=bitmap->SizeInPixels();
TSize size= bitmapSize;
size.SetSize(size.iWidth/2,size.iHeight/2);
TPoint point=size.AsPoint();
// according to the opcode used, a quarter of the sprite bitmap is drawn to a different colour
switch(aOpcode)
{
case EADllDraw1:
{
gc->SetBrushColor(TRgb(255,0,0));
gc->DrawRect(TRect(TPoint(),size));
break;
}
case EADllDraw2:
{
gc->SetBrushColor(TRgb(0,255,0));
gc->DrawRect(TRect(TPoint(point.iX,0),size));
break;
}
case EADllDraw3:
{
gc->SetBrushColor(TRgb(0,0,255));
gc->DrawRect(TRect(TPoint(0,point.iY),size));
break;
}
case EADllDrawBlank:
{//the whole sprite bitmap is set to blank
gc->SetBrushColor(TRgb(255,255,255));
gc->DrawRect(TRect(TPoint(),bitmapSize));
break;
}
default:;
}
iSpriteFunctions->UpdateMember(0,TRect(bitmap->SizeInPixels()),ETrue);
CleanupStack::PopAndDestroy(2); //gc and device
}
示例6: TileInBitmapRect
// -----------------------------------------------------------------------------
// 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 );
);
示例7: DoProcessMaskL
// ============================================================================
// CIconConverter::DoProcessMaskL()
// process the bitmap mask
//
// @since 3.1
// ============================================================================
void CIconConverter::DoProcessMaskL()
{
// we use white to mean transparent at this stage, simply for efficiency
// since all the canvases we will copy in to begin as white
if ( iOriginalBitmapMask->Handle() == 0 )
{
// Create a mask that shows the whole bitmap as an icon
// (all black)
User::LeaveIfError( iOriginalBitmapMask->Create(
iOriginalBitmap->SizeInPixels(), EGray2 ) );
CFbsBitmapDevice* device =
CFbsBitmapDevice::NewL( iOriginalBitmapMask );
CleanupStack::PushL( device );
CFbsBitGc* gc;
User::LeaveIfError( device->CreateContext( gc ) );
gc->SetBrushStyle( CGraphicsContext::ESolidBrush );
gc->SetDrawMode( CGraphicsContext::EDrawModePEN );
gc->SetBrushColor( KRgbBlack );
// Create a big black image
gc->Clear();
delete gc;
CleanupStack::PopAndDestroy( device );
}
else
{
// Invert the mask obtained from the PNG
CFbsBitmapDevice* device =
CFbsBitmapDevice::NewL( iOriginalBitmapMask );
CleanupStack::PushL(device);
CFbsBitGc* gc;
User::LeaveIfError( device->CreateContext( gc ) );
gc->SetDrawMode( CGraphicsContext::EDrawModeNOTSCREEN );
gc->Clear();
delete gc;
CleanupStack::PopAndDestroy( device );
}
// Scale the icon to the sizes required
iCurrentSizeIndex = 0;
DoIconScalingL();
}
示例8: DrawViewFinderErrorL
// ---------------------------------------------------------------------------
// CMMACameraWindow::DrawViewFinderError()
// Draws the error message to specified area.
// Used in cases when viewfinder is unable to start.
// ---------------------------------------------------------------------------
//
void CMMACameraWindow::DrawViewFinderErrorL(
const TInt /*aError*/,
const TRect& aDrawRect)
{
ASSERT(iDirectAccess);
TInt dcError = KErrNone;
if (!iDirectAccess->IsActive())
{
TRAP(dcError, iDirectAccess->StartL());
}
TRect drawRect(aDrawRect);
if (dcError == KErrNone)
{
drawRect.Intersection(iClientRect);
drawRect.Move(-iWindow->AbsPosition());
CFbsBitGc* directGc = iDirectAccess->Gc();
directGc->SetClippingRect(drawRect);
directGc->SetBrushColor(TRgb(128,128,128));
directGc->SetPenColor(TRgb(128,0,0));
directGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
directGc->SetPenStyle(CGraphicsContext::ESolidPen);
directGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
directGc->DrawRect(drawRect);
if (!iErrorIconBitmap || !iErrorIconMaskBitmap)
{
if (iErrorIconBitmap)
{
delete iErrorIconBitmap;
iErrorIconBitmap = NULL;
}
if (iErrorIconMaskBitmap)
{
delete iErrorIconMaskBitmap;
iErrorIconMaskBitmap = NULL;
}
/*
AknsUtils::CreateIconL(
AknsUtils::SkinInstance(),
KAknsIIDQgnIndiCam4Camera,
iErrorIconBitmap,
iErrorIconMaskBitmap,
KCameraAppBitmapFile,
EMbmCameraappQgn_indi_cam4_camera,
EMbmCameraappQgn_indi_cam4_camera_mask
);
*/
}
//TRect iconRect
drawRect.iTl.iX += KErrorIconMargin;
drawRect.iTl.iY += KErrorIconMargin;
drawRect.iBr.iX -= KErrorIconMargin;
drawRect.iBr.iY -= KErrorIconMargin;
if (iErrorIconBitmap->SizeInPixels() != drawRect.Size())
{
AknIconUtils::SetSize(iErrorIconBitmap, drawRect.Size());
AknIconUtils::SetSize(iErrorIconMaskBitmap, drawRect.Size());
}
directGc->BitBltMasked(
drawRect.iTl, iErrorIconBitmap,
TRect(iErrorIconBitmap->SizeInPixels()),
iErrorIconMaskBitmap, EFalse);
iDirectAccess->ScreenDevice()->Update();
}
}
示例9: Draw
EXPORT_C void CBubbleCtrl::Draw()
{
if(!AbleToDraw() || iFreeze ) //|| !iShowing )
{
return;
}
CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
//mask bitmaps
DrawOpaqueMaskBackground();
TRect rect = Rect();
TRect innerRect = rect;
if ( ( iLeftDiff == 0 ) && ( iTopDiff == 0 )
&& ( iRightDiff == 0 ) && ( iBottomDiff == 0 ) )
{
innerRect.Shrink( KShrinkSize, 0 );
}
else
{
innerRect.iTl.iX = innerRect.iTl.iX + iLeftDiff;
innerRect.iTl.iY = innerRect.iTl.iY + iTopDiff;
innerRect.iBr.iX = innerRect.iBr.iX - iRightDiff;
innerRect.iBr.iY = innerRect.iBr.iY - iBottomDiff;
}
// ----- draw bitmaps -----
gc->Activate( BitmapDevice() );
//gc->Clear(rect);
// Draw background
if ( iBgSkinId.iMajor )
{
AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(),
*gc,
rect,
innerRect,
iBgSkinId,
KAknsIIDDefault );
}
else if( iFirstBmpId.iMajor && iMiddleBmpId.iMajor && iLastBmpId.iMajor )
{
AknPenInputDrawUtils::Draw3PiecesFrame( AknsUtils::SkinInstance(),
*gc,
rect,
innerRect,
iFirstBmpId,
iMiddleBmpId,
iLastBmpId);
}
else
{
DrawBackground();
}
if ( iForgroundBmp )
{
if( iForgroundBmp->SizeInPixels() != innerRect.Size() )
{
AknIconUtils::SetSize( iForgroundBmp, innerRect.Size(), EAspectRatioNotPreserved );
}
TRect srcRect( TPoint( 0, 0 ), iForgroundBmp->SizeInPixels() );
if( iForgroundBmpMask )
{
if( iForgroundBmpMask->SizeInPixels() != innerRect.Size() )
{
AknIconUtils::SetSize( iForgroundBmpMask, innerRect.Size(), EAspectRatioNotPreserved);
}
gc->BitBltMasked( innerRect.iTl,
iForgroundBmp,
srcRect,
iForgroundBmpMask,
EFalse);
}
else
{
gc->BitBlt( innerRect.iTl,
iForgroundBmp,
srcRect );
}
}
if ( iText )
{
gc->SetBrushStyle( CGraphicsContext::ENullBrush );
TAknLayoutText textLayout;
textLayout.LayoutText(Rect(), iTextFormat);
TRgb color( KRgbBlack ); // sane default for nonskinned case
if ( AknsUtils::AvkonSkinEnabled() )
{
AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
color, KAknsIIDQsnTextColors, iTextColorIndex );
}
//.........这里部分代码省略.........
示例10: CreateColorIconLC
EXPORT_C void AknsUtils::CreateColorIconLC(
MAknsSkinInstance* aInstance, const TAknsItemID& aID,
const TAknsItemID& aColorID, const TInt aColorIndex,
CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
const TDesC& aFilename,
const TInt aFileBitmapId, const TInt aFileMaskId,
const TRgb aDefaultColor,
const TSize& aSize, const TScaleMode aScaleMode )
{
CFbsBitmap* bitmap = NULL;
CFbsBitmap* mask = NULL;
CreateIconLC( aInstance, aID, bitmap, mask,
aFilename, aFileBitmapId, aFileMaskId ); // (2)
TRgb color = aDefaultColor;
// Return value intentionally ignored
GetCachedColor( aInstance, color, aColorID, aColorIndex );
if( AknIconUtils::IsMifIcon( bitmap ) )
{
AknIconUtils::SetIconColor( bitmap, color );
aBitmap = bitmap;
aMask = mask;
}
else // Create Own Icon
{
CFbsBitmap* colorBitmap = new (ELeave) CFbsBitmap();
CleanupStack::PushL( colorBitmap ); // (3)
TSize size = mask->SizeInPixels();
User::LeaveIfError(
colorBitmap->Create( size,
CEikonEnv::Static()->ScreenDevice()->DisplayMode() ) );
CFbsBitmapDevice* colorBmpDev = CFbsBitmapDevice::NewL( colorBitmap );
CleanupStack::PushL( colorBmpDev ); // (4)
User::LeaveIfError( colorBmpDev->Resize( size ) );
CFbsBitGc* colorBmpGc = CFbsBitGc::NewL();
CleanupStack::PushL( colorBmpGc ); // (5)
colorBmpGc->Activate( colorBmpDev );
colorBmpGc->SetBrushColor( color );
colorBmpGc->SetPenStyle( CGraphicsContext::ENullPen );
colorBmpGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
colorBmpGc->DrawRect( TRect( TPoint(0,0), size ) );
CleanupStack::PopAndDestroy( 2 ); // colorBmpGc, colorBmpDev (3)
CleanupStack::Pop( 3 ); // colorBmp, bitmap, mask (0)
delete bitmap; // We don't know the order, must destroy manually
aBitmap = colorBitmap;
aMask = mask;
// These are both safe
CleanupStack::PushL( aBitmap ); // (1)
CleanupStack::PushL( aMask ); // (2)
}
if( aSize.iWidth>=0 )
{
// Set the size
User::LeaveIfError(
AknIconUtils::SetSize( aBitmap, aSize, aScaleMode ) );
}
}
示例11: DrawItem
// CFepLayoutChoiceList::DrawItem
// Draw a choice list item.
// (other items were commented in a header).
// ---------------------------------------------------------------------------
//
void CFepLayoutChoiceList::DrawItem(const TRect& aRect, const CFepLayoutChoiceList::SItem& aItem,
TBool aErase, TBool aFocus)
{
if(iWndControl)
return;
CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
if( aErase )
{
SetBorderColor( BkColor() );
//DrawChoiceListBackground( aRect );//, EFalse);
}
if( aFocus )
{
//draw focus bitmap
TRect rtFocusRect(iItemFocusRect);
TRect rtFocusInBmp(TPoint(0,0), iItemFocusRect.Size());
rtFocusRect.Move(aRect.iTl);
TRect rtInnerRect( rtFocusRect );
rtInnerRect.Shrink( 5, 5 );
if( iSubItemSkinID.iMajor != EAknsMajorNone &&
iSubItemSkinID.iMinor != EAknsMinorNone)
{
gc->Activate( BitmapDevice() );
AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(),
*gc,
rtFocusRect,
rtInnerRect,
iSubItemSkinID,
KAknsIIDDefault );
}
else
{
//mask bitmaps-------
gc->Activate( MaskBitmapDevice() );
if( iItemFocusBmpMask )
{
DrawBitmap(rtFocusRect, rtFocusInBmp, iItemFocusBmpMask,
iItemFocusBmpMask->SizeInPixels() == rtFocusInBmp.Size());
}
//front bitmaps-------
gc->Activate( BitmapDevice() );
if( iItemFocusBmp )
{
DrawBitmap(rtFocusRect, rtFocusInBmp, iItemFocusBmp,
iItemFocusBmp->SizeInPixels() == rtFocusInBmp.Size());
}
}
}
//draw text
if (iFont)
{
gc->UseFont(iFont);
gc->SetBrushStyle( CGraphicsContext::ENullBrush );
gc->SetPenColor(iFontColor);
gc->SetPenStyle(CGraphicsContext::ESolidPen);
gc->DrawText(aItem.iText, aRect, iBaseline, CGraphicsContext::ELeft, iMargin);
gc->DiscardFont();
}
}