📄 graphicstool.cpp
字号:
#include "GraphicsTool.h"
namespace gamespace
{
void CGraphicsTool::DrawImage( CBitmapContext& aGc, CFbsBitmap* aImage, CFbsBitmap* aImgMask,
TInt aX /*= 0*/, TInt aY /*= 0*/, TInt aSrcW /*= 0*/,
TInt aSrcH /*= 0*/, TInt aSrcX /*= 0*/, TInt aSrcY /*= 0*/)
{
TRect rect( TPoint( aSrcX, aSrcY), TSize( aSrcW, aSrcH ) );
if ( aImgMask )
aGc.BitBltMasked( TPoint( aX, aY ), aImage, rect, aImgMask, ETrue );
else
aGc.BitBlt( TPoint( aX, aY ), aImage );
}
void CGraphicsTool::DrawText( CBitmapContext &aGc,const CFont *aFont,const TDesC &aText,TRect aRect,
CGraphicsContext::TTextAlign aAlign , TInt aLeftMargin )
{
aGc.UseFont(aFont);
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
aGc.SetPenColor(KRgbWhite);
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
TInt baseline = aRect.Height() /2 + aFont->AscentInPixels()/2;
aGc.DrawText(aText,aRect,baseline,aAlign, aLeftMargin );
}
void CGraphicsTool::DrawRect( CBitmapContext& aGc, TRect aRect , TRgb aColor /*= KRgbWhite*/,
TBool aUseBrush /*= FALSE*/, TInt size /*= 1 */ )
{
if ( aUseBrush )
{
aGc.SetBrushColor( aColor );
aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
}
else
{
aGc.SetBrushColor( aColor );
aGc.SetPenStyle( CGraphicsContext::ESolidPen );
aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
}
aGc.DrawRect( aRect );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -