imagehandlinglib/Src/CIHLBitmap.h
changeset 0 2014ca87e772
equal deleted inserted replaced
-1:000000000000 0:2014ca87e772
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Default implementation of bitmap class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CIHLBITMAP_H
       
    20 #define CIHLBITMAP_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <MIHLBitmap.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 // CLASS DECLARATION
       
    27 /**
       
    28 *  CIHLBitmap
       
    29 *
       
    30 *  Default implementation of bitmap class.
       
    31 *  @lib IHL.lib
       
    32 *  @since 3.0
       
    33 */
       
    34 NONSHARABLE_CLASS( CIHLBitmap ) : public CBase, public MIHLBitmap
       
    35 	{
       
    36     public:  // Constructors and destructor
       
    37 
       
    38         /**
       
    39         * Two-phased constructors
       
    40         */
       
    41         static CIHLBitmap* NewL();
       
    42 		
       
    43         /**
       
    44         * Virtual destructor.
       
    45         */
       
    46         virtual ~CIHLBitmap();
       
    47 
       
    48 	public: // From base class MIHLBitmap
       
    49 
       
    50         /**
       
    51         * From MIHLBitmap, see base class header.
       
    52         */
       
    53 		TInt Create( const TSize& aSize, TDisplayMode aDisplayMode );
       
    54 
       
    55         /**
       
    56         * From MIHLBitmap, see base class header.
       
    57         */
       
    58 		TInt Create( const TSize& aSize, TDisplayMode aBitmapDisplayMode,
       
    59 										 TDisplayMode aMaskDisplayMode );
       
    60 
       
    61         /**
       
    62         * From MIHLBitmap, see base class header.
       
    63         */
       
    64 		TInt Copy( const CFbsBitmap& aBitmap, TBool aDuplicate );
       
    65 
       
    66         /**
       
    67         * From MIHLBitmap, see base class header.
       
    68         */
       
    69 		TInt Copy( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask, TBool aDuplicate );
       
    70 
       
    71         /**
       
    72         * From MIHLBitmap, see base class header.
       
    73         */
       
    74 		TInt Copy( const MIHLBitmap& aBitmap, TBool aDuplicate );
       
    75 
       
    76         /**
       
    77         * From MIHLBitmap, see base class header.
       
    78         */
       
    79 		void Reset();
       
    80 
       
    81         /**
       
    82         * From MIHLBitmap, see base class header.
       
    83         */
       
    84 		TBool IsCreated() const;
       
    85 
       
    86         /**
       
    87         * From MIHLBitmap, see base class header.
       
    88         */
       
    89 		const CFbsBitmap& Bitmap() const;
       
    90 
       
    91         /**
       
    92         * From MIHLBitmap, see base class header.
       
    93         */
       
    94 		TBool HasMask() const;
       
    95 
       
    96         /**
       
    97         * From MIHLBitmap, see base class header.
       
    98         */
       
    99 		const CFbsBitmap& Mask() const;
       
   100 
       
   101         /**
       
   102         * From MIHLBitmap, see base class header.
       
   103         */
       
   104 		void Draw( CBitmapContext& aContext, const TPoint& aPoint ) const;
       
   105 
       
   106         /**
       
   107         * From MIHLBitmap, see base class header.
       
   108         */
       
   109 		void Draw( CBitmapContext& aContext, const TPoint& aPoint, const TRect& aSourceRect ) const;
       
   110 
       
   111 	public: // Internal interface
       
   112 
       
   113         /**
       
   114         * Non-const bitmap reference.
       
   115         * @since 3.0
       
   116 		* @return Non-const bitmap reference.
       
   117 		*/
       
   118 		CFbsBitmap& BitmapModifyable();
       
   119 
       
   120         /**
       
   121         * Non-const bitmap reference.
       
   122         * @since 3.0
       
   123 		* @return Non-const bitmap reference.
       
   124 		*/
       
   125 		CFbsBitmap& MaskModifyable();
       
   126 
       
   127         /**
       
   128         * Set editor pointer. This information is used
       
   129 		* internally to detect what class has made changes to bitmap data.
       
   130         * @since 3.0
       
   131 		* @param aEditorPtr Editor pointer
       
   132 		*/
       
   133 		void SetEditorPtr( const TAny* aEditorPtr );
       
   134 
       
   135         /**
       
   136         * Set editor value. Meaning of this value may vary depending
       
   137 		* on type of editor class.
       
   138         * @since 3.0
       
   139 		* @param aEditorValue Editor custom value 
       
   140 		*/
       
   141 		void SetEditorValue( TInt aEditorValue );
       
   142 
       
   143         /**
       
   144         * Return Editor pointer. NULL if just created or reseted.
       
   145 		* @return Editor pointer.
       
   146 		*/
       
   147 		const TAny* EditorPtr() const;
       
   148 
       
   149         /**
       
   150         * Return editor value.
       
   151         * @since 3.0
       
   152 		* @return Editor custom value.
       
   153 		*/
       
   154 		TInt EditorValue() const;
       
   155 
       
   156 	public: // Private methods
       
   157 
       
   158 		TInt CopyBitmap( const CFbsBitmap& aSource, CFbsBitmap& aDestination );
       
   159 
       
   160 		TInt CopyBitmapData( const CFbsBitmap& aSource, CFbsBitmap& aDestination,
       
   161 							 const TSize& aSize, const TDisplayMode& aDisplayMode );
       
   162 
       
   163 	private: // Private constructors
       
   164 
       
   165         CIHLBitmap();
       
   166 		void ConstructL();
       
   167 
       
   168     private: // Data
       
   169 
       
   170 		// Own: Bitmap pointers
       
   171 		CFbsBitmap* iBitmap;
       
   172 		CFbsBitmap* iMask;
       
   173 
       
   174 		// Ref: Editor ptr
       
   175 		const TAny* iEditorPtr;
       
   176 
       
   177 		// Editor value
       
   178 		TInt iEditorValue;
       
   179 		
       
   180 	};
       
   181 
       
   182 #endif // CIHLBITMAP_H
       
   183 
       
   184 // End of File