本文整理汇总了C++中CWindowGc::SetBrushStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ CWindowGc::SetBrushStyle方法的具体用法?C++ CWindowGc::SetBrushStyle怎么用?C++ CWindowGc::SetBrushStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWindowGc
的用法示例。
在下文中一共展示了CWindowGc::SetBrushStyle方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawIcon
/**
* Draws the icon for the item to the graphics context aGc, in the middle of the rectangle aRect
*/
EXPORT_C void LafMenuPaneItem::DrawIcon(const MLafEnv& /*aLafEnv*/, const CCoeControl& /*aMenuPane*/, CWindowGc& aGc, const TRect& aRect, const CGulIcon* aIcon, SLafMenuPane::THighlightType aHighlightType)
{
if (aIcon)
{
if (aHighlightType == SLafMenuPane::EDrawHighlight)
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
// Determine the rect available for the bitmap
TRect rect = aRect;
// put the image in the middle of available rect
const CFbsBitmap* bitmap = aIcon->Bitmap();
const TSize bmpSize(bitmap->SizeInPixels());
const TSize rectSize(aRect.Size());
const TPoint offset(((rectSize.iWidth - bmpSize.iWidth) / 2), ((rectSize.iHeight - bmpSize.iHeight) / 2));
const CFbsBitmap* mask = aIcon->Mask();
if (mask)
{
const TRect bmpRect(0, 0, bmpSize.iWidth, bmpSize.iHeight);
aGc.BitBltMasked(rect.iTl+offset, bitmap, bmpRect, mask, ETrue);
}
else
aGc.BitBlt(rect.iTl+offset, bitmap);
if (aHighlightType == SLafMenuPane::EDrawHighlight)
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
}
}
示例2: DrawFramePart
EXPORT_C TBool AknsDrawUtils::DrawFramePart( MAknsSkinInstance* aInstance,
CWindowGc& aGc, const TRect& aRect, const TAknsItemID& aFrameID,
const TAknsFrameElementIndex aFrameElement )
{
if( !aInstance )
{
return EFalse;
}
CAknsImageTableItemData* data = static_cast<CAknsImageTableItemData*>(
aInstance->GetCachedItemData( aFrameID, EAknsITImageTable ) );
if( data && (data->NumberOfImages()==EAknsFrameElementsN) )
{
aGc.SetPenStyle(CGraphicsContext::ENullPen);
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
TBool retVal = CheckAndDrawCachedImage( aInstance, aGc, aRect,
data->ImageIID( aFrameElement ), KAknsDrawParamDefault );
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
return retVal;
}
return EFalse;
}
示例3: PrepareGcForHighlight
/**
* Prepares the graphics context aGc according of aHighlightType before drawing an item. At the
* same time it determines and returns the text color to be used during the drawing of all components
* of an item.
*/
EXPORT_C void LafMenuPane::PrepareGcForHighlight(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TItemAttributes& aItemAttributes)
{
TRgb textColor = aLafEnv.ControlColor(EColorMenuPaneText, aMenuPane); //KEikMenuPaneTextColor;
switch (aItemAttributes.iHighlightType)
{
case SLafMenuPane::EDrawHighlight:
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
textColor = aLafEnv.ControlColor(EColorMenuPaneTextHighlight, aMenuPane);
if (aMenuPane.IsFocused())
{
aGc.SetBrushColor(aLafEnv.ControlColor(EColorMenuPaneHighlight, aMenuPane));
if (aItemAttributes.iFlags&EEikMenuItemDimmed)
textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedTextHighlight, aMenuPane);
}
else
{
aGc.SetBrushColor(aLafEnv.ControlColor(EColorMenuPaneDimmedHighlight, aMenuPane));
textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedTextHighlight, aMenuPane);
}
break;
case SLafMenuPane::ERemoveHighlight:
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
if (aItemAttributes.iFlags&EEikMenuItemDimmed)
textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedText, aMenuPane);
break;
case SLafMenuPane::ENoHighlight:
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
if (aItemAttributes.iFlags&EEikMenuItemDimmed)
textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedText, aMenuPane);
break;
default:
break;
}
aGc.SetPenColor(textColor);
}
示例4: Draw
//Background drawing function
void CTestRectGc::Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const
{
if (iBmpBackground)
{
TPoint a = PositionRelativeToScreen();
TPoint b = aControl.PositionRelativeToScreen();
//The source rect of the background is the relationship between this control and the control being drawn (child)
//plus the subrect (aRect) to be drawn.
TRect SourceRect(b-a+aRect.iTl, aRect.Size());
aGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
aGc.BitBlt(aRect.iTl, iBmpBackground, SourceRect);
aGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
}
else
{
TRect rc;
aGc.SetClippingRect(aRect);
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
aGc.SetBrushColor(iBrushColor);
aGc.SetBrushStyle(iBrushStyle);
aGc.DrawRect(rc);
aGc.CancelClippingRect();
}
}
示例5: PrepareContext
/** Sets the brush settings for the specified graphics context.
If iBitmap is set, it sets this as the brush pattern and sets the brush style
to EPatternedBrush. Otherwise, it sets the brush style and brush colour using
the values of iBrushStyle and iBrushColor.
@param aGc The graphics context to set. */
EXPORT_C void MCoeControlBrushContext::PrepareContext(CWindowGc& aGc) const
{
if (iBitmap)
{
aGc.UseBrushPattern(iBitmap);
aGc.SetBrushStyle(CGraphicsContext::EPatternedBrush);
return;
}
aGc.SetBrushStyle(iBrushStyle);
aGc.SetBrushColor(iBrushColor);
}
示例6: DrawIconL
static void DrawIconL(CWindowGc& aGc, CGulIcon& aIcon, const TJuikLayoutItem& aL, TBool aDoCenter=ETrue)
{
CALLSTACKITEMSTATIC_N(_CL(""), _CL("DrawIconL"));
CFbsBitmap* bmp = aIcon.Bitmap();
CFbsBitmap* mask = aIcon.Mask();
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
// center
TInt bmpW = bmp->SizeInPixels().iWidth;
TInt areaW = aL.Size().iWidth;
TInt dx = 0;
TInt dy = 0;
if ( aDoCenter && bmpW < areaW )
{
dx = (areaW - bmpW) / 2;
}
TPoint tl = aL.TopLeft();
tl += TPoint(dx,dy);
TRect r(TPoint(0,0), bmp->SizeInPixels());
if ( mask )
{
aGc.BitBltMasked( tl, bmp, r, mask, ETrue);
}
else
{
aGc.BitBlt( tl, bmp, r);
}
}
示例7: DrawVisualFeedback
/**
* Draws visual feedback for a menu item to indicate that it has been selected. This is shown for
* the brief interval between the item being selected and the menu being dismissed. Uses the
* environment aLafEnv for setting up the context aGc for the menu pane aMenuPane and draws inside
* the item rectangle aRect.
*
* @since App-Framework_6.1
*/
EXPORT_C void LafMenuPane::DrawVisualFeedback(const MLafEnv& /*aLafEnv*/, const CCoeControl& /*aMenuPane*/,
CWindowGc& aGc, const TRect& aRect)
{
aGc.SetPenColor(KRgbBlack);
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
aGc.DrawRect(aRect);
}
示例8:
/**
Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
Sets the brush style to Solid Brush and Pen Style to Null Pen.\n
Sets the brush colour to Blue and paints an ellipse on the control.\n
*/
void CConeBackgroundTestDrawer2::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
{
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
aGc.SetPenStyle(CGraphicsContext::ENullPen);
aGc.SetBrushColor(TRgb(0x0000ff));
aGc.DrawEllipse(aRect);
}
示例9: DoDraw
/**
Draw function for the CCtlBase class.\n
*/
void CCtlBase::DoDraw( CWindowGc& aGc, TRect aRect ) const
{
aGc.DrawRect( aRect ) ;
aRect.Shrink( 1, 1 ) ;
aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
aGc.DrawRect( aRect ) ;
WriteName( aGc, *iName ) ;
}
示例10: PrepareGcForDrawingItems
/**
* Prepares the graphics context aGc for drawing the items by setting the pen and brush.
*/
EXPORT_C void LafMenuPane::PrepareGcForDrawingItems(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc)
{
const CFont* font = NormalFont(aLafEnv);
aGc.UseFont(font);
aGc.SetPenColor(aLafEnv.ControlColor(EColorMenuPaneText, aMenuPane));
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
aGc.SetBrushColor(aLafEnv.ControlColor(EColorMenuPaneBackground, aMenuPane));
}
示例11: WriteName
/**
Writes the text "aText" on the control.\n
Sets the font,pen colour,brush style used for writing the text.\n
Draws the text uisng Draw Text function of Graphics context.\n
*/
void CCtlBase::WriteName( CWindowGc& aGc, const TDesC& aText ) const
{
TRect rect = Rect() ;
rect.Shrink( 3, 3 ) ;
aGc.UseFont( iFont ) ;
TInt ascent = ( rect.iBr.iY - rect.iTl.iY-iFont->HeightInPixels() ) / 2 + iFont->AscentInPixels() ;
aGc.SetPenColor( KRgbBlack ) ;
aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
aGc.DrawText( aText, rect, ascent, CGraphicsContext::ECenter ) ;
}
示例12: MainL
void MainL()
{
RWsSession ws;
ws.Connect();
CWsScreenDevice* scr = new(ELeave) CWsScreenDevice(ws);
scr->Construct();
CWindowGc* gc = new(ELeave) CWindowGc(scr);
gc->Construct();
RWindowGroup grp(ws);
grp.Construct(0xc0decafe, ETrue);
RWindow win(ws);
win.Construct(grp, 0xbeefcafe);
win.SetExtent(TPoint(20,160), TSize(320,240));
win.Activate();
win.Invalidate();
win.BeginRedraw();
gc->Activate(win);
gc->SetPenStyle(CGraphicsContext::ENullPen);
gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
TBool color = EFalse;
if (Profiler::Start() == KErrNotFound)
{
_LIT(KProfiler,"profiler");
_LIT(KStart,"start -noui -drive=S");
RProcess p;
if (p.Create(KProfiler,KStart) == KErrNone)
{
p.Resume();
p.Close();
}
}
for (TInt col=0; col<KCol; ++col)
{
color = !color;
for (TInt row=0; row<KRow; ++row)
{
TRect rect;
rect.iTl.iX = col * KSize.iWidth;
rect.iTl.iY = row * KSize.iHeight;
rect.SetSize(KSize);
color = !color;
gc->SetBrushColor(color? KRgbBlue : KRgbBlack);
gc->DrawRect(rect);
}
}
gc->Deactivate();
win.EndRedraw();
ws.Flush();
User::After(3000000);
win.Close();
grp.Close();
delete gc;
delete scr;
ws.Close();
Profiler::Stop();
Profiler::Close();
Profiler::Unload();
}
示例13: PieDrawer
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTraceContainer::PieDrawer(CWindowGc& aGc, TPoint aLeftTop, TInt aSize, TInt aProsentages, const TBool& aReverceColor) const
{
TBuf<50> Buffer;
Buffer.Num(aProsentages);
Buffer.Append(_L("%"));
aGc.SetPenColor(KRgbBlack);
if(aReverceColor)
aGc.SetBrushColor(KRgbGreen);
else
aGc.SetBrushColor(KRgbRed);
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
aGc.DrawEllipse(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize));
if(aProsentages < 0)
{
Buffer.Copy(_L("N/A"));
if(aReverceColor)
aGc.SetBrushColor(KRgbGreen);
else
aGc.SetBrushColor(KRgbRed);
}
else
{
TInt HelpPie = 0;
if(aReverceColor)
aGc.SetBrushColor(KRgbRed);
else
aGc.SetBrushColor(KRgbGreen);
TInt Angle =((aProsentages * 360) / 100);
if(Angle == 360)
{
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),aLeftTop,aLeftTop);
}
else if(Angle == 45)
{
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX,aLeftTop.iY));
}
else if(Angle == 135)
{
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX,aLeftTop.iY + aSize));
}
else if(Angle == 225)
{
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX + aSize,aLeftTop.iY + aSize));
}
else if(Angle == 315)
{
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX + aSize,aLeftTop.iY));
}
else if(Angle > 45 && Angle < 135)
{
HelpPie = ((((Angle - 45) * aSize) / 90) + aLeftTop.iY);
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX,HelpPie));
}
else if(Angle > 135 && Angle < 225)
{
HelpPie = ((((Angle - 135) * aSize) / 90) + aLeftTop.iX);
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(HelpPie,aLeftTop.iY + aSize));
}
else if(Angle > 225 && Angle < 315)
{
HelpPie = (((aLeftTop.iY + aSize) - ((Angle - 225) * aSize) / 90));
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX + aSize,HelpPie));
}
else if(Angle > 0 && Angle < 45)
{
HelpPie = (((aLeftTop.iX + (aSize/2)) - ((Angle) * (aSize/2)) / 45));
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(HelpPie,aLeftTop.iY));
}
else if(Angle > 315 && Angle < 360)
{
HelpPie = (((aLeftTop.iX + aSize) - ((Angle - 315) * (aSize/2)) / 45));
aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(HelpPie,aLeftTop.iY));
}
if(aReverceColor)
{
if(Angle > 180)
aGc.SetBrushColor(KRgbGreen);
else
aGc.SetBrushColor(KRgbRed);
}
else
{
if(Angle > 180)
aGc.SetBrushColor(KRgbRed);
else
aGc.SetBrushColor(KRgbGreen);
}
//.........这里部分代码省略.........
示例14: BackgroundBetweenRects
// -----------------------------------------------------------------------------
// AknsDrawUtils::BackgroundBetweenRects()
// (commented in the header).
// -----------------------------------------------------------------------------
//
EXPORT_C TBool AknsDrawUtils::BackgroundBetweenRects(
MAknsSkinInstance* aInstance, MAknsControlContext* aContext,
const CCoeControl* aControl, CWindowGc& aGc,
const TRect& aOuterRect,const TRect& aInnerRect, const TInt aDrawParam )
{
TInt drawParam = aDrawParam;
TInt originalParam = aDrawParam;
TBool retVal = EFalse;
TBool blitFailed = EFalse;
TBool blitAttempted = EFalse;
if ( !&aGc )
{
return retVal;
}
MAknsControlContext* parentContext = GetParentContext( aContext );
if( parentContext )
{
retVal = BackgroundBetweenRects( aInstance, parentContext, aControl, aGc,
aOuterRect, aInnerRect, aDrawParam );
drawParam |= KAknsDrawParamNoClearUnderImage;
}
else if( drawParam & KAknsDrawParamBottomLevelRGBOnly )
{
drawParam |= KAknsDrawParamRGBOnly;
}
originalParam = drawParam;
if( aContext )
{
aContext->UpdateContext();
}
TAknsBackground* bgLayout = RetrieveBackgroundLayout( aContext );
TAknsItemID imgIID( KAknsIIDNone );
CAknsImageItemData* imgData = RetrieveBackgroundImage(
aInstance, bgLayout, imgIID );
// chained background
if (imgData && imgData->ParentIID() != KAknsIIDNone)
{
TAknsItemID parentiid = imgData->ParentIID();
TRect parentDrawRect = imgData->DrawRect();
imgData = RetrieveKnownBackgroundImage(
aInstance, parentiid );
if (imgData)
{
imgData->SetDrawRect(parentDrawRect);
drawParam |= KAknsDrawParamChained ;
}
}
TPoint paDelta = GetParentAbsoluteDelta( bgLayout, aControl );
if (!(aDrawParam & KAknsDrawParamPrepareOnly))
{
aGc.SetPenStyle(CGraphicsContext::ENullPen);
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
}
TBool blit = EFalse;
//Rect for frame border
TRect rlist[4];
rlist[0] = aOuterRect;
rlist[0].iBr.iY=aInnerRect.iTl.iY;
rlist[1] = rlist[0];
rlist[1].iBr.iY=aOuterRect.iBr.iY;
rlist[1].iTl.iY=aInnerRect.iBr.iY;
rlist[2] = aInnerRect;
rlist[2].iTl.iX=aOuterRect.iTl.iX;
rlist[2].iBr.iX=aInnerRect.iTl.iX;
rlist[3] = rlist[2];
rlist[3].iTl.iX=aInnerRect.iBr.iX;
rlist[3].iBr.iX=aOuterRect.iBr.iX;
if( imgData )
{
blitAttempted = ETrue;
for ( TInt i=0; i <4 ; i++ )
{
if( (drawParam & KAknsDrawParamNoClearUnderImage) == 0 )
{
blit = BlitAndClear( aInstance, aGc, rlist[i],
imgData, imgIID, bgLayout, paDelta, drawParam );
}
else
{
blit = Blit( aInstance, aGc, rlist[i],
imgData, imgIID, bgLayout, paDelta, drawParam );
}
if ( !blit )
{
//.........这里部分代码省略.........