×

Discussion Board

Results 1 to 9 of 9

Thread: Loading bitmap

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    29

    Unhappy Loading bitmap

    Hi,

    I am developing a sample game of arkanoid. I displayed the whole GUI using draw function n making eclipse but i want to display the same by using bitmap but while do so i am getting an error in enum value ie

    CWsBitmap* neb = iEikonEnv->CreateBitmapL(_L("\\resource\\apps\\animation.mbm"), EMbmAnimationNebula);


    for loading the bit map i have add following codes::

    in mmp file


    start bitmap DemoBitmap.mbm
    header
    sourcepath ..\gfx
    source c8 bricks.bmp
    end

    LIBRARY fbscli.lib
    LIBRARY bitgdi.lib
    -----------------------------------------------------------
    In AppView

    // in constructL
    void CBrickGameAppView::ConstructL(const TRect& aRect)
    {
    // Create a window for this application view
    CreateWindowL();

    // Load in the bitmap images from the multi bitmap file
    _LIT( KFullBitName, "\\resource\\apps\\Try.mbm" );
    TFileName filePath( KFullBitName );
    User::LeaveIfError( 0 );

    iBitmap = new (ELeave) CFbsBitmap();
    User::LeaveIfError ( iBitmap->Load( filePath, EBitmapDrawViewId1 ));


    // Set the windows size
    SetRect(aRect);

    // Activate the window, which makes it ready to be drawn
    ActivateL();
    }
    - - - - - - - - - - - - - -- - - - - - - - -
    In Draw
    gc.Clear(aRect);
    gc.BitBlt(aRect.iTl, iBitmap);


    but its not displaying anything
    and sometimes it show error as BMCONV failed and sometime as mbg file not found while its creating .mbg file

    Can anybody help me what wrong I am doing and whats the error in my code.
    If not so the plz tell me step by step process of loading bitmap.
    I have already spend a whole day in doing soo
    reply ASAP, its urgents.

    Thanks and Regards
    Amrish

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: Loading bitmap

    Generally your code looks fine, however it is not sure if the .mbm file is generated to the correct location, experiment with TARGETPATH (if you are using S60 3rd FP1 or FP2, the S60Ex\Graphics example has been re-introduced for them).
    So make sure that the file Try.mbm appears in epoc32\data\z\resource\apps and in epoc32\release\winscw\z\resource\apps (for the emulator).
    About the file-creation issue: the emulator should not run, and the given files should not be held open by any application (viewers) when you are re-generating bitmaps/other resource files.

    EDIT: c8 might not be the best possible choice: it is a palettized format, and it is not sure that devices actually support that. So temporarily you may consider replacing it to c12, and if everything works, you can still check if c8 works or not.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    29

    Re: Loading bitmap

    hi,
    thanks for your reply
    i have chked all the location as written by you my .mbm file has been created at both the locations and still its showing error
    as undefined identifier 'EBitmapDrawViewId1'
    I am not getting reason of giving his error.

    and also in edit i have tried c12 nad c24 as well.

    Regards Amrish

  4. #4
    Registered User
    Join Date
    May 2008
    Posts
    29

    Re: Loading bitmap

    I have rectified the error actually i have to proide enum value before passing........... but still its not showing anything on emulator plz do help me

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: Loading bitmap

    Do you have the file Try.mbm in the mentioned locations of the SDK? Are the files seem to be the same with recent date and non-zero size? Note that your SDK probably has mbmviewer (in S60Tools), you can also check the files using that.

  6. #6
    Registered User
    Join Date
    May 2008
    Posts
    29

    Re: Loading bitmap

    Thanks a lot for your help
    I wasn't aware of any mbmviewer . I searched mbmviewer but that is empty. but in those two location i.e in release and data its showing the try.mbm file.
    Now how to coup up with this situation. What changes should i do to bring my .mbm file in mbmviewer

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: Loading bitmap

    In fact I have almost all published S60 3rd ed. SDK-s installed, and all of them contain the mbmviewer:
    - S60 3rd MR: C:\Symbian\9.1\S60_3rd_MR\S60Tools\mbmviewer\mbmviewer.exe
    - S60 3rd FP1: C:\Symbian\9.2\S60_3rd_FP1\S60Tools\mbmviewer\mbmviewer.exe
    - S60 3rd FP2: C:\S60\devices\S60_3rd_FP2_SDK\S60tools\mbmviewer\mbmviewer.exe

    Otherwise if your Try.mbm appears in the correct locations, your code should work. One thing pops in to my mind, make sure that your Draw method overrides correctly the default Draw method:
    Code:
    void CYourSomething::Draw(const TRect& /*aRect*/) const
    of course aRect can be completely missing, or it can be uncommented. Note the const at the end, it is also necessary.

  8. #8
    Registered User
    Join Date
    May 2008
    Posts
    29

    Re: Loading bitmap

    Sorry you did get what i was telling actually m having mbmviewer but there was nothing in that it was empty . Ther is no error in my
    code(as per compilation view) but its nt displaying in the emulator.I am sending my code which i have made right now as per following your instruction as private msg.

    Hope you come back to me soon
    Amrish

  9. #9
    Registered User
    Join Date
    May 2008
    Posts
    29

    Re: Loading bitmap

    I am writing only to what changes i have gone through
    in mmp

    START BITMAP Demo2.mbm
    TARGETPATH \resource\apps
    HEADER
    SOURCEPATH ..\gfx
    SOURCE c12 bricks.bmp
    END

    Library added

    LIBRARY fbscli.lib
    LIBRARY bitgdi.lib
    in AppView

    #include <coemain.h>
    #include <eikenv.h>
    #include "demo2.mbg"
    #include <fbs.h>

    #include "Demo2AppView.h"

    _LIT( KFullBitName, "\\resource\\apps\\Demo2.mbm" );


    void CDemo2AppView::ConstructL(const TRect& aRect)
    {
    // Create a window for this application view
    CreateWindowL();


    TFileName filePath( KFullBitName );
    User::LeaveIfError( 0 );
    iBitmap = new (ELeave) CFbsBitmap();
    User::LeaveIfError ( iBitmap->Load( filePath, EMbmDemo2Bricks ));

    // Set the windows size
    SetRect(aRect);

    // Activate the window, which makes it ready to be drawn
    ActivateL();
    }

    void CDemo2AppView:raw(const TRect& /*aRect*/) const
    {
    // Get the standard graphics context
    CWindowGc& gc = SystemGc();

    // Gets the control's extent
    TRect drawRect(Rect());
    TRect aRect;
    // Clears the screen
    gc.Clear(drawRect);
    gc.BitBlt(aRect.iTl, iBitmap);

    }
    its creating mbm file mbg file but displaying nothing

Similar Threads

  1. problem when importing from carbide c++ to vs 2003!
    By misfit.physics in forum Symbian Tools & SDKs
    Replies: 12
    Last Post: 2008-02-19, 09:45
  2. How can I reverse the color in the screen?
    By sanmu163 in forum Symbian User Interface
    Replies: 11
    Last Post: 2006-08-18, 08:12

Posting Permissions

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