当前位置: 首页>>代码示例>>C++>>正文


C++ CWindowGc::DrawBitmapMasked方法代码示例

本文整理汇总了C++中CWindowGc::DrawBitmapMasked方法的典型用法代码示例。如果您正苦于以下问题:C++ CWindowGc::DrawBitmapMasked方法的具体用法?C++ CWindowGc::DrawBitmapMasked怎么用?C++ CWindowGc::DrawBitmapMasked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CWindowGc的用法示例。


在下文中一共展示了CWindowGc::DrawBitmapMasked方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawImages

/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CMySplashScreen::DrawImages(CWindowGc& aGc,const TRect& aRect,CGulIcon* aIcon) const
{
	if(aIcon)
	{
		if(aIcon->Bitmap() && aIcon->Mask())
		{
			if(aIcon->Bitmap()->Handle() && aIcon->Mask()->Handle())
			{
				TSize ImgSiz(aIcon->Bitmap()->SizeInPixels());
				
				TInt LFtMargin = aRect.iTl.iX + ((aRect.Width() - ImgSiz.iWidth) / 2);
				TInt RghMargin = aRect.iTl.iY + ((aRect.Height() - ImgSiz.iHeight) / 2);
				
				TRect DrwRect(LFtMargin,RghMargin,(ImgSiz.iWidth + LFtMargin),(ImgSiz.iHeight + RghMargin));
				
				aGc.DrawBitmapMasked(DrwRect,aIcon->Bitmap(),TRect(0,0,ImgSiz.iWidth,ImgSiz.iHeight),aIcon->Mask(),EFalse);
			}
		}
	}
}
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:24,代码来源:Splash_Screen.cpp

示例2: DrawMemory

/*
-----------------------------------------------------------------------

-----------------------------------------------------------------------
*/
void CTraceContainer::DrawMemory(const TRect& aRect, CWindowGc& gc) const
{
	if(iMaskImg)
	{
		if(iMaskImg->Bitmap() && iMaskImg->Mask())
		{
			if(iMaskImg->Bitmap()->Handle() && iMaskImg->Mask()->Handle())
			{
				TSize ButtonSiz(iMaskImg->Bitmap()->SizeInPixels());
				gc.DrawBitmapMasked(aRect,iMaskImg->Bitmap(),TRect(0,0,ButtonSiz.iWidth,ButtonSiz.iHeight),iMaskImg->Mask(),EFalse);
			}
		}
	}
	
	gc.SetPenColor(KRgbBlack);
	
	gc.DrawLine(aRect.iTl,TPoint(aRect.iTl.iX,aRect.iBr.iY));
	gc.DrawLine(aRect.iTl,TPoint(aRect.iBr.iX,aRect.iTl.iY));
	gc.DrawLine(aRect.iBr,TPoint(aRect.iTl.iX,aRect.iBr.iY));
	gc.DrawLine(aRect.iBr,TPoint(aRect.iBr.iX,aRect.iTl.iY)); 
	
	gc.SetPenColor(KRgbRed);
	
	TInt Prosentages(0);
	
	TBuf<100> FreeBuffer(_L("Free: "));
	TBuf<100> TotalBuffer(_L("Total: "));
	if(iArray.Count())
	{
		if(iArray[iArray.Count() - 1])
		{
			FreeBuffer.AppendNum(iArray[iArray.Count() - 1]->iMemory,EDecimal);
			TotalBuffer.AppendNum(iTotalRamInBytes,EDecimal);
			
			Prosentages = ((iArray[iArray.Count() - 1]->iMemory * 100) / iTotalRamInBytes);
		}
	}
	
	TInt SizPie = (aRect.Height() / 3);
	PieDrawer(gc,aRect.iTl,SizPie,Prosentages,EFalse);
	
	const CFont* MuFonr = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);

	TInt TextHeight= MuFonr->HeightInPixels();
	TInt StartX = (aRect.iTl.iX + SizPie);
	TInt StartY = (aRect.iTl.iY + 2);

	gc.SetPenColor(KRgbBlack);
	gc.UseFont(MuFonr);
	
	gc.DrawText(FreeBuffer,TRect(StartX,StartY,aRect.iBr.iX,StartY + TextHeight),MuFonr->AscentInPixels(), CGraphicsContext::ELeft, 0);			
	gc.DrawText(TotalBuffer,TRect(StartX,(StartY + TextHeight),aRect.iBr.iX,(StartY + (TextHeight * 2))),MuFonr->AscentInPixels(), CGraphicsContext::ELeft, 0);			

	gc.SetPenColor(KRgbRed);
	
	StartX = 0;
	
	if(iArray.Count() > aRect.Width())
	{
		StartX = (iArray.Count() - aRect.Width());
	}

	TPoint MePoint1(aRect.iTl.iX,aRect.iBr.iY);
	TPoint MePoint2(aRect.iTl);
	
	TInt Valll(0);
	
	for(TInt i = StartX; i < iArray.Count(); i++)
	{
		if(iArray[i] && iTotalRamInBytes > 0)
		{
			Valll = ((aRect.Height() * iArray[i]->iMemory) / iTotalRamInBytes);
		}
	
		MePoint2.iY = (aRect.iBr.iY - Valll);
		
		if(StartX != 1)
		{
			gc.DrawLine(MePoint1,MePoint2);
		}
		
		MePoint1 = MePoint2;
		MePoint2.iX = MePoint2.iX + 1;	
	}
}
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:90,代码来源:MainContainer.cpp

示例3: DrawCPU

/*
-----------------------------------------------------------------------

-----------------------------------------------------------------------
*/
void CTraceContainer::DrawCPU(const TRect& aRect, CWindowGc& gc) const
{
	if(iMaskImg)
	{
		if(iMaskImg->Bitmap() && iMaskImg->Mask())
		{
			if(iMaskImg->Bitmap()->Handle() && iMaskImg->Mask()->Handle())
			{
				TSize ButtonSiz(iMaskImg->Bitmap()->SizeInPixels());
				gc.DrawBitmapMasked(aRect,iMaskImg->Bitmap(),TRect(0,0,ButtonSiz.iWidth,ButtonSiz.iHeight),iMaskImg->Mask(),EFalse);
			}
		}
	}
	
	gc.SetPenColor(KRgbBlack);
	gc.DrawLine(aRect.iTl,TPoint(aRect.iTl.iX,aRect.iBr.iY));
	gc.DrawLine(aRect.iTl,TPoint(aRect.iBr.iX,aRect.iTl.iY));
	gc.DrawLine(aRect.iBr,TPoint(aRect.iTl.iX,aRect.iBr.iY));
	gc.DrawLine(aRect.iBr,TPoint(aRect.iBr.iX,aRect.iTl.iY)); 

	TInt Prosentages(0);

	if(iArray.Count() && iMaxCpuCount)
	{
		if(iArray[iArray.Count() - 1])
		{
			Prosentages = ((iArray[iArray.Count() - 1]->iCpuLoad * 100) / iMaxCpuCount);
			Prosentages = (100 - Prosentages);
		}
	}
	
	TInt SizPie = (aRect.Height() / 3);
	//TPoint(aRect.iTl.iX, (aRect.iBr.iY - SizPie))
	PieDrawer(gc,aRect.iTl,SizPie,Prosentages,ETrue);
	
	gc.SetPenColor(KRgbRed);
	
	TInt StartX(0);
	
	if(iArray.Count() > aRect.Width())
	{
		StartX = (iArray.Count() - aRect.Width());
	}

	TPoint MePoint1(aRect.iTl.iX,aRect.iBr.iY);
	TPoint MePoint2(aRect.iTl);
	
	TInt Valll(0);
	
	if(iMaxCpuCount > 0)
	{
		for(TInt i = StartX; i < iArray.Count(); i++)
		{
			if(iArray[i])
			{
				TUint32 Curr = (iMaxCpuCount - iArray[i]->iCpuLoad);
				if(Curr < 0)
				{
					Curr = 0;
				}
				else if(iMaxCpuCount < Curr)
				{
					Curr = iMaxCpuCount;
				}
				
				Valll = ((aRect.Height() * Curr) / iMaxCpuCount);
			}
		
			MePoint2.iY = (aRect.iBr.iY - Valll);
			
			if(StartX != 1)
			{
				gc.DrawLine(MePoint1,MePoint2);
			}
		
			MePoint1 = MePoint2;
			MePoint2.iX = MePoint2.iX + 1;	
		}
	}
}
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:85,代码来源:MainContainer.cpp


注:本文中的CWindowGc::DrawBitmapMasked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。