Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Efficient way of Loading Bitmap and Mask in S60

From 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 04:37.
31 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×