contentstorage/caclient/s60/src/camenuiconmifutility.cpp
changeset 66 32469d7d46ff
child 73 4bc7b118b3df
equal deleted inserted replaced
61:8e5041d13c84 66:32469d7d46ff
       
     1 /*
       
     2  * Copyright (c)2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  ?Description
       
    15  *
       
    16  */
       
    17 
       
    18 #include <e32std.h>
       
    19 #include <e32base.h>
       
    20 #include <QBitmap>
       
    21 #include <QDebug>
       
    22 #include <AknIconUtils.h> // avkon
       
    23 #include <APGICNFL.H> // fbsbitmap
       
    24 
       
    25 #include "cabitmapadapter.h"
       
    26 #include "camenuiconmifutility.h"
       
    27 
       
    28 
       
    29 void CaMenuIconMifUtility::GetPixmapByFilenameL(TDesC& fileName,
       
    30         const QSize &size, QPixmap& pixmap)
       
    31 {
       
    32     CFbsBitmap *bitamp(0);
       
    33     CFbsBitmap *mask(0);
       
    34     
       
    35     if ( AknIconUtils::IsMifFile(fileName)) {
       
    36         // SVG icon
       
    37         // SVG always has only one icon
       
    38         TInt bitmapIndex = 0;
       
    39         TInt maskIndex = 1;
       
    40         AknIconUtils::ValidateLogicalAppIconId( fileName,
       
    41                 bitmapIndex, maskIndex );
       
    42 
       
    43         AknIconUtils::CreateIconLC( bitamp, mask, fileName,
       
    44                 bitmapIndex, maskIndex );
       
    45         }
       
    46 
       
    47     AknIconUtils::DisableCompression(bitamp);
       
    48     AknIconUtils::SetSize(bitamp, TSize(size.width(), size.height()),
       
    49                     EAspectRatioPreservedAndUnusedSpaceRemoved);
       
    50     
       
    51     AknIconUtils::DisableCompression(mask);
       
    52     AknIconUtils::SetSize(mask, TSize(size.width(), size.height()),
       
    53                     EAspectRatioPreservedAndUnusedSpaceRemoved);
       
    54     
       
    55     CaBitmapAdapter::fromBitmapAndMaskToPixmapL(bitamp, mask, pixmap);
       
    56     
       
    57     // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order
       
    58     CleanupStack::Pop(2);
       
    59 }