diff -r e30d4a1b8bad -r c26cc2a7c548 phoneuis/BubbleManager/Src/BMUtils.cpp --- a/phoneuis/BubbleManager/Src/BMUtils.cpp Wed Sep 15 12:12:21 2010 +0300 +++ b/phoneuis/BubbleManager/Src/BMUtils.cpp Wed Oct 13 14:31:22 2010 +0300 @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include @@ -1465,6 +1465,72 @@ } // --------------------------------------------------------------------------- +// BubbleUtils::AddTransparencyToBubbleImageL +// --------------------------------------------------------------------------- +// +void BubbleUtils::AddTransparencyToBubbleImageL( + const TAknsItemID& aFrameID, + const TRect& aOuterRect, + const TRect& aInnerRect, + CEikImage*& aBubble ) + { + + const CFbsBitmap* currentMask = aBubble->Mask(); + TSize maskSize( currentMask->SizeInPixels() ); + TRect rect( maskSize ); + + // create transparency frame + CFbsBitmap* transparency = new(ELeave) CFbsBitmap; + CleanupStack::PushL( transparency ); + User::LeaveIfError( transparency->Create( aOuterRect.Size(), + EGray256 ) ); + CFbsBitmapDevice* transparencyDev = CFbsBitmapDevice::NewL( transparency ); + CleanupStack::PushL( transparencyDev ); + CFbsBitGc* transparencyCtx; + User::LeaveIfError( transparencyDev->CreateContext( transparencyCtx ) ); + CleanupStack::PushL( transparencyCtx ); + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + AknsDrawUtils::DrawFrame( skin, + *transparencyCtx, + aOuterRect, + aInnerRect, + aFrameID, + KAknsIIDDefault, + KAknsDrawParamDefault ); + + CleanupStack::PopAndDestroy( 2, transparencyDev ); + + // create solid black mask + CFbsBitmap* solidBlack = new(ELeave) CFbsBitmap; + CleanupStack::PushL( solidBlack ); + User::LeaveIfError( solidBlack->Create( maskSize, EGray256 ) ); + CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL( solidBlack ); + CleanupStack::PushL( dev ); + CFbsBitGc* gc; + User::LeaveIfError( dev->CreateContext( gc ) ); + CleanupStack::PushL( gc ); + + gc->SetBrushColor( KRgbBlack ); + gc->SetBrushStyle( CGraphicsContext::ESolidBrush ); + gc->DrawRect( rect ); + + // blit original mask on the black mask using transparency mask + gc->BitBltMasked( TPoint(0,0), + currentMask, + TRect( currentMask->SizeInPixels() ), + transparency, + ETrue ); + + CleanupStack::PopAndDestroy( 2, dev); + + CleanupStack::Pop(solidBlack); + aBubble->SetMask( solidBlack ); + + CleanupStack::PopAndDestroy( transparency ); + delete currentMask; + } + +// --------------------------------------------------------------------------- // BubbleUtils::PrepareCallObjectToBubbleImageL // --------------------------------------------------------------------------- //