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. Thanks for all your past and future contributions.

Reading MBM MIF images

From Wiki
Jump to: navigation, search
Article Metadata
Created: symbianyucca (20 Mar 2007)
Last edited: hamishwillee (11 Jan 2012)

Class CMBM_MIF_Reader illustrates how to load MBM and MIF images in S60 3rd Edition devices.

Note that IsMifFile-function used to determine if the file if MBM or MIF uses only the file extension to determine the file type, not the actual file content, thus MIF files should always have .mif extension and mbm files .mbm extension.

The ValidateLogicalAppIconId-function is used to map the zero-based index numbers to the actual index numbers used with the mif file, thus you can use zero-based index similarly as with the mbm files.

Also note that some native S60 controls will resize icons automatically, and when the icons are used with these types of controls the aSize argument should indicate size equal to TSize(0,0), which would then allow these controls to do their own resizing.

Link against: aknicon.lib


#include <aknsutils.h> 
#include "MBM_MIF_Reader.h"
delete iFrameImg;
delete iFrameMsk;
void CMBM_MIF_Reader::LoadImageL(const TDesC& aFileName, TInt aImg, TInt aMsk,const TSize& aSize)
delete iFrameImg, iFrameImg = NULL;
delete iFrameMsk, iFrameMsk = NULL;
// we should validate icon ID in case of MIF-file
TInt MaskId(aMsk);
TInt UseIndex(aImg);
AknIconUtils::ValidateLogicalAppIconId(aFileName, UseIndex, MaskId);
AknIconUtils::CreateIconL(iFrameImg, iFrameMsk, aFileName, UseIndex, MaskId);
CFbsBitmap* CMBM_MIF_Reader::Bitmap()
return iFrameImg;
CFbsBitmap* CMBM_MIF_Reader::Mask()
return iFrameMsk;


#include <e32base.h>
// forward declaration
class CFbsBitmap;
class CMBM_MIF_Reader : public CBase
void LoadImageL(const TDesC& aFileName, TInt aImg, TInt aMsk,const TSize& aSize);
// accessors
CFbsBitmap* Bitmap();
CFbsBitmap* Mask();
CFbsBitmap* iFrameMsk;
CFbsBitmap* iFrameImg;
This page was last modified on 11 January 2012, at 06:37.
29 page views in the last 30 days.