// ----------------------------------------------------------------------------- // Blit // // Blits given image to gc. // // ----------------------------------------------------------------------------- // inline static TBool Blit( MAknsSkinInstance* aSkin, CBitmapContext& aGc, const TRect& aTrgRect, CAknsImageItemData* aImgData, const TAknsItemID& aIID, const TAknsBackground* aLayout, const TPoint& aPADelta, const TInt aDrawParam ) { CAknsAppSkinInstance* appInstance = static_cast<CAknsAppSkinInstance*>(aSkin); if ( IsBackgroundItem( aIID,appInstance ) && appInstance && appInstance->AnimBackgroundState() ) { if( (aDrawParam&KAknsDrawParamPrepareOnly) ) { return ETrue; } TRgb color = KRgbWhite; color.SetAlpha(0x00); aGc.SetPenColor(color); aGc.SetBrushColor(color); aGc.SetPenStyle(CGraphicsContext::ESolidPen); aGc.SetBrushStyle(CGraphicsContext::ESolidBrush); aGc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); TRect layoutRect( aTrgRect ); if( aLayout ) { layoutRect = aLayout->iRect; } layoutRect.Move( -aPADelta ); TRect drawRect = aTrgRect; drawRect.Intersection( layoutRect ); aGc.Clear(drawRect); return ETrue; } TRect layoutRect( aTrgRect ); const TAknsImageAttributeData* attr = NULL; if( aLayout ) { layoutRect = aLayout->iRect; if( aLayout->iAttr.iAttributes != EAknsImageAttributeNone ) { attr = &(aLayout->iAttr); } } layoutRect.Move( -aPADelta ); TRect drawRect(aTrgRect); drawRect.Intersection( layoutRect ); return DrawPartialCachedImage( aSkin, aGc, layoutRect, drawRect, aImgData, aIID, attr, aDrawParam ); }
void CBitmapAnimator::RenderMask(CBitmapContext& aBitmapContext, TInt aFrame) const { aBitmapContext.Reset(); const CAnimationFrame& nextFrame = *iFrameArray[aFrame]; if (aFrame == 0) { aBitmapContext.SetBrushColor(KRgbBlack); aBitmapContext.Clear(iMaxSize); } else { const CAnimationFrame& currentFrame = *iFrameArray[aFrame - 1]; if (currentFrame.FrameInfo().iFlags & TFrameInfo::ERestoreToBackground) { aBitmapContext.SetBrushColor(KRgbBlack); aBitmapContext.Clear(currentFrame.FrameInfo().iFrameCoordsInPixels); } } const TBool useMask = nextFrame.FrameInfo().iFlags&TFrameInfo::ETransparencyPossible || nextFrame.FrameInfo().iFlags&TFrameInfo::EAlphaChannel; if (useMask) { aBitmapContext.SetDrawMode(CGraphicsContext::EDrawModeOR); aBitmapContext.BitBlt(nextFrame.FrameInfo().iFrameCoordsInPixels.iTl, nextFrame.Mask(), nextFrame.FrameInfo().iOverallSizeInPixels); } else { aBitmapContext.SetBrushColor(KRgbWhite); if (nextFrame.FrameInfo().iOverallSizeInPixels != nextFrame.FrameInfo().iFrameSizeInPixels) { // If the frame size smaller than the overall size, the mask shall not take effect later in CBasicAnimation::Draw(). aBitmapContext.Clear(nextFrame.FrameInfo().iOverallSizeInPixels); } else { aBitmapContext.Clear(nextFrame.FrameInfo().iFrameCoordsInPixels); } } }