×
Namespaces

Variants
Actions

Efficient way of Loading Bitmap and Mask in S60

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: bharatuppal (06 Jul 2007)
Last edited: hamishwillee (30 May 2013)
_LIT(KYourMifFile, “resource\\apps\\yourmif.mif”);

//yourmif.mif contains svgs

include <yourmif.mbg>  in  .cpp file

// In header file

CFbsBitmap* iFocusBitmap;
CFbsBitmap* iBitmapMask;

// anywhere in .cpp file

if(iFocusBitmap == NULL)
{
// load the image and mask
AknIconUtils::CreateIconL( iFocusBitmap,
iBitmapMask,
KYourMifFile,
EMbmYourMif_focus,
EMbmYourMif_mask );
}
TSize size(Rect().Width()*10/100,Rect().Height()*10/100);
AknIconUtils::SetSize(iFocusBitmap,size,EAspectRatioNotPreserved);
AknIconUtils::SetSize(iBitmapMask,size,EAspectRatioNotPreserved );

// In the destructor

delete  iFocusBitmap;
delete iBitmapMask;


AknIconUtils::SetSize initializes the icon to the given size, if the parameter aBitmap is an instance of CAknBitmap, i.e.created with AknIconUtils methods. If it is not CAknBitmap, this method does nothing. Note that this call sets the sizes of both bitmap and mask (if it exists), regardless of which is given as the parameter. Note Without a call to SetSize Bitmap will not be drawn and seen on the screen

Although CreateIconL have overloaded method for creating only the single bitmap rather than its mask but this has been more efficient interms of size and loading

This page was last modified on 30 May 2013, at 07:37.
50 page views in the last 30 days.