Hello!
I have a problem when I'm trying to do a popup window, that shows on top
of every application in a certain point of the screen (i.e. on top of every
application, no matter if user switches it). This works just fine, but the
real problem is when I'm trying to draw an icon with a mask to the window
and I can't get it to be transparent, no matter how hard I try.
I personally suspect, that it might have something to do with that new window
creation, that it creates a window that is not transparent or something, since
the icons created from the same .svg work perfectly fine with transparencies in
all other places in of the software (the same icon is being used as an application
icon, and in one information note etc. and the transparency works just fine)
.I have also tried to create same kind of icon from bitmaps, but the effect is
just the same, white background for the icon without any transparency.
The masks are correct in both of the cases (with icons created from .svg's or from .bmp's.)
Does anyone have a clue, what might be wrong in the following code?
- Ville
Here's some code snippets, which I use to show the popup icon:
(the class has been derived from CCoeControl, and the AppUi creates it with NewL and
by calling the SetIndicatorIcon() )
--- Code for constructing the control:
Code:void CIndicatorIcon::ConstructL() { // These are for showing the icon on top of every other applications! iMyWindowGroup = RWindowGroup(iCoeEnv->WsSession()); User::LeaveIfError(iMyWindowGroup.Construct((TUint32)&iMyWindowGroup)); iMyWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); iMyWindowGroup.EnableReceiptOfFocus(EFalse); CreateWindowL(&iMyWindowGroup); /* // Same thing with bitmaps, it just won't become transparent :( TFileName path; _LIT(mbmName, "\\resource\\apps\\Indicator_Logo.mbm"); path.Append(mbmName); iIndicator = CEikonEnv::Static()->CreateBitmapL(path, 0); iIndicatorMask = CEikonEnv::Static()->CreateBitmapL(path, 1); */ // Load icons from mif-file _LIT(KMyMifFileName,"\\resource\\apps\\Indicator.mif"); //_LIT(KMyMifFileName,"z:\\resource\\apps\\Indicator_aif.mif"); TFileName mifFile(KMyMifFileName); // Icon with makefile created mask AknIconUtils::CreateIconL(iIndicator, iIndicatorMask, mifFile, EMbmParkwifiParkwifi_application_icon, EMbmParkwifiParkwifi_application_icon_mask); AknIconUtils::SetSize(iIndicator, TSize(20, 20), EAspectRatioPreserved); AknIconUtils::SetSize(iIndicatorMask, TSize(20, 20), EAspectRatioPreserved); /* // Make the window transparent // TODO None of these won't work!! Window().SetTransparencyAlphaChannel(); Window().SetBackgroundColor( TRgb( 0x11111111,0 ) ); Window().SetTransparencyBitmap( *iIndicatorMask ); */ ActivateL(); }
--- This method is called, when the icon should be drawed on to the screen.
--- Drawing methodCode:void CIndicatorIcon::SetIndicatorIconL( const TRect& aRect, TBool aRedraw) { TInt PosX = KIndicatorPosX; TInt PosY = KIndicatorPosY; SetRect(TRect(TPoint(PosX, PosY),iIndicator->SizeInPixels())); // if aRedraw == ETrue just draw the canvas again. if(aRedraw) { DrawNow(); } }
-- And here's a snippet, that shows how the .svg files are being converted (from icons.mk)Code:void CIndicatorIcon::Draw(const TRect& aRect) const { CWindowGc& gc = SystemGc(); gc.SetBrushStyle(CGraphicsContext::ENullBrush); gc.SetPenStyle( CGraphicsContext::ENullPen ); //gc.Clear(); // ODDITY: Changing the invert mask parameter does not seem to // affect anyway!! gc.BitBltMasked(TPoint(aRect.iTl.iX, aRect.iTl.iY), iIndicator, TRect(TPoint(0, 0), iIndicator->SizeInPixels()), iIndicatorMask, EFalse); //ETrue); // TEST: The mask seems to be just how it should be.. //gc.BitBlt(TPoint(aRect.iTl.iX, aRect.iTl.iY), iIndicatorMask ); }
Code:RESOURCE : mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ /c16,8 ..\indicator_icon.svg



