uiaccelerator_plat/alf_visual_api/inc/alf/alfsymbiansbdrawer.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Symbian screenbuffer drawing IF
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __ALFSYMBIANSBDRAWER_H__
       
    22 #define __ALFSYMBIANSBDRAWER_H__
       
    23 
       
    24 
       
    25 #include "alf/alfscreenbuffer.h"
       
    26 
       
    27 const TUid KAlfSymbianBufferDrawerUid = {0x2000e5a2}; 
       
    28 
       
    29 class CBitmapContext;
       
    30 class CFbsBitmap;
       
    31 
       
    32 /**
       
    33  * The class for drawing screen buffer to a bitmap context.
       
    34  *  
       
    35  * Usage:
       
    36  * @code
       
    37  * 
       
    38  * //Create screen buffer instance
       
    39  * CAlfScreenBuffer* screenBuffer = CAlfScreenBuffer::NewL( *iEnv );
       
    40  * //add the candidate , who has implemented MAlfScreenBufferObserver interface, as observer
       
    41  * 
       
    42  * screenBuffer->AddObserverL( testScreenBufferUid, observer );
       
    43  * 
       
    44  *  //Get symbian bufferdrawer instance
       
    45  * CAlfSymbianBufferDrawer* drawer = ( CAlfSymbianBufferDrawer* )screenBuffer->
       
    46  * 										GetDrawingInterface( SYMBIAN_BUFFER_DRAWER_UID, 
       
    47  * 															 testScreenBufferUid );
       
    48  * 
       
    49  *  // Draw
       
    50  *  CFbsBitGc* context = NULL;
       
    51  *  User::LeaveIfError( device->CreateContext( context ) );
       
    52  *  drawer->DrawBuffer( context, TPoint(), iDisplayRect );
       
    53  * 
       
    54  * 
       
    55  * // release
       
    56  * 	drawer->ReleaseDrawer();
       
    57  * 	drawer = NULL;
       
    58  * 
       
    59  * // Cleanup  
       
    60  * 	drawer->ReleaseDrawer();
       
    61  * 	drawer = NULL;
       
    62  * 	screenBuffer->RemoveObserver( testScreenBufferUid );
       
    63  *  delete screenBuffer;
       
    64  * 
       
    65  * @endcode
       
    66  * 
       
    67  * @see ScreenBuffer::getDrawingInterface()
       
    68  * @lib osnalf.lib
       
    69  * @since S60 xxx
       
    70  */
       
    71 NONSHARABLE_CLASS(CAlfSymbianBufferDrawer) : public CBase, public MAlfBufferDrawer
       
    72     {
       
    73     public:    
       
    74     	/**
       
    75      	 * Draw buffer to the bitmap context.
       
    76      	 *
       
    77      	 * @param aContext Drawing context.
       
    78      	 * @param aPos Position on destination.
       
    79      	 * @param aRect Source rectangle.
       
    80      	 */
       
    81         IMPORT_C void DrawBuffer(CBitmapContext& aContext, const TPoint& aPos, const TRect& aRect);
       
    82         
       
    83     	/**
       
    84      	 * Draw buffer to the bitmap context.
       
    85      	 *
       
    86      	 * @param aContext Drawing context.
       
    87      	 * @param aPos Position on destination.
       
    88      	 * @param aRect Source rectangle.
       
    89      	 */
       
    90         IMPORT_C void DrawBufferMasked(CBitmapContext& aContext, const CFbsBitmap* aMask,const TPoint& aPos, const TRect& aRect);
       
    91                 
       
    92     	/**
       
    93      	 * Get pointers to buffer bitmaps. If the screen buffer is not yet ready, NULL pointers are returned. 
       
    94      	 * This method does not get the ownership of the bitmaps. 
       
    95      	 *
       
    96      	 * @param aBitmap Buffer bitmap.
       
    97      	 * @param aMask Buffer mask.
       
    98      	 */
       
    99    		IMPORT_C void GetBufferBitmaps(CFbsBitmap*& aBitmap, CFbsBitmap*& aMask) const;
       
   100 
       
   101     public: // from MAlfBufferDrawer        
       
   102         IMPORT_C void ReleaseDrawer();
       
   103         
       
   104     protected:    
       
   105     	/**
       
   106      	 * Constuctors and destructor
       
   107      	 */
       
   108         CAlfSymbianBufferDrawer();
       
   109         
       
   110         virtual ~CAlfSymbianBufferDrawer();
       
   111         
       
   112         static CAlfSymbianBufferDrawer* NewL();
       
   113         
       
   114         void ConstructL();
       
   115         
       
   116     	/**
       
   117      	 * Setup for drawing.
       
   118      	 *
       
   119      	 * @param aBitmapHandle Screen buffer bitmap handle.
       
   120      	 * @param aMaskHandle Mask for the bitmap.
       
   121      	 */
       
   122         void SetBufferL(TInt aBitmapHandle, TInt aMaskHandle);
       
   123         
       
   124         
       
   125     private:
       
   126         struct TPrivData;
       
   127         TPrivData* iPrivData;
       
   128         friend class CAlfScreenBuffer;
       
   129     };
       
   130 
       
   131 #endif