×

Discussion Board

Results 1 to 9 of 9

Thread: bitmaps

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    40

    bitmaps

    Hello to all!! Well I am trying to display a bitmap from a file I created before with bitmapconverter tool. I went to the help and I think that the piece of code which load the bitmap is the next:

    // Load the mask bitmap, just like any other
    CFbsBitmap* maskBitmap = new (ELeave) CFbsBitmap();
    CleanupStack::PushL(maskBitmap);
    User::LeaveIfError(maskBitmap->
    Load(multiBitmapFile,EMbmGrbmap2Smilmask));

    // Calculate rectangle for the whole bitmap
    TRect bmpPieceRect(TPoint(0,0),bitmap->SizeInPixels());

    // Blit using a masking bitmap, with no inversion
    gc.BitBltMasked(TPoint(50,50),bitmap,bmpPieceRect,maskBitmap,EFalse);

    ...
    // clean up
    CleanupStack::PopAndDestroy();

    but what are this ID: EMbmGrbmap2Smilmask? How can obtain this ID? Have I to define some new code into .rss or any other file? Thanks in advance!!

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    12
    That ID is just another ID in the mbm file, and that bitmap tool can generate a header file for you.

    I just generated a maskbitmap from the original bitmaps and used that, since I didn't want to have two sets in my mbm file. As far as I know you'll need two sets of bitmaps when using the mask bitblt.
    Last edited by BenNg; 2003-05-14 at 21:29.

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    40

    still having problems

    Thanks for your help but I am having the same problems. Where I have to looking for that ID? I think is a hexadecimal number but I can not find it. The steps I do are:

    1.- Using bmconverter: bmconv /himagen.h imagen.mbm imagen.bmp

    I obtain the image in mbm format. Then I put this piece of code:

    _LIT(imagen,"C:\symbian\6.1\series60\series60ex\logidef\aif\imagen.mbm");

    // load the bitmap from an .mbm file
    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
    CleanupStack::PushL(bitmap);
    User::LeaveIfError(bitmap->Load(imagen,EFileRead));


    // EMbmGrbmap2Smiley is the ID of a bitmap in the .mbm file


    // clean up
    CleanupStack::PopAndDestroy();


    In EfileRead I have tried all you can imagine. The path where the file is, I even have opened the mbm file with an editor and I have many errors. With which tool you can opened mbm files? Another problem is that it is filed in CleanupStack::PushL(bit map) I can understand why. It is code of help library...

  4. #4
    Registered User
    Join Date
    Mar 2003
    Location
    Dhaka Bangladesh
    Posts
    26
    Hello,

    In MBM file bitmap images are stored orderly. And the ID is the number of the image in the MBM file. If the bitmap that you want to use from the MBM file, is the first image file of the MBM then you can use 0 instand of EFileRead and so forth.

    So your code should be look like this.

    _LIT(imagen,"C:\symbian\6.1\series60\series60ex\logidef\aif\imagen.mbm");

    // load the bitmap from an .mbm file
    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
    CleanupStack::PushL(bitmap);
    //User::LeaveIfError(bitmap->Load(imagen,EFileRead));
    User::LeaveIfError(bitmap->Load(imagen,0));


    // EMbmGrbmap2Smiley is the ID of a bitmap in the .mbm file


    // clean up
    CleanupStack::PopAndDestroy();


    Enjoy graphics coding.

    Tipu

  5. #5
    Registered User
    Join Date
    May 2003
    Posts
    40

    still having problems with loading images

    well, many thaks for your help but I am still having problems with this identifier. It is true that I only have an image in the mbm file but even trying to put this code you told me it does not work.

    Again, many thaks for your help and for attend me.

  6. #6
    Registered User
    Join Date
    May 2003
    Posts
    40

    THE SAME

    I have a problem with one library e32def.lib. This library is not found for may program and I thik that is why _LIT is not recognise by my system, so What can I do to make my system recognise it. I try copying this library from its original source to the directory of work even in my own group aplication directorio but it does not matter. Many tahks in advance!!

  7. #7
    Registered User
    Join Date
    May 2003
    Posts
    40

    the same again

    I have detected that the code before crush at the CleanupStack::PushL(bitmap) instruction. I have try to put delete bitmap and it works but when I try to display the image with bitmap->load(imagen,0) then it crushes again. When you load the bitmap it has to appear in the screen? But again I can see it. It does not display anything.

  8. #8
    Regular Contributor
    Join Date
    Mar 2003
    Location
    United Kingdom
    Posts
    78
    Try this code on the emulator:

    _LIT(imagen,"z:\\system\\apps\\MyApp\\MyApp.mbm");

    // load the bitmap from an .mbm file
    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();

    bitmap->Load(imagen,0);

    TPoint aPoint(10,10); // top left corner
    gc.BitBlt(aPoint,bitmap);


    If the above code works you could consider introducing User::LeaveIfError harnesses.

    Also, you cannot access the 'Z' drive on any device as it represents the ROM drive.

    If the above code fails to work, there are a number of things to check:

    1) Have you created the mbm file correctly?
    2) Is the mbm file in the correct place?
    3) Have you ammended your mmp file to reflect the inclusion of the mbm file?
    4) Did you rebuild the project using abld?
    5) The list goes on...

  9. #9
    Registered User
    Join Date
    Jul 2003
    Location
    Delaware (The 1st State), USA
    Posts
    23
    You want the .mbg include file. This is created when you build the .mmp file. Its basically an enumeration for your bitmaps you have in your .mbm file.

    After you build, just search your hard drive for <MBMFilename>.mbg (where MBMFilename is the filename of your .MBM file). This will give you an idea where the compiler puts your .mbg file after the build.

    Hope this helps.

Posting Permissions

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