Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User lukedau's Avatar
    Join Date
    Jul 2004
    Posts
    93
    Hi, I want to use SVG and bitmap graphics together in my application. I followed the Scalable UI guide line document (from Forum Nokia).

    I create the MIF, MBM and MBG using the MK file (copy from the Icons_aif_scalable_dc.mk from helloworldbasic).

    Case 1:
    I put MIF and MBM under \\resource\\apps\\. My application can use the SVG icons on a list box. However, it cannot load bitmap from MBM.

    Load SVG:
    Code:
       CFbsBitmap *bitmap, *mask;
       AknIconUtils::CreateIconLC( bitmap, mask, aFileName, aBitmapId, aMaskId );
       CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); // ownership transferred
       CleanupStack::Pop( 2 ); // bitmap, mask
    Load Bitmap:
    Code:
       CFbsBitmap* bitmap = GetBitmapL( aFileName, aIndex )
    Case 2:
    I put MIF and MBM under \\private\\1000ABCD\\. My application cannot load bitmap from MBM. The icons on list box become empty too.

    Case 3:
    I give up the SVG and put START BITMAP in MMP file (same as the way in 2.x). I put the MBM under \\private\\1000ABCD\\. My application can load the bitmap from MBM. No SVG so I changed my graphics list box to simple list box.

    Does anyone able to use bitmap and SVGT together? Can I put those files under \\private\\1000ABCD\\ instead of the public share folder \\resource\\apps\\?

    thanks a lot in advance.

    lukedau

  2. #2
    Registered User Greg_Jokiel's Avatar
    Join Date
    Oct 2005
    Posts
    40
    Hi,

    Case 1:

    I think you are supposed to use the same API to load either SVG or BMP from MIF or MBM files. From the documentation it looks like bitmap and SVG cannot be in the same files though SVG -> MIF BMP -> MBM.

    Case 2:

    If the SID of your application is
    1000ABCD
    then you should be able to load files from \private\1000ABCD. Now may be it is a case that the API only looks into \resource\apps since this is the preferred location for resource files.

    case 3:
    If the above assertion is correct then using the new API to load the MBM might fails if the file is in \private\1000ABCD.

    These are not definite answers, but they are worth considering.

    GreG

  3. #3
    Registered User lukedau's Avatar
    Join Date
    Jul 2004
    Posts
    93
    Hi GreG,

    From the documentation, bitmap and SVG are created using the MK file, using the mifconv utility. It will generate a MBM and MIF (if correspondance source file exists). Only one MBG will be created. From the API documentation, SVG or MBM icons are loaded using the AknIconUtils. The filename can be MBM. It will auto detect the extension by the Enum index. If I use the AknIconUtils, the program need to use SetSize before I can use the bitmap. That means I must include the size of the bitmap files I'm using. Is there any automatic way?

    Also, I wish to put my MIF, MBM files under the private folder, instead of the resource folder. It is because I might have several files, using some common names, such as icon.mbm, effects.mbm, which may be overwritten by other in resource folder.

    Please advise.

    Thanks.

    lukedau

  4. #4
    Registered User Greg_Jokiel's Avatar
    Join Date
    Oct 2005
    Posts
    40
    Quote Originally Posted by lukedau
    That means I must include the size of the bitmap files I'm using. Is there any automatic way?
    There is an AknIconUtils::GetContentDimensions() API that can be used to get the dimensions of the bitmap and then you can call AknIconUtils::SetSize().

    Quote Originally Posted by lukedau
    Also, I wish to put my MIF, MBM files under the private folder, instead of the resource folder. It is because I might have several files, using some common names, such as icon.mbm, effects.mbm, which may be overwritten by other in resource folder.
    The resource\apps folder is read only for all applications except the ones that have AllFiles capability (I think). Basically the latter ones can have access to the private directories as well. So you can't protect against those.

    Now for normal applications I don't think that they can overwrite existing files on the resource\apps folder even through the installer so to me you can safely leave you icon files in the resource\apps folder.

    GreG

  5. #5
    Regular Contributor ptrmn's Avatar
    Join Date
    May 2005
    Location
    Sweden
    Posts
    272
    Having files called things like "icon.mbm" is a really bad idea, as it's likely that others will do the same, and then your two apps can't be installed at once. All the user sees is a message like "install error" when trying to install the second app, which is something I'm pretty sure you don't want to happen to the users of your app.

  6. #6
    Registered User sriky27's Avatar
    Join Date
    Dec 2005
    Posts
    1,236
    hi,

    I had the same problem.

    The approach should be whenever a mbm is created the corresponding enums start from Zero correct.
    When you merge svgs and bmps even if your corresponding enum start off from 16000 + but the mbm takes enum which start from Zero.

    for example

    lets say u have 1 icon1 in mif and 1 icon2 in mbm
    and the corresponding mbg created be

    enum TMifXX_aif
    {
    EMbmXX_aificon1 = 16384,
    EMbmXX_aificon1_mask,
    EMbmXX_aificon2,
    EMbmXX_aifLastElement
    }

    ok svgs are normally loaded as you say

    when you load the bmps the following calculation have to be done
    CFbsBitmap* bitmap = NULL;
    bitmap->Load(path,(EMbmXX_aificon2 - EMbmXX_aificon1)/2,..);

    so what are we doing here
    we are mapping the enum back to Zero which is the offset the mbm takes

    do this.

    Regards,
    Sriky

  7. #7
    Regular Contributor simo.salminen's Avatar
    Join Date
    Aug 2004
    Posts
    295
    Quote Originally Posted by Greg_Jokiel
    There is an AknIconUtils::GetContentDimensions() API that can be used to get the dimensions of the bitmap and then you can call AknIconUtils::SetSize().
    Note that if icons are given to regular s60 listbox it wil handle the SetSize call.


    Btw. if you change your icons in resource files, and wonder why the listbox still uses old icon, reboot the phone. There is some kind of caching happening behind listbox/svg implementation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved