void CSpaceInvadersAppView::DrawAliens(CWindowGc& aGc) const { for ( TInt i = 0 ; i < iTotalAliens ; i++ ) { if ( iAlienArray[i] ) { TPoint shipPoint(iAlienArray[i]->X(), iAlienArray[i]->Y()); CFbsBitmap* iBitmapShip; if ( i < 6 ) { iBitmapShip = iBitmapAlien1; } else if ( i < 12 ) { iBitmapShip = iBitmapAlien2; } else { iBitmapShip = iBitmapAlien3; } aGc.BitBlt( shipPoint, iBitmapShip ); if ( iAlienArray[i]->HasFired() ) { TPoint shotPoint(iAlienArray[i]->Shot()->X(), iAlienArray[i]->Shot()->Y()); aGc.BitBlt( shotPoint, iBitmapShot ); } } } }
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 ); } }
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); } }
/** * 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); } }
//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(); } }
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); }
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 ) ); }
void CSurface::BlitTo(CWindowGc& aDest, TInt aX, TInt aY) { aDest.BitBlt(TPoint(aX,aY), iBitmap); return; }