imagehandling_plat/image_handling_library_api/inc/MIHLBitmap.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:  Pure virtual interface to bitmap and mask container.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MIHLBITMAP_H
       
    20 #define MIHLBITMAP_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <gdi.h>
       
    24 
       
    25 // FORWARD DECLARATION
       
    26 class MIHLBitmap;
       
    27 class CBitmapContext;
       
    28 class CFbsBitmap;
       
    29 
       
    30 
       
    31 // FACTORY DECLARATION
       
    32 class IHLBitmap
       
    33     {
       
    34     public:
       
    35 
       
    36         /**
       
    37         * Create new MIHLBitmap instance.
       
    38         * @since 3.0
       
    39 		* @return New default MIHLBitmap instance.
       
    40 		*/
       
    41         IMPORT_C static MIHLBitmap* CreateL();
       
    42 
       
    43 	};
       
    44 
       
    45 // CLASS DECLARATION
       
    46 /**
       
    47 *  MIHLBitmap
       
    48 *
       
    49 *  Pure virtual interface to bitmap and mask container.
       
    50 *
       
    51 *  If interface needs to be pushed into CleanupStack,
       
    52 *  remember to use CleanupStackDeletePushL() function!
       
    53 *  DO NOT USE CleanupStack::PushL()!!
       
    54 *
       
    55 *  @lib IHL.lib
       
    56 *  @since 3.0
       
    57 */
       
    58 class MIHLBitmap
       
    59 	{
       
    60 	public:
       
    61 
       
    62         /**
       
    63         * Virtual destructor.
       
    64 		*/
       
    65 		virtual ~MIHLBitmap() {}
       
    66 
       
    67     public:
       
    68 
       
    69         /**
       
    70         * Create new bitmap.
       
    71         * @since 3.0
       
    72 		* @param aSize Bitmap size.
       
    73 		* @param aDisplayMode Bitmap displaymode.
       
    74 		* @return KErrArgument if size is negative or displaymode is not supported.
       
    75 		*         Otherwise system wide error codes.
       
    76         */
       
    77 		virtual TInt Create( const TSize& aSize, TDisplayMode aDisplayMode ) = 0;
       
    78 
       
    79         /**
       
    80         * Create new bitmap and mask.
       
    81         * @since 3.0
       
    82 		* @param aSize Bitmap and mask size.
       
    83 		* @param aBitmapDisplayMode Bitmap displaymode.
       
    84 		* @param aMaskDisplayMode Mask displaymode (EGray2 or EGray256)
       
    85 		* @return KErrArgument if size is negative or displaymode is not supported.
       
    86 		*         Otherwise system wide error codes.
       
    87         */
       
    88 		virtual TInt Create( const TSize& aSize, TDisplayMode aBitmapDisplayMode,
       
    89 												 TDisplayMode aMaskDisplayMode ) = 0;
       
    90 
       
    91         /**
       
    92         * Copy or duplicate bitmap.
       
    93 		* Copied bitmap has unique server handle and it can be
       
    94 		* modified without risk of changes in given source bitmap.
       
    95 		* Duplicated bitmap has same server handle than source bitmap
       
    96 		* and modifying duplicated bitmap will also modify source bitmap.
       
    97         * @since 3.0
       
    98 		* @param aBitmap Source bitmap that is copied or duplicated.
       
    99 		* @param aDuplicate ETrue to duplicate, EFalse to copy.
       
   100 		* @return System wide error codes.
       
   101         */
       
   102 		virtual TInt Copy( const CFbsBitmap& aBitmap, TBool aDuplicate ) = 0;
       
   103 
       
   104         /**
       
   105         * Copy or duplicate bitmap and mask.
       
   106 		* Copied bitmaps has unique server handles and they can be
       
   107 		* modified without risk of changes in given source bitmaps.
       
   108 		* Duplicated bitmaps has same server handles than source bitmaps
       
   109 		* and modifying duplicated bitmaps will also modify source bitmaps.
       
   110         * @since 3.0
       
   111 		* @param aBitmap Source bitmap that is copied or duplicated.
       
   112 		* @param aBitmap Source aMask that is copied or duplicated.
       
   113 		* @param aDuplicate ETrue to duplicate, EFalse to copy.
       
   114 		* @return System wide error codes.
       
   115         */
       
   116 		virtual TInt Copy( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask, TBool aDuplicate ) = 0;
       
   117 
       
   118         /**
       
   119         * Copy or duplicate MIHLBitmap.
       
   120 		* Copied bitmaps has unique server handles and they can be
       
   121 		* modified without risk of changes in given source bitmaps.
       
   122 		* Duplicated bitmaps has same server handles than source bitmaps
       
   123 		* and modifying duplicated bitmaps will also modify source bitmaps.
       
   124         * @since 3.0
       
   125 		* @param aBitmap Source MIHLBitmap that is copied or duplicated.
       
   126 		* @param aDuplicate ETrue to duplicate, EFalse to copy.
       
   127 		* @return System wide error codes.
       
   128         */
       
   129 		virtual TInt Copy( const MIHLBitmap& aBitmap, TBool aDuplicate ) = 0;
       
   130 
       
   131         /**
       
   132         * Release bitmap and mask server handles.
       
   133 		* Create() and Copy() methods will call this
       
   134 		* automatically if any old bitmaps exist.
       
   135         * @since 3.0
       
   136         */
       
   137 		virtual void Reset() = 0;
       
   138 
       
   139         /**
       
   140         * Check if bitmap is created or copied.
       
   141 		* This checks that bitmap handle is valid and exist.
       
   142         * @since 3.0
       
   143 		* @return ETrue if bitmap exist, EFalse if bitmap handle is zero.
       
   144         */
       
   145 		virtual TBool IsCreated() const = 0;
       
   146 
       
   147         /**
       
   148         * Return bitmap reference.
       
   149 		* Use MIHLBitmap::IsCreated() method
       
   150 		* to check if bitmap actually exist.
       
   151         * @since 3.0
       
   152 		* @return Reference to bitmap.
       
   153         */
       
   154 		virtual const CFbsBitmap& Bitmap() const = 0;
       
   155 
       
   156         /**
       
   157         * Check if mask bitmap handle is valid and exist.
       
   158         * @since 3.0
       
   159 		* @return ETrue if mask exist, EFalse if mask handle is zero.
       
   160         */
       
   161 		virtual TBool HasMask() const = 0;
       
   162 
       
   163         /**
       
   164         * Return mask reference.
       
   165 		* Use MIHLBitmap::HasMask() method
       
   166 		* to check if mask actually exist.
       
   167         * @since 3.0
       
   168 		* @return Reference to mask.
       
   169         */
       
   170 		virtual const CFbsBitmap& Mask() const = 0;
       
   171 
       
   172        /**
       
   173         * Draw bitmap to bitmap context.
       
   174 		* If bitmaps are not created, method does nothing.
       
   175 		* @param aContext Bitmap context where bitmap is drawn.
       
   176 		* @param aPoint Draw position.
       
   177         * @since 3.0
       
   178         */
       
   179 		virtual void Draw( CBitmapContext& aContext, const TPoint& aPoint ) const = 0;
       
   180 
       
   181         /**
       
   182         * Draw bitmap to bitmap context.
       
   183 		* If bitmaps are not created, method does nothing.
       
   184 		* @param aContext Bitmap context where bitmap is drawn.
       
   185 		* @param aPoint Draw position.
       
   186 		* @param aSourceRect Source rectangle that is drawn.
       
   187         * @since 3.0
       
   188         */
       
   189 		virtual void Draw( CBitmapContext& aContext, const TPoint& aPoint,
       
   190                            const TRect& aSourceRect ) const = 0;
       
   191 
       
   192 	};
       
   193 
       
   194 #endif   // MIHLBITMAP_H
       
   195 
       
   196 // End of File