本文整理汇总了C++中CFbsBitGc::DrawRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitGc::DrawRect方法的具体用法?C++ CFbsBitGc::DrawRect怎么用?C++ CFbsBitGc::DrawRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFbsBitGc
的用法示例。
在下文中一共展示了CFbsBitGc::DrawRect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例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: 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 );
);
示例4: 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();
}
}
示例5: 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 ) );
}
}