uigraphics/AknIcon/srvinc/AknIconSrvUtils.h
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2002 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:  
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef AKN_ICON_SRV_UTILS_H
       
    21 #define AKN_ICON_SRV_UTILS_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <gdi.h>
       
    26 #include "AknIconUtils.h"
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // FUNCTION PROTOTYPES
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class MAknIconFormatHandler;
       
    34 class CAknIconLoader;
       
    35 struct TAknIconParams;
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 * A static utility class.
       
    40 */
       
    41 class AknIconSrvUtils
       
    42     { 
       
    43     public:
       
    44 
       
    45         /**
       
    46         * Loads icon data and initializes icon format handler,
       
    47         * stores Handler in the handler list
       
    48         */
       
    49         static TPtrC8 InitIconDataAndHandlerLC(
       
    50             CAknIconLoader* aLoader,
       
    51             RPointerArray<MAknIconFormatHandler>& aHandlerList,
       
    52             MAknIconFormatHandler*& aHandler,
       
    53             const TAknIconParams& aParams,
       
    54             TBool aAnimated );
       
    55 
       
    56         /**
       
    57         * Loads icon data and initializes icon format handler.
       
    58         */
       
    59         static TPtrC8 InitIconDataAndHandlerLC(
       
    60             CAknIconLoader* aLoader,
       
    61             MAknIconFormatHandler*& aHandler,
       
    62             TInt aIconId,
       
    63             TBool aAnimated );
       
    64 
       
    65         /**
       
    66         * Renders a prepared MIF icon according to the given parameters.
       
    67         * @ret Content dimensions of the icon.
       
    68         */
       
    69         static TAknContentDimensions RenderPreparedIconL(
       
    70             MAknIconFormatHandler& aHandler,
       
    71             CFbsBitmap* aBitmap,
       
    72             CFbsBitmap* aMask, // may be NULL
       
    73             TDisplayMode aBitmapDepth,
       
    74             TDisplayMode aPreferredDepth,
       
    75             const TSize& aSize,
       
    76             TScaleMode aMode,
       
    77             TInt aRotationAngle = 0,
       
    78             TRgb aColor = TRgb(0,0,0),
       
    79             TInt aBitmapId = 0,
       
    80             TInt aMaskId = 0,
       
    81             TBool aIsAppIcon = EFalse);
       
    82 
       
    83         /**
       
    84         * Modifies given size so that the given aspect ratio is preserved.
       
    85         */
       
    86         static void GetAspectRatioPreservedSize(
       
    87             const TAknContentDimensions& aDimensions,
       
    88             TSize& aSize );
       
    89             
       
    90         /**
       
    91         * Modifies given size so that the given aspect ratio is preserved.
       
    92         * This is a version optimised for using integer numbers as
       
    93         * content dimensions.        
       
    94         */
       
    95         static void GetAspectRatioPreservedSize(
       
    96             const TSize& aDimensions,
       
    97             TSize& aSize,
       
    98             TBool aFitToOriginalSize );            
       
    99 
       
   100         /**
       
   101         * Scales bitmap icon.
       
   102         */
       
   103         static TBool ScaleBitmapIconL(
       
   104             const TSize& aSize,
       
   105             const TScaleMode aMode,
       
   106             const TInt aAngle,
       
   107             const TRgb aColor,
       
   108             CFbsBitmap* aSourceBitmap,
       
   109             CFbsBitmap* aSourceMask,
       
   110             CFbsBitmap* aTargetBitmap,
       
   111             CFbsBitmap* aTargetMask );
       
   112 
       
   113 				/**
       
   114         * Checks the transparency on the bitmap and if required scale the bitmap/mask
       
   115         * to give 12% at the bottom of the image/mask bitmap
       
   116         */
       
   117         static void EnsureValidSizeL(
       
   118             CFbsBitmap* aBitmap,
       
   119             CFbsBitmap* aMask );
       
   120         
       
   121         /**
       
   122         * Checks the transparency on the bitmap and returns the valid height possible
       
   123         * on the bitmap. Valid height means 12% of transparent pixel at the bottom
       
   124         */    
       
   125         static TInt CheckMaskTransparencyL(const CFbsBitmap* aBmp);
       
   126         
       
   127         /**
       
   128         * Checks the transparency on the bitmap and returns the valid height possible
       
   129         * on the bitmap. Valid height means 12% of transparent pixel at the bottom
       
   130         */    
       
   131         static TInt CheckAlphaTransparencyL(const CFbsBitmap* aBmp);
       
   132     private: // Private constructor
       
   133         AknIconSrvUtils();
       
   134     };
       
   135 
       
   136 #endif // AKN_ICON_SRV_UTILS_H
       
   137 
       
   138 // Enf of File