×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Location
    Luttenberg (Netherlands)
    Posts
    577

    AknIconUtils::CreateIconL - mask or no mask?

    Hi,

    in S60 you can load a SVG image as a bitmap in your application, scale it and display it on the screen using code like below:

    CGulIcon* CBitmapDrawContainer::LoadImageL( TInt aIndex )
    {
    CFbsBitmap* bitmap;
    CFbsBitmap* mask;

    AknIconUtils::CreateIconL(
    bitmap, mask, KMifFileName,
    aIndex,
    aIndex + 1 );
    CleanupStack::PushL( bitmap );
    CleanupStack::PushL( mask );
    // CGulIcon::NewL takes ownership of bitmap and mask!
    CGulIcon* image =
    CGulIcon::NewL( bitmap, mask );
    CleanupStack::Pop( mask );
    CleanupStack::Pop( bitmap );
    return image;
    }

    As far as I can see the MIF file is always created such that there is the bitmap (at position index) and the mask (at position index + 1) in the MIF file. The method above loads both and puts them together in a CGulIcon.

    Initially the bitmap will have size TSize(0,0) and you have to call SetSize to scale both the bitmap and the mask (in the CGulIcon).

    1) When scaling using this method, does S60 use the underlying SVG image to perform the scale and convert again to bitmap? Can there be any distortion because of this scaling operation?

    When displaying the SVG image you can use:

    A) gc.BitBlt( topLeft, iButton->Bitmap() );

    iButton is a CGulIcon pointer. You can also use:

    B) gc.BitBltMasked( topLeft, iButton->Bitmap(),
    buttonRect, iButton->Mask(), EFalse );

    After some experimentation it turns out some SVGs show fine using the bitmap + mask approach and for some SVGs is you use a mask the SVG image does not show (this happens with the SVG icons supplied with the examples).

    2) What can cause this different behaviour? I did not test yet, but I am assuming the bitmap blitted in case A) will not have any transparent areas as we are not using a mask.

    3) Is there any new functionality in S60 5th edition to handle SVG images?

    BR,

    Rene
    Rene Heuven
    Inmote - Creative Smartphone Solutions
    Web: www.inmote.com
    E-mail: rene@inmote.com

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

    Re: AknIconUtils::CreateIconL - mask or no mask?

    Quote Originally Posted by heuven View Post
    1) When scaling using this method, does S60 use the underlying SVG image to perform the scale and convert again to bitmap? Can there be any distortion because of this scaling operation?
    Yes, the SVG source is re-used, thus no distortion will occur.
    When displaying the SVG image you can use:

    A) gc.BitBlt( topLeft, iButton->Bitmap() );

    iButton is a CGulIcon pointer. You can also use:

    B) gc.BitBltMasked( topLeft, iButton->Bitmap(),
    buttonRect, iButton->Mask(), EFalse );

    After some experimentation it turns out some SVGs show fine using the bitmap + mask approach and for some SVGs is you use a mask the SVG image does not show (this happens with the SVG icons supplied with the examples).
    Exactly which icons of which examples?

Similar Threads

  1. how to create a mask of image dynamically
    By raysky in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2008-11-03, 05:43
  2. resize picture with mask
    By CmoaToto in forum Symbian
    Replies: 1
    Last Post: 2008-10-22, 01:41
  3. svg mask
    By nokia_e70 in forum Symbian
    Replies: 0
    Last Post: 2008-03-29, 12:54
  4. 3rd app icon and mask
    By tektronic in forum Symbian
    Replies: 0
    Last Post: 2006-07-18, 10:10

Posting Permissions

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