本文整理汇总了C++中CWindowGc类的典型用法代码示例。如果您正苦于以下问题:C++ CWindowGc类的具体用法?C++ CWindowGc怎么用?C++ CWindowGc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CWindowGc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: WriteName
void CMultiPtrTestChildControl::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::ELeft );
aGc.DiscardFont();
}
示例3: DrawShip
void CSpaceInvadersAppView::DrawShip(CWindowGc& aGc) const
{
// Draw the image in the desired position
TPoint shipPoint(iShip->X(), iShip->Y());
aGc.BitBlt( shipPoint, iBitmapShip);
if ( iShip->HasFired() )
{
TPoint shotPoint(iShip->Shot()->X(), iShip->Shot()->Y());
aGc.BitBlt( shotPoint, iBitmapShot );
}
}
示例4: DrawCross
inline void CRecognizerContainer::DrawCross(CWindowGc& gc, const TPoint& center) const
{
CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("DrawCross"));
gc.DrawLine(TPoint(center.iX-5, center.iY), TPoint(center.iX+6, center.iY));
gc.DrawLine(TPoint(center.iX, center.iY-5), TPoint(center.iX, center.iY+6));
}
示例5: DrawMouth
void CSmiley::DrawMouth(CWindowGc& aGc, TBool bSmiling) const
{
aGc.SetPenColor(KRgbBlack);
if (bSmiling)
{
aGc.DrawArc(iSmileRect,
iSmileRect.iTl + TPoint(0, iSmileRect.Height() / 2),
iSmileRect.iTl + TPoint(iSmileyWidth / 2, iSmileRect.Height() / 2));
}
else
{
aGc.DrawArc(iFrownRect,
iFrownRect.iTl + TPoint(iSmileyWidth / 2, iFrownRect.Height() / 2),
iFrownRect.iTl + TPoint(0, iFrownRect.Height() / 2));
}
}
示例6: CleanupClosePushL
/**
* Runs the test in a second thread.
*
* @param aFunctionIndex The drawing function command to be executed. All commands are defined in TestFunctionIndex.
*/
TInt CTW32CmdBuf::DoTestCmdBufFunctionL(TTestFunctionIndex aFunctionIndex)
{
RWsSession session;
User::LeaveIfError(session.Connect());
CleanupClosePushL(session);
CWsScreenDevice *device = new(ELeave) CWsScreenDevice(session);
CleanupStack::PushL(device);
User::LeaveIfError(device->Construct(CTestBase::iScreenNo));
CWindowGc* gc;
User::LeaveIfError(device->CreateContext(gc));
CleanupStack::PushL(gc);
RWindowGroup group(session);
User::LeaveIfError(group.Construct(1, EFalse));
CleanupClosePushL(group);
RWindow window(session);
User::LeaveIfError(window.Construct(group, 2));
CleanupClosePushL(window);
window.SetExtent(TPoint(0,0), TSize(200, 200));
User::LeaveIfError(window.SetRequiredDisplayMode(EColor64K));
window.Activate();
gc->Activate(window);
session.SetAutoFlush(EFalse);
window.Invalidate();
window.BeginRedraw();
for(TInt i=KMinTestIterations; i<KMaxTestIterations; ++i)
{
for(TInt j=0; j<i; ++j)
{
gc->Clear();
}
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap->Create(TSize(100, 100), EColor64K));
CFbsBitmap* mask = new(ELeave) CFbsBitmap;
CleanupStack::PushL(mask);
User::LeaveIfError(mask->Create(TSize(100, 100), EColor64K));
KTestFunctions[aFunctionIndex](gc, bitmap, mask);
CleanupStack::PopAndDestroy(2);
session.Flush();
}
window.EndRedraw();
gc->Deactivate();
CleanupStack::PopAndDestroy(5);
return KErrNone;
}
示例7: DrawWeek
void CCalendarManagerContainer::DrawWeek(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Font_Color1, const CFont& p_Font) const
{
gc.SetPenColor(p_Default_Font_Color1);
gc.SetUnderlineStyle(EUnderlineOff);
TInt i_Pos_X = 0;
TInt i_Pos_Y = g_Pos_Y;
for (TInt i = 0;i < sizeof(g_CalendarClass->g_Week) / sizeof(TInt);i++)
{
TBuf<10> i_Num;
i_Num.AppendNum(g_CalendarClass->g_Week[i]);
gc.DrawText(i_Num, TRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X, i_Pos_Y + g_Space_Y), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels() + 1, CGraphicsContext::ECenter, 0);
i_Pos_Y += g_Space_Y + 2;
}
}
示例8: Draw
void CCustomControlScroll::Draw(CWindowGc& gc)
{
TInt x, y;
//上图标
x = iDisplayPoint.iX;
y = iDisplayPoint.iY;
if (iBitmapDirection[0])
gc.BitBlt(TPoint(x, y), iBitmapDirection[0]);
//下图标
y += iDisplaySize.iHeight-iBitmapHeight;
if (iBitmapDirection[1])
gc.BitBlt(TPoint(x, y), iBitmapDirection[1]);
//滚动条
y = iDisplayPoint.iY+iScrollerPosY;
if (iBitmapScroller)
gc.BitBlt(TPoint(x, y), iBitmapScroller);
}
示例9: DrawEyebrow
void CSmiley::DrawEyebrow(CWindowGc & aGc, TBool bSmiling) const
{
//Draw the mouth, smiling or looking sad.
aGc.SetPenSize(TSize(1, 1));
aGc.SetPenColor(KRgbWhite);
if (bSmiling)
{
aGc.DrawArc(iFrownRect,
iFrownRect.iTl + TPoint(iSmileyWidth / 2, iFrownRect.Height() / 2),
iFrownRect.iTl + TPoint(0, iFrownRect.Height() / 2));
}
else
{
aGc.DrawArc(iSmileRect,
iSmileRect.iTl + TPoint(0, iSmileRect.Height() / 2),
iSmileRect.iTl + TPoint(iSmileyWidth / 2, iSmileRect.Height() / 2));
}
}
示例10: DrawPoints
void CSpaceInvadersAppView::DrawPoints(CWindowGc& aGc) const
{
TRgb pencolor = TRgb(255,255,255);
aGc.SetPenColor(pencolor);
_LIT(KPointsText, "Points: ");
TBufC<15> pointsText;
TPtr pointsPtr = pointsText.Des();
pointsPtr.Append(KPointsText);
pointsPtr.AppendNum(iHolder->ActivePoints());
const CFont* menuFont =
AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont, NULL);
aGc.UseFont(menuFont);
TInt textLength = menuFont->TextWidthInPixels(pointsPtr);
TInt textHeight = menuFont->HeightInPixels();
TPoint textpoint(Rect().Width() / 2 - textLength / 2, textHeight);
aGc.DrawText(pointsPtr, textpoint);
}
示例11: DrawQuitCommand
void CSpaceInvadersAppView::DrawQuitCommand(CWindowGc& aGc) const
{
TRgb pencolor = TRgb(255,255,255);
aGc.SetPenColor(pencolor);
_LIT(KQuitText, "Quit");
TBufC<4> quitText;
TPtr quitPtr = quitText.Des();
quitPtr.Append(KQuitText);
const CFont* menuFont =
AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont, NULL);
aGc.UseFont(menuFont);
TInt textLength = menuFont->TextWidthInPixels(quitPtr);
TInt textHeight = menuFont->HeightInPixels();
TPoint textpoint(Rect().Width() - ( textLength + 10 ),
Rect().Height() - textHeight);
aGc.DrawText(quitPtr, textpoint);
}
示例12: DrawSchedule
void CCalendarManagerContainer::DrawSchedule(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Font_Color1, const CFont& p_Font) const
{
g_Pos_Y += g_Space_Y;
gc.SetPenColor(p_Default_Font_Color1);
TInt i_Count = GetScheduleCount();
if (i_Count == 0)
{
gc.DrawText(_L("\x6CA1\x6709\x65E5\x7A0B"), TRect(0, 0, aRect.Width(), g_Pos_Y), (g_Pos_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
}
else
{
TBuf<20> i_NUM;
i_NUM.Append(_L("\x6709"));
i_NUM.AppendNum(i_Count);
i_NUM.Append(_L("\x4E2A\x65E5\x7A0B"));
gc.DrawText(i_NUM, TRect(0, 0, aRect.Width(), g_Pos_Y), (g_Pos_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
}
//gc.DrawLine(TPoint(0, g_Pos_Y), TPoint(aRect.Width(), g_Pos_Y));
}
示例13: 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);
}
示例14: DrawDragState
/**
* Draws the thumb of the scrollbar. The thumb can be drawn in pressed colors if aIsDragged is true, or in normal
* colors otherwise. The scrollbar is horizontal if aHorizontal is true and vertical otherwise.
*/
EXPORT_C void LafScrollThumb::DrawDragState(const MLafEnv& aLafEnv,CWindowGc& aGc,const CCoeControl& aScrollThumb,TBool aIsDragged, const TRect& aRect, TBool aHorizontal)
{
TRgb bgColor;
if (aScrollThumb.IsDimmed())
{
bgColor=aLafEnv.ControlColor((aIsDragged? EColorScrollButtonThumbBackgroundPressed : EColorScrollThumbDimmed),aScrollThumb);
}
else
{
bgColor=aLafEnv.ControlColor((aIsDragged? EColorScrollButtonThumbBackgroundPressed : EColorScrollButtonThumbBackground),aScrollThumb);
}
aGc.SetBrushColor(bgColor);
aGc.Clear(aRect);
TRect gripRect=aRect;
TInt length=(aHorizontal)? gripRect.Size().iWidth : gripRect.Size().iHeight;
TInt gripStart=((length*(KLafScrollThumbGripProportion-1))/KLafScrollThumbGripProportion)/2;
TInt horizBorder=(aHorizontal)? gripStart : KLafScrollThumbGripMargin;
TInt vertBorder=(aHorizontal)? KLafScrollThumbGripMargin : gripStart;
gripRect.Shrink(horizBorder,vertBorder);
// TLafGrip::TOrientation gripOrientation=(aHorizontal)? TLafGrip::EVertical : TLafGrip::EHorizontal;
}
示例15: DrawImage
void CRhodesAppView::DrawImage(CWindowGc& aGc,
const TRect& aRect) const
{
TSize bmpSizeInPixels( iBitmap->SizeInPixels() );
TInt xDelta = (aRect.Width() - bmpSizeInPixels.iWidth) / 2;
TInt yDelta = (aRect.Height() - bmpSizeInPixels.iHeight) / 2;
TPoint pos( xDelta, yDelta ); // displacement vector
pos += aRect.iTl; // bitmap top left corner position
// Drawing viewfinder image to bitmap
iFbsBitGc->BitBlt( pos, iBitmap, TRect( TPoint( 0, 0 ), bmpSizeInPixels ));
// Draws bitmap with indicators on the screen
TSize size( iOffScreenBitmap->SizeInPixels() );
aGc.BitBlt( TPoint(0,0), iOffScreenBitmap, TRect( TPoint(0,0), size ) );
}