×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    19

    How to create mbm file?

    I've been trying to create an mbm files for the whole day today, but I've been having problem???

    I've tried doing it in the command line using bmconv

    this is what I type in the command line:
    bmconv /haknexspane.h aknexspane.mbm /c8context /c8indicato /c8indicatom /c8lshellicon /c8lshelliconm /c8navi /c8testimage1 /c8testimage1mask /c8title

    but everytime it finish creating an mbm files this happens:

    BMCONV version 103.
    Compiling...
    Multiple bitmap store type: File store
    Epoc file: aknexspane.mbm

    Bitmap file 1 : context
    Bitmap file 2 : /c8indicato
    Bitmap file 3 : /c8indicatom
    Bitmap file 4 : /c8lshellicon
    Bitmap file 5 : /c8lshelliconm
    Bitmap file 6 : /c8navi
    Bitmap file 7 : /c8testimage1
    Bitmap file 8 : /c8testimage1mask
    Bitmap file 9 : /c8title
    File does not exist

    It creates an mbm files but there's nothing inside it - 0kb...

    If I include it in the mmp files it doesn't create an mbm files at all???

    this is the code inside the mmp file:

    START BITMAP plainrichtext.mbm
    HEADER
    SOURCEPATH ..\aif
    SOURCE c12 context_pane_icon.bmp
    SOURCE c12 context_pane_icon_mask.bmp
    SOURCE c12 list_icon.bmp
    SOURCE c12 list_icon_mask.bmp
    END

    Help me please!!! ASAP!!! need to know what's wrong??
    any help will be appreciated..

  2. #2
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    113

    This works for me...

    Perhaps try a command file:

    eg: "s60.cmd"

    /h..\inc\s60mbm.hrh
    s60.mbm
    /c16folder13x13.bmp
    /1folder13x13mask.bmp
    /c16file13x13.bmp
    /1file13x13mask.bmp
    /c16blank13x13.bmp
    /1blank13x13mask.bmp
    /c16error13x13.bmp
    /1error13x13mask.bmp
    /c16info13x13.bmp
    /1info13x13mask.bmp
    /c16warning13x13.bmp
    /1warning13x13mask.bmp
    /c16modifieditem13x13.bmp
    /c16newitem13x13.bmp
    /1itemmask13x13.bmp

    and then to make the mbm:

    bmconv s60.cmd

    The above will create an associated .hrh file in an adjacent ..\inc folder as well as the required mbm.

  3. #3
    Registered User
    Join Date
    Apr 2004
    Posts
    19
    Thanks so much it works now...

    but when I type bmconv aknexspane.cmd this happen:

    BMCONV version 103.
    Bad command file.

    Don't know what' wrong but happily it already creates the files I need tnxs so much!!!!

  4. #4
    Nokia Developer Expert
    Join Date
    Apr 2003
    Location
    Finland
    Posts
    425
    Hello, This:
    Code:
    bmconv /n /hresult/your_hdr.h result/your_mbm.mbm /c12src/icon001.bmp /1src/icon001_mask.bmp /c12src/icon001_list.bmp /1src/icon001_list_mask.bmp
    works fine on my environment.

    [result] is a folder on your workstation where generated files is copied.

    [src] is a folder on your workstation where source bitmaps are located.

    [icon001*.bmp] are the source bitmaps, 4 pieces at this time which generates 2 symbian icons for you. Each symbian bitmat consist of bitmap and mask.

    If you need more icons just continue that parameter list with bitmap filenames.

    BTW: Mask bitmap files should be defined to have '1' color, not 'c12'.

    I think the problem on your commandline case was missing file extensions ?

    And finally this mmp definition works fine in my environment:

    Code:
    START BITMAP your_mbm.mbm
    TARGETPATH \system\Icons
    HEADER
    SOURCEPATH  ..\srcdata
    SOURCE      c12 icon001.bmp
    SOURCE      1 icon001_mask.bmp
    SOURCE      c12 icon001_list.bmp
    SOURCE      1 icon001_list_mask.bmp
    Just adjust your enviroment to have source bitmaps on [srcdata] folder. May be TARGETPATH should also be changed to satisfy your needs.


    Br V

  5. #5
    Registered User
    Join Date
    Apr 2004
    Posts
    19
    Thanks for the help I know now what missing and I already figure it out!!

    Hey! I know it's to much to ask but can some teach me how to create, load or just display bitmaps? I kinda having problems with the example in the SDK it this always happens:

    C:\DIE\SENDO\GRAPHICS\SRC\Graphicscontainer.cpp(81) : error C2166: l-value specifies const object

    this is what I put inside myDraw():

    iBitmap = new (ELeave) CFbsBitmap();

    please need help it's just a project I need to finish!!

    tnx for the help again!!

  6. #6
    Nokia Developer Expert
    Join Date
    Apr 2003
    Location
    Finland
    Posts
    425
    Code:
    [.h]
        CFbsBitmap* iImageBitmap;
    
    [.cpp]
    _LIT(KBitmapFile, "z:\\system\\apps\\sample\\sample_logo.mbm");
    
    void CMyAboutControl::ConstructL(CCoeControl& aParent)
    {
        SetContainerWindowL(aParent);
        iImageBitmap = new (ELeave) CFbsBitmap;
        CleanupStack::PushL(iImageBitmap); 
        User::LeaveIfError(iImageBitmap->Load(KBitmapFile,0));
        CleanupStack::Pop(iImageBitmap);
    <...>
    }
    
    void CMyAboutControl::Draw(const TRect& aRect) const
    {
        CWindowGc& gc = SystemGc();
        gc.Clear( aRect );
        TRect imageRect ( 0, 0, iImageBitmap->SizeInPixels().iWidth, iImageBitmap->SizeInPixels().iHeight);
        if ( aRect.Intersects( imageRect ) )
        {
            imageRect.Intersection( aRect );
            gc.UseBrushPattern( iImageBitmap );
            gc.SetPenStyle( CGraphicsContext::ENullPen );
            gc.SetBrushStyle( CGraphicsContext::EPatternedBrush );
            gc.SetBrushOrigin( TPoint( 0,0 ) );
            gc.DrawRect( imageRect );
            gc.DiscardBrushPattern();
        }
    <...>
    }
    Br V.

  7. #7
    Registered User
    Join Date
    Apr 2004
    Posts
    19
    I've used your code but everytime I exit the apps the emulator crash!
    but I can view bitmaps already...

    Now I trying to load a PNG but everytime I open the apps the emulator crash!

    Here is my code:

    void CPNGContainer::ConstructL(const TRect& /*aRect*/)
    {
    CreateWindowL();
    SetExtentToWholeScreen();
    ActivateL();

    iImageBits = new (ELeave) CFbsBitmap();
    iConverter = CMdaImageFileToBitmapUtility::NewL(*this);
    iConverter->OpenL(KPicFileName);
    }

    void CPNGContainer::Draw(const TRect& /*aRect*/) const
    {
    CWindowGc& gc = SystemGc();
    gc.Clear(Rect());
    gc.BitBlt(Rect().iTl,iImageBits);
    }

    void CPNGContainer::MiuoOpenComplete(TInt /*aError*/)
    {
    TFrameInfo frameInfo;
    iConverter->FrameInfo(0, frameInfo);
    err = iImageBits->Create(frameInfo.iOverallSizeInPixels,EColor4K);
    TRAPD(convertErr,iConverter->ConvertL(*iImageBits));
    }

    void CPNGContainer::MiuoConvertComplete(TInt aError)
    {
    delete iImageBits;
    iImageBits = NULL;
    }

    void CPNGContainer::MiuoCreateComplete(TInt aError)
    { /* no implementation */ }

    Please Help!!! I just can't figure out what wrong with this....
    I'm getting frustrated... : (

  8. #8
    Registered User
    Join Date
    Apr 2004
    Posts
    19
    never mind about this I already figure out whats wrong! somethings wrong in draw...

    tnx again for all the help!

  9. #9
    Nokia Developer Expert
    Join Date
    Apr 2003
    Location
    Finland
    Posts
    425
    Ok, nice you have got it work...i have been busy and haven't read board for a while.

    Just as reminder, to get robust code, you should place error check at least in MiuoOpenComplete method. Try to place incorrect filename and run with debugger to check what can happen. It won't be good idea to continue conversion if opening fails... and what happen then on draw method, may be nothing catastrophic...

    ...and of cource you have delete iImageBits in destructor [why i'm asking this :-o]

    Br V.

  10. #10
    Registered User
    Join Date
    Apr 2004
    Posts
    19
    Hey! in the past 3 days all I've been doing is trying to figure out how to convert and view multiple png and use the images as button???

    but I can't find out y it won't work when I try this:

    void CPNGContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
    SetRect(aRect);
    ActivateL();

    iConverter = CMdaImageFileToBitmapUtility::NewL(*this);
    for (CurImg = 0; CurImg<KImgID; CurImg++)
    {
    iImageBits[CurImg] = new (ELeave) CFbsBitmap();
    switch (CurImg)
    {
    case 0: iConverter->OpenL(KMainFile); break;
    case 1: iConverter->OpenL(KBackFile); break;
    case 2: iConverter->OpenL(KNewFile); break;
    case 3: iConverter->OpenL(KListFile); break;
    case 4: iConverter->OpenL(KLogsFile); break;
    case 5: iConverter->OpenL(KSetFile); break;
    case 6: iConverter->OpenL(KHelpFile);
    }
    CActiveScheduler::Start();
    }
    }

    CPNGContainer::CPNGContainer() : iConvertState(EConvertStateNull)
    { /* no implementation */ }

    // Destructor
    CPNGContainer::~CPNGContainer()
    {
    delete iConverter; iConverter = NULL;
    delete iImageBits[KImgID]; iImageBits[KImgID] = NULL;
    }

    void CPNGContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.Clear( aRect );
    if (iConvertState == EConvertStateReady)
    {
    gc.BitBlt(TPoint(0,0),iImageBits[0]);
    gc.BitBlt(TPoint(10,30),iImageBits[1]);
    }
    }

    void CPNGContainer::MiuoOpenComplete(TInt aError)
    {
    if (aError == KErrNone)
    {
    TFrameInfo frameInfo;
    iConverter->FrameInfo(KFrameIndex,frameInfo);

    //Create a bitmap based on the size of the pic
    TInt err = iImageBits[CurImg]->Create(frameInfo.iOverallSizeInPixels,KDeviceColourDepth);
    if (err == KErrNone)
    { //Convert the pic into a bitmap
    iConvertState = EConvertStateReady;
    iConverter->ConvertL(*iImageBits[CurImg],KFrameIndex); }
    }
    }

    void CPNGContainer::MiuoConvertComplete(TInt aError)
    {
    if (aError == KErrNone)
    { CActiveScheduler::Stop(); }
    DrawNow();
    }

    void CPNGContainer::MiuoCreateComplete(TInt /*aError*/)
    { /* no implemenmtation */ }

    but if I only view iImageBits[0] it works perfectly fine... when I try to run it in debug this error occurs:

    Unhandled exception in epoc.exe (FBSCLI.DLL) : 0x0000005 : Access Violation

    please help!!! my deadline is 2 day from now!!!!!
    please very desperate!!!!!!

  11. #11
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    I guess that you should better open next file only after the previous one is opened/converted (so probably in MiuoConvertComplete method).
    And another thing, I believe that it is really better to use some of the Symbian's arrays to store objects (for example RPointerArray)

  12. #12
    Nokia Developer Expert
    Join Date
    Apr 2003
    Location
    Finland
    Posts
    425
    Hello,

    Yes thats true, there is no sense to try parallel uncompression because device cannot do that in real parallel mode. Obviously you can implement that but it will be as slow as serial uncompression.

    The logical mistake on your code is, there should be as many CPNGContainer objects as there is pictures to decrypt. When there is multible CPNGContainer objects there is also multible callback entry points (e.g. MiuoOpenComplete methods)...but forget this.

    Instead that complex approax create an array for bitmaps as sopta007 suggest. Place your filenames to static table and start the first decryption like here:

    iConverter->OpenL(fileNames[iFileInProgress];

    and then something like:

    void CPNGContainer::MiuoConvertComplete(TInt aError)
    {
    if (aError == KErrNone)
    {
    // TODO: Add image bitmap to array here...

    // Test if there is still images to process
    if (++iFileInProgress < sizeof(...))
    {
    iConverter->OpenL(fileNames[iFileInProgress];
    }
    else
    // Now all images are ready and can be used through RPointerArray
    <...>
    }

    Now you are able to add as many filenames desired without need to touch the code, just write those to filenames to the array. And there is no problem to 'know' how many bitmaps should be deleted on destructor.

    Br V

  13. #13
    Registered User
    Join Date
    Apr 2004
    Posts
    19
    I'm sorry, I'm a little slow when it comes to this kind of explanation? if it's not to much to ask could you give me an example??? how I could use this:

    iConverter->OpenL(fileNames[iFileInProgress];

    I'm very sorry to be asking so much!!! but tnx for all the help!!!

  14. #14
    Nokia Developer Expert
    Join Date
    Apr 2003
    Location
    Finland
    Posts
    425
    Hello, I wrote this without trying to compile -> some mistakes stille there :-)

    Code:
    class YourPicture
    {
    public:
        YourPicture (CFbsBitmap* aBitmap, TPtrC* aName)
        {
            iBitmap = aBitmap;
            iName = aName;
        }
        ~YourPicture ()
        {
            delete iBitmap;
            delete iName;
        }
        CFbsBitmap* iBitmap;
        TPtrC* iName;
    };
    
    class YourContainer
    {
    <...>
        RPointerArray<YourPicture> iPictures;
        CFbsBitmap* iPictureInDecryption;
    }
    
    [.cpp]
    TPtrC imagesTable[] = {
        _L("pict001.jpg"),
        _L("pict002.jpg"),
        _L("pict003.jpg"),
        _L("pict004.jpg")
    };
    
    CYourContainer::CYourContainer()
        : iPictureInDecryption (NULL)
    {
    }
    
    CYourContainer::~CYourContainer()
    {
        iPictures.ResetAndDestroy();
        iPictures.Close();
    }
    
    void CYourContainer::Start()
    {
        iConverter->OpenL(imagesTable[iPicInProgress]);
    }
    
    void CYourContainer::MiuoOpenComplete(TInt aError)
    {
        // TODO: Check aError
        TFrameInfo frameInfo;
        iConverter->FrameInfo(KFrameIndex,frameInfo);
        iPictureInDecryption = new(ELeave)CFbsBitmap;
    
        TInt err = iConverter->Create (frameInfo.iOverallSizeInPixels,iEikonEnv->SystemGc().Device()->DisplayMode ());
        if( err == KErrNone )
        {
            TRAP(err, iConverter->ConvertL(*iPictureInDecryption));
        }
        else
        {
            MiuoConvertComplete(err);
        }
    }
    
    void CYourContainer::MiuoConvertComplete(TInt aError)
    {
        switch (aError)
        {
            case KErrNone:
            {
                YourPicture* newItem = new(ELeave)YourPicture(iPictureInDecryption, iImages[iPicInProgress]);
                User::LeaveIfError (iPictures.Insert(newItem,iPictures.Count() ));
            }
    
            default:
            {
                iConverter->Close();
                return;
            }
            break;
        }
    
        if (++iPicInProgress <= (sizeof(imagesTable) / sizeof(TPtrC)))
        {
            Start();
        }
    }
    
    <...>
    iPictures.Count()      // Total count of pictures available.
    iPictures[0]->aBitmap;  // CFbsBitmap pointer of pict001.jpg
    iPictures[0]->aName;  // TPtrC (name) of pict001.jpg
    Br V.

Posting Permissions

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