×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    1

    Icon with mask not displayed

    Hello,

    I have a "masking" problem with a icon in Symbian C++. I am developping a CUSTOM LIST, and I try to draw a icon(SVG) in my DrawActualItem into my new ItemDrawer...

    I load a ICON (svg), with a bitmap and a bitmapmask to a MIF file, with AknIconUtils::CreateIconL(...),

    If I draw the icon, with "iGc->BitBlt(punto,ibitmap);", using only the bitmap, the icon appear correctly, but it isn't transparent.

    If I draw the icon using the mask too, with "iGc->BitBltMasked(punto, ibitmap, aActualItemRect, ibitmapmask, EFalse);", the icon NOT APPEAR...

    I try DrawBitmap and DrawBitmapMasked, and nothing appear...

    I hope someone can help me, it make me crazy....

    My code:
    Code:
    void CCustomTextListBoxDrawer::DrawActualItem(TInt aItemIndex, const TRect& aActualItemRect,
    	         TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool aViewIsDimmed,
    			 TBool aItemIsSelected) const
    	 {
    	 
    	 _LIT( KAgendaEnriquecida_aifFile, "\\resource\\apps\\AgendaEnriquecida_aif.mif" );
    	 
    	 
    	 // Sets all the attributes, like font, text color
    	// and background color.
    	const CFont* font = CEikonEnv::Static()->NormalFont();
    	iGc->UseFont(font);
    	iGc->SetPenColor(iTextColor);
    	iGc->SetPenStyle(CGraphicsContext::ESolidPen);
    	iGc->SetBrushColor(iBackColor);
    	iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
    	TSize textTam = TSize(0.5,0.5);
    	iGc->SetPenSize(textTam);
    
    		CListItem* item=iListBox->elementAtL(aItemIndex);
    		if(item)
    			{
    			TRect aActualItemRect1(aActualItemRect);
    			TPoint* point =new TPoint(75,25);
    			TPoint* point2=new TPoint(0,80);
    			TDesC* text=item->SecondaryText;
    			TDesC* text2 = item->NameText;
    			CFbsBitmap* ibitmap=NULL;
    			CFbsBitmap* ibitmapmask=NULL;
    			CGulIcon* icon = myIconArray->At(4);
    		
    			AknIconUtils::CreateIconL(ibitmap, ibitmapmask, KAgendaEnriquecida_aifFile, EMbmAgendaenriquecida_aifQgn_indi_unavailable_mobile, EMbmAgendaenriquecida_aifQgn_indi_unavailable_mobile_mask);
    			TBool prueba = AknIconUtils::IsMifIcon(ibitmap);
    			const TInt KMyIconMaxWidth(55);
    			const TInt KMyIconMaxHeight(55);
    		    AknIconUtils::SetSize(ibitmap, TSize(KMyIconMaxWidth, KMyIconMaxHeight));
    		    AknIconUtils::SetSize(ibitmapmask, TSize(KMyIconMaxWidth, KMyIconMaxHeight));
    		    TPoint punto = TPoint(5,5);
    		    
    		    iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
    		    // Draw the bitmap
    		    iGc->BitBltMasked(punto, ibitmap, aActualItemRect, ibitmapmask, EFalse);
    			//iGc->BitBlt(punto,ibitmap);
    		    //iGc->DrawRect(aActualItemRect);
    //			iGc->DrawBitmap(punto,ibitmap);
    
    		    //iGc->DrawBitmapMasked(aActualItemRect, ibitmap, ibitmap->SizeInPixels(), ibitmapmask, EFalse);
    		    //iGc->BitBltMasked(aActualItemRect.iTl, ibitmap, aActualItemRect, ibitmapmask, EFalse);
    
    			iGc->DrawText(*text2,*point);
    			//iGc->DrawLine(*point,*point2);
    			//iGc->DrawText(*text, aActualItemRect,0,ELeft,0);
    			
    			}
    	//	}
    	
    	 }

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,671

    Re: Icon with mask not displayed

    Try with ETrue.
    Otherwise there is a comfortable thing about icons+masks created with the icon-mask variant of AknIconUtils::CreateIconL: they get linked together, so it is enough to SetSize (say) the icon, and the mask will get resized too.
    About DrawBitmap(point,bitmap): DrawBitmap can operate on any graphical device, even on those which do not support the concept of pixels (that is the main difference between the generic CGraphicsContext, and the more specific CBitmapContext). Thus DrawBitmap(point,bitmap) does not rely on CFbsBitmap::SizeInPixels, it uses the physical size of the bitmap instead, CFbsBitmap::SizeInTwips - which is 0 by default.
    Of course it does not apply to DrawBitmap(rectangle,bitmap), since in this case the size of the target rectangle is specified in an explicit way.

Similar Threads

  1. Grid app is crashing... need urgent help...
    By shankha in forum Symbian
    Replies: 5
    Last Post: 2010-10-19, 12:07
  2. svg icon is not displayed properly
    By strike_noir in forum Symbian User Interface
    Replies: 3
    Last Post: 2009-02-18, 07:36
  3. Application icon not displayed until reboot
    By henranto in forum Symbian
    Replies: 7
    Last Post: 2008-07-01, 16:19
  4. Replies: 7
    Last Post: 2007-09-05, 10:38
  5. App icon not displayed on 3250
    By truf in forum Symbian User Interface
    Replies: 2
    Last Post: 2007-07-20, 23:36

Posting Permissions

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