29 void CaMenuIconMifUtility::GetPixmapByFilenameL(TDesC& fileName, |
29 void CaMenuIconMifUtility::GetPixmapByFilenameL(TDesC& fileName, |
30 const QSize &size, QPixmap& pixmap) |
30 const QSize &size, QPixmap& pixmap) |
31 { |
31 { |
32 CFbsBitmap *bitamp(0); |
32 CFbsBitmap *bitamp(0); |
33 CFbsBitmap *mask(0); |
33 CFbsBitmap *mask(0); |
|
34 |
|
35 TInt bitmapIndex = 0; |
|
36 TInt maskIndex = 1; |
|
37 // it will change bitmap ids if it is mif (checking inside) |
|
38 AknIconUtils::ValidateLogicalAppIconId( fileName, |
|
39 bitmapIndex, maskIndex ); |
|
40 AknIconUtils::CreateIconLC( bitamp, mask, fileName, |
|
41 bitmapIndex, maskIndex ); |
|
42 |
|
43 if (AknIconUtils::IsMifFile(fileName)) { |
|
44 AknIconUtils::DisableCompression(bitamp); |
|
45 AknIconUtils::SetSize(bitamp, TSize(size.width(), size.height()), |
|
46 EAspectRatioPreservedAndUnusedSpaceRemoved); |
34 |
47 |
35 if ( AknIconUtils::IsMifFile(fileName)) { |
48 CaBitmapAdapter::fromBitmapAndMaskToPixmapL(bitamp, mask, pixmap); |
36 // SVG icon |
49 } else { |
37 // SVG always has only one icon |
50 CaBitmapAdapter::fromBitmapAndMaskToPixmapL(bitamp, mask, pixmap); |
38 TInt bitmapIndex = 0; |
51 pixmap.scaled(size); |
39 TInt maskIndex = 1; |
52 } |
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 |
53 |
57 // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order |
54 // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order |
58 CleanupStack::Pop(2); |
55 CleanupStack::Pop(2); |
59 } |
56 } |