×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    49

    Can I create an mbm file dynamically..i.e. in a container or in a view

    Hello all...
    I want to create a dynamic list box with thumbnails to show the images which I have in one particular folder....
    For that I am using CAknDoubleLargeStyleListBox class.
    Using bmp files,I want to list the images on this listbox.

    But it is taking the bmps in mbm format only.

    As of I know, we can generate mbm s from mmp file,but I cant add or remove anything at the runtime from that.

    Can anybody tell me how to generate an mbm file from a set of bmps in a container or on a view??

    Thanks in advance...

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    you can use image decoder to get other images to the bitmaps, see wiki for more help: http://wiki.forum.nokia.com/index.ph...Symbian_bitmap

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    49

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Hi symbianyucca...
    Thanks for ur quick reply....
    the thing I wanted is not t convert anothertype of images to bitmaps...
    I have the bitmap images(i.e.bmps),I want to convert them into mbm format sothat I use them...
    I can convert them in the .mmp file,but I want to convert them in a .cpp file...
    Can u help me out....

    I will be very Thankfull to u...

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Sorry about the misundersatnding, I though that you wanted to use other image types than mbm directly in the code, then my suggestion would have been correct, and you could have used the wiki example for loading those images to CFbsBitmap or CGulIcon objects in your program.

    Anyway, if you just want to convert bmp's to mbm's in your computer, then use bmconv for it.

    incase you really want to generate mbm files in your code, you need to first open then into CFbsBitmap, and then use the Save function to save them into mbm files, note that with this method you can only have one bitmap in each mbm file.

  5. #5
    Nokia Developer Champion
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    I have never tried, but you can check CFbsBitmap::StoreL() method to create MBM dynamically.

  6. #6
    Registered User
    Join Date
    Jan 2008
    Posts
    49

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Yeah...exactly...
    I have the struggle here only..I don't know how to open a bitmap in CFbsBitmap,

    Can you post a small piece of code,so that I can undrstand...

    I follwed the link http://wiki.forum.nokia.com/index.ph...on_of_MBM_file

    But it was a bit confusing.

    Moreover CFbsBitmap class has no method which takes an image from a file..

    Can you suggest me how to open a CFbsBitmap with an existed bitmap??

    Thanks in advance...

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Then return to the first reply, Jukka's. He did not misunderstand your question, just you have chosen a misleading title for the thread.

  8. #8
    Registered User
    Join Date
    Jan 2008
    Posts
    49

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Hi savaj..
    I have tried it with CFbsBitmap::StoreL();
    But I am not sure about the parameters to this function...

    please help me out...

    I have some bmps and I want to convert them into mbm format in a cpp file...
    If anybody can give me a peice of code...I will be very greatfull....

    Thanks in advance...

  9. #9
    Nokia Developer Champion
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    I have never used this method, but you might get some idea from this thread.
    http://discussion.forum.nokia.com/fo...ap%3A%3AStoreL

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Quote Originally Posted by chandrashekar@nexG View Post
    I have some bmps and I want to convert them into mbm format in a cpp file...
    It requires multiple steps:
    - load .bmp: CImageDecoder
    - save it to .mbm-s containing single bitmaps: CFbsBitmap::Save
    - combine the .mbm-s into one big .mbm file: CFbsBitmap::StoreL
    Where are you now?

  11. #11
    Registered User
    Join Date
    Feb 2009
    Posts
    17

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Hi savaj and wizard.....
    I really very thankfull to your responses..

    I have almost solved my problem..
    Now I am able to create mbm file with ur help...

    But in that mbm file bitmaps are filled with white space(I have seen it in the mbmviewer)...

    By debugging I came to know that the problem is in the decoding...

    what I am doing is I am taking a bmp or jpg image and decoding it,after that saving it as mbm and storing it using storeL() .

    Iam posting my code here...


    _LIT(KMbm,"c:\\data\\hr.mbm");

    RFs iFs;
    User::LeaveIfError(iFs.Connect());
    TBuf<30> aFileName(_L("c:\\data\\hr.bmp"));


    CImageDecoder* iImageDecoder = CImageDecoder::FileNewL( iFs, aFileName );


    // create the destination bitmap
    CFbsBitmap* iBitmap = new (ELeave) CFbsBitmap();
    iBitmap->Create( iImageDecoder->FrameInfo().iOverallSizeInPixels,
    iImageDecoder->FrameInfo().iFrameDisplayMode );


    TRequestStatus iStatus;
    iImageDecoder->Convert( &iStatus, *iBitmap );


    _LIT(KMBM,"c:\\data\\hr_ju.mbm");


    iBitmap->Save(KMBM);


    TInt32* uniqueIds = new ( ELeave ) TInt32[ 1 ];
    CleanupStack::PushL( uniqueIds );
    uniqueIds[ 0 ] = 0;
    // uniqueIds[ 1 ] = 0;
    TFileName** filenames = new ( ELeave ) TFileName*[ 1 ];
    CleanupStack::PushL( filenames );
    filenames[ 0 ] = new (ELeave) TFileName( KMBM );
    // filenames[ 1 ] = new (ELeave) TFileName( KMBMM );
    CFbsBitmap::StoreL(KMbm, // Filename for new multi-bitmap mbm
    1, // Count of files
    ( const TDesC** )filenames, // bitmaps to be loaded
    uniqueIds ); // id's of the bitmaps in MBM files


    I used Same code except the decoding...

    My only problem is to take a bmp image into a bitmap,
    Am I doing it in the correct way??

    otherwise I have done mistake somewhere else??

    Thanking you people once again for ur kind response and expecting a reply from you...

  12. #12
    Registered User
    Join Date
    Jan 2008
    Posts
    49

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Hi savaj and wizard.....
    I really very thankfull to your responses..

    I have almost solved my problem..
    Now I am able to create mbm file with ur help...

    But in that mbm file bitmaps are filled with white space(I have seen it in the mbmviewer)...

    By debugging I came to know that the problem is in the decoding...

    what I am doing is I am taking a bmp or jpg image and decoding it,after that saving it as mbm and storing it using storeL() .

    Iam posting my code here...


    _LIT(KMbm,"c:\\data\\hr.mbm");

    RFs iFs;
    User::LeaveIfError(iFs.Connect());
    TBuf<30> aFileName(_L("c:\\data\\hr.bmp"));


    CImageDecoder* iImageDecoder = CImageDecoder::FileNewL( iFs, aFileName );


    // create the destination bitmap
    CFbsBitmap* iBitmap = new (ELeave) CFbsBitmap();
    iBitmap->Create( iImageDecoder->FrameInfo().iOverallSizeInPixels,
    iImageDecoder->FrameInfo().iFrameDisplayMode );


    TRequestStatus iStatus;
    iImageDecoder->Convert( &iStatus, *iBitmap );


    _LIT(KMBM,"c:\\data\\hr_ju.mbm");


    iBitmap->Save(KMBM);


    TInt32* uniqueIds = new ( ELeave ) TInt32[ 1 ];
    CleanupStack::PushL( uniqueIds );
    uniqueIds[ 0 ] = 0;
    // uniqueIds[ 1 ] = 0;
    TFileName** filenames = new ( ELeave ) TFileName*[ 1 ];
    CleanupStack::PushL( filenames );
    filenames[ 0 ] = new (ELeave) TFileName( KMBM );
    // filenames[ 1 ] = new (ELeave) TFileName( KMBMM );
    CFbsBitmap::StoreL(KMbm, // Filename for new multi-bitmap mbm
    1, // Count of files
    ( const TDesC** )filenames, // bitmaps to be loaded
    uniqueIds ); // id's of the bitmaps in MBM files


    I used Same code except the decoding...

    My only problem is to take a bmp image into a bitmap,
    Am I doing it in the correct way??

    otherwise I have done mistake somewhere else??

    Thanking you people once again for ur kind response and expecting a reply from you...

  13. #13
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Where TRequestStatus occurs, there is always an asynchronous request in the background. You can not proceed with working on the result until its status shows you that it is actually ready.
    Usually you should introduce active objects, because many asynchronous services are trying to work in your own thread.
    However in this particular case you can get CImageDecoder to work in a separate thread via specifying EOptionAlwaysThread (in the XyNewL). Then you can wait using User::WaitForRequest.

  14. #14
    Registered User
    Join Date
    Feb 2009
    Posts
    17

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Thankyou so much Wizard...
    I have solved the problem...
    I made CImageDecoder to work in a separate thread via specifying EOptionAlwaysThread...
    Its working now...
    Thanks a lot...
    I will never forget ur help....

  15. #15
    Registered User
    Join Date
    Aug 2007
    Posts
    9

    Re: Can I create an mbm file dynamically..i.e. in a container or in a view

    Try use this....

    _LIT(KMbmFile,"C:\\result.mbm");

    _LIT(KBMPFilePath0,"C:\\facebook.mbm");
    _LIT(KBMPFilePath1,"C:\\balance.mbm");

    TInt32* uniqueIds = new ( ELeave ) TInt32[ 2 ];
    CleanupStack::PushL( uniqueIds );
    uniqueIds[ 0 ] = 0;
    uniqueIds[ 1 ] = 0;

    TFileName** filenames = new ( ELeave ) TFileName*[ 2 ];
    CleanupStack::PushL( filenames );
    filenames[ 0 ] = new (ELeave) TFileName( KBMPFilePath0 );
    filenames[ 1 ] = new (ELeave) TFileName( KBMPFilePath1 );

    CFbsBitmap::StoreL( KMbmFile, // Filename for new multi-bitmap mbm
    2, // Count of files
    ( const TDesC** )filenames, // bitmaps to be loaded
    uniqueIds ); // id's of the bitmaps in MBM files

    // Clean resources
    delete filenames[ 0 ];
    delete filenames[ 1 ];

    CleanupStack::PopAndDestroy( filenames );
    CleanupStack::PopAndDestroy( uniqueIds );

Similar Threads

  1. How to create .aif file...??
    By s4sandy_bit in forum Symbian
    Replies: 2
    Last Post: 2008-11-18, 10:27
  2. Unable to create file
    By Ajmal in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2008-06-05, 04:39
  3. Replies: 1
    Last Post: 2005-05-26, 14:22
  4. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

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