/** Completes a pass of this render stage. */ void CTestRenderStage::End() { CFbsBitGc* gc = iBackBuffer->GetBitGcCurrent(); gc->SetPenSize(TSize(2,2)); gc->SetPenColor(KRgbRed); gc->DrawLine(TPoint(50,0),TPoint(0,50)); gc->SetPenColor(KRgbGreen); gc->DrawLine(TPoint(60,0),TPoint(0,60)); if (Next()) { gc = Next()->Begin(); const TRegion* region = iScreenRedraw->AnimationRegion(); if(region && !region->IsEmpty() && !region->CheckError()) { if (iBackBuffer->Observer()) iBackBuffer->Observer()->BeforeUpdate(*iBackBuffer,*region); gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc->SetClippingRegion(region); gc->BitBlt(-iScreenConfig->ScaledOrigin(),iBackBuffer->GetBitmap()); gc->SetDrawMode(CGraphicsContext::EDrawModePEN); gc->CancelClipping(); if (iBackBuffer->Observer()) iBackBuffer->Observer()->AfterUpdate(*iBackBuffer,*region); } Next()->End(); } }
void CTSpriteAnim::DrawL(TInt aOpcode) { CFbsBitmap *bitmap=iSpriteFunctions->GetSpriteMember(0)->iBitmap; CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap); CleanupStack::PushL(device); CFbsBitGc *gc; User::LeaveIfError(device->CreateContext(gc)); CleanupStack::PushL(gc); gc->SetBrushStyle(CGraphicsContext::ESolidBrush); gc->SetPenSize(TSize()); TSize bitmapSize=bitmap->SizeInPixels(); TSize size= bitmapSize; size.SetSize(size.iWidth/2,size.iHeight/2); TPoint point=size.AsPoint(); // according to the opcode used, a quarter of the sprite bitmap is drawn to a different colour switch(aOpcode) { case EADllDraw1: { gc->SetBrushColor(TRgb(255,0,0)); gc->DrawRect(TRect(TPoint(),size)); break; } case EADllDraw2: { gc->SetBrushColor(TRgb(0,255,0)); gc->DrawRect(TRect(TPoint(point.iX,0),size)); break; } case EADllDraw3: { gc->SetBrushColor(TRgb(0,0,255)); gc->DrawRect(TRect(TPoint(0,point.iY),size)); break; } case EADllDrawBlank: {//the whole sprite bitmap is set to blank gc->SetBrushColor(TRgb(255,255,255)); gc->DrawRect(TRect(TPoint(),bitmapSize)); break; } default:; } iSpriteFunctions->UpdateMember(0,TRect(bitmap->SizeInPixels()),ETrue); CleanupStack::PopAndDestroy(2); //gc and device }