×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    2

    Window always at front and icon transparency problem

    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.
    Code:
    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();
    		}
    	}
    --- Drawing method
    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 );
    	}
    -- And here's a snippet, that shows how the .svg files are being converted (from icons.mk)
    Code:
    RESOURCE :
    	
    	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
    	 	/c16,8 ..\indicator_icon.svg
    Last edited by VilluNikolaiV; 2006-08-16 at 14:49.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    391

    Re: Window always at front and icon transparency problem

    hi,did you sovled this problem?I countered it too.

  3. #3
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: Window always at front and icon transparency problem

    AFAIK S60 does not support transparent windows.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    391

    Re: Window always at front and icon transparency problem

    Thanks yucca.

    1、Skin support?seems no use!
    2、Window().Invalidate() call(not DrawNow) in SetIndicatorIconL function does not canuse a redraw of background windows(not client area),why!?

  5. #5
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: Window always at front and icon transparency problem

    1. for what ?
    2. Can not remember the actual thing on this, but you could check the books that explain the drawing, they should explain how it is working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •