camerauis/cameraapp/generic/inc/cambitmapitem.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     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:  Class for rendering bitmap based indicators
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAMBITMAPITEM_H
       
    20 #define CAMBITMAPITEM_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <AknUtils.h>
       
    25 
       
    26 class CFbsBitmap;
       
    27 class TAknTextComponentLayout;
       
    28 class CBitmapContext;
       
    29 
       
    30 /**
       
    31  *  Class for rendering bitmap based indicators on top of viewfinder.
       
    32  *
       
    33  *  CCamBitmapItem can be used to draw bitmaps on the screen in a way
       
    34  *  that is compatible with S60 Posting based overlays. The mask
       
    35  *  is also written in the alpha channel of the screen buffer to allow
       
    36  *  it to be overlaid on top of the viewfinder.
       
    37  *
       
    38  *  @since S60 v5.0
       
    39  */
       
    40 class CCamBitmapItem : public CBase
       
    41     {
       
    42 public:
       
    43     /**
       
    44      * Two-phased constructor for non-skinned bitmaps.
       
    45      */
       
    46     static CCamBitmapItem* NewL(
       
    47             TInt aBitmapId, 
       
    48             TInt aMaskId );
       
    49 
       
    50     /**
       
    51      * Two-phased constructor for skinnable bitmaps.
       
    52      */
       
    53     static CCamBitmapItem* NewL(
       
    54             TInt aBitmapId,
       
    55             TInt aMaskId,
       
    56             const TAknsItemID& aID );
       
    57  
       
    58     /**
       
    59     * Destructor.
       
    60     */
       
    61     virtual ~CCamBitmapItem();
       
    62 
       
    63 public:
       
    64     /**
       
    65      * Set the layout for the item.
       
    66      * 
       
    67      * @since S60 v5.0
       
    68      * @param aParentRect Rectangle for the parent layout item
       
    69      * @param aLayout     A TAknWindowComponentLayout containing the layout
       
    70      *                    details for this item. Usually this can be retrieved
       
    71      *                    using the AknLayout2 API.
       
    72      */
       
    73     void SetLayoutL(
       
    74             const TRect& aParentRect,
       
    75             const TAknWindowComponentLayout& aLayout );
       
    76 
       
    77     /**
       
    78      * Set the layout for the item.
       
    79      * 
       
    80      * @since S60 v5.0
       
    81      */
       
    82     void SetLayoutL(
       
    83             const TRect& aRect );
       
    84     
       
    85     /**
       
    86      * Render this item in a bitmap based graphics context.
       
    87      *
       
    88      * @since S60 v5.0
       
    89      * @param aBitmapContext Graphics context to draw into.
       
    90      */
       
    91     void Draw( CBitmapContext& aBitmapContext ) const;
       
    92 
       
    93     /**
       
    94      * Render a part of this item in a bitmap based graphics context.
       
    95      *
       
    96      * @since S60 v5.0
       
    97      * @param aBitmapContext Graphics context to draw into.
       
    98 	 * @param aDestRect 	 Destination rect on the context
       
    99      * @param aCropRect      Crop rectangle specifying which part of the
       
   100      *                       bitmap should be drawn.
       
   101      */
       
   102     void DrawPartial( 
       
   103             CBitmapContext& aBitmapContext,
       
   104             const TRect& aDestRect,
       
   105             const TRect& aCropRect ) const;
       
   106 
       
   107     /**
       
   108      * Get the size of the bitmap in pixels.
       
   109      * 
       
   110      * @return Bitmap size in pixels (or size from layout if bitmap not
       
   111      *         available).
       
   112      */
       
   113     TSize BitmapSize() const;
       
   114     
       
   115     /**
       
   116      * Get the layout rect of the bitmap in pixels.
       
   117      * 
       
   118      * @return Layout Ret in pixels
       
   119      */    
       
   120     TRect LayoutRect() const;
       
   121     
       
   122 private:
       
   123     
       
   124     CCamBitmapItem();
       
   125 
       
   126     void ConstructL(
       
   127             TInt aBitmapId,
       
   128             TInt aMaskId );
       
   129 
       
   130     void ConstructL(
       
   131             TInt aBitmapId,
       
   132             TInt aMaskId,
       
   133             const TAknsItemID& aID );
       
   134 
       
   135 private: // data
       
   136 
       
   137     // own
       
   138     CFbsBitmap* iBitmap;
       
   139 
       
   140     // own
       
   141     CFbsBitmap* iMask;
       
   142 
       
   143     TRect iRect;
       
   144 
       
   145     TBool iScalableIcon;
       
   146     };
       
   147 
       
   148 #endif // CAMTEXTITEM_H