Example #1
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CMySplashScreen::Draw(const TRect& /*aRect*/) const
{
	CWindowGc& gc = SystemGc();
 
	if(iBgContext)
	{
	  	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
		AknsDrawUtils::Background( skin, iBgContext, this, gc, Rect() );
	}
 
    if(iBgPic && iBgMsk)
	{
		if(iBgPic->Handle() && iBgMsk->Handle())
		{
			TSize ImgSiz(iBgPic->SizeInPixels());
			TSize RectSiz();
			
			TInt Xpoint = ((Rect().Width() - ImgSiz.iWidth) / 2);
			TInt Ypoint = ((Rect().Height()- ImgSiz.iHeight)/ 2);
		
			TRect DestRect(Xpoint,Ypoint,(Xpoint + ImgSiz.iWidth),(Ypoint + ImgSiz.iHeight));
			TRect SrcRect(0,0,ImgSiz.iWidth,ImgSiz.iHeight);
			
			gc.DrawBitmapMasked(DestRect,iBgPic,SrcRect,iBgMsk, EFalse);
		}	
	}
	else if(iBgPic)
	{
		if(iBgPic->Handle())
		{
			gc.DrawBitmap(Rect(),iBgPic);
		}	
	}
}
Example #2
0
void CPicture_Ex::Render(CDC* pDC, LPRECT pDrawRect, LPRECT pSrcRect/*=NULL*/,LPCRECT prcWBounds/*=NULL*/)
{
    if (pDC == NULL || m_pPict == NULL) return ;
    
 CRect recrDest(pDrawRect);



    long Width  = 0;
    long Height = 0;
    m_pPict->get_Width(&Width);
    m_pPict->get_Height(&Height);



 CRect SrcRect(0,0,Width,Height);



 if(pSrcRect){
  SrcRect=*pSrcRect;
 }
 CRect DrawRect(pDrawRect);
    HRESULT hrP = NULL;



    hrP = m_pPict->Render(pDC->m_hDC,
                      DrawRect.left,                  // Left
                      DrawRect.top,                   // Top
                      DrawRect.Width(), // Right
                      DrawRect.Height(), // Bottom
                      SrcRect.left,
                      SrcRect.top,
                      SrcRect.Width(),
                      SrcRect.Height(),
                      prcWBounds);



    if (SUCCEEDED(hrP)) return;
 AfxThrowMemoryException();
    return;
}//-----------------------------------------------------------------------------