javauis/m2g_qt/inc/M2GUtils.h
changeset 87 1627c337e51e
parent 80 d6dafc5d983f
equal deleted inserted replaced
80:d6dafc5d983f 87:1627c337e51e
     1 /*
     1 /*
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    22 #include <gdi.h> // DisplayMode, Draw, BitBlt
    22 #include <gdi.h> // DisplayMode, Draw, BitBlt
    23 #include <fbs.h> // CFbsBitmap
    23 #include <fbs.h> // CFbsBitmap
    24 #include "M2GGeneral.h"
    24 #include "M2GGeneral.h"
    25 #include <QPixmap>
    25 #include <QPixmap>
    26 #include <jni.h>
    26 #include <jni.h>
       
    27 #include "CSynchronization.h" //For UI Thread Execution.
    27 M2G_NS_START
    28 M2G_NS_START
    28 
    29 
    29 // CONSTANTS
    30 // CONSTANTS
    30 
    31 
    31 // DATA TYPES
    32 // DATA TYPES
    32 
    33 
    33 // MACROS
    34 // MACROS
    34 
    35 
       
    36 
       
    37 /*!
       
    38  * \brief Macros for serializing m2gcore function calls
       
    39  * in native threading environment.
       
    40  */
       
    41 
       
    42 #define M2G_DO_LOCK CSynchronization::InstanceL()->Lock();
       
    43 
       
    44 #define M2G_DO_UNLOCK(aEnv) {\
       
    45                     TInt errorCode = CSynchronization::InstanceL()->GetErrorCode();\
       
    46                     if ( errorCode != 0){\
       
    47                             M2GGeneral::CheckErrorCode(aEnv,errorCode);\
       
    48                     }\
       
    49                     CSynchronization::InstanceL()->Unlock();\
       
    50                     }\
       
    51  
    35 // FORWARD DECLARATIONS
    52 // FORWARD DECLARATIONS
    36 class CFbsBitmapDevice;
    53 class CFbsBitmapDevice;
    37 class CFbsBitGc;
    54 class CFbsBitGc;
    38 
    55 
    39 // FUNCTION PROTOTYPES
    56 // FUNCTION PROTOTYPES
    40 
    57 
    41 // CLASS DECLARATION
    58 // CLASS DECLARATION
    42 
       
    43 
       
    44 //For UI Thread Execution.
       
    45 #include "CSynchronization.h"
       
    46 
       
    47 #define M2G_DO_LOCK CSynchronization::InstanceL()->Lock();
       
    48 
       
    49 
       
    50 //TODO Have to Raise Exception in case we find any error.
       
    51 #define M2G_DO_UNLOCK(aEnv) {\
       
    52                     TInt errorCode = CSynchronization::InstanceL()->GetErrorCode();\
       
    53                     CSynchronization::InstanceL()->Unlock();\
       
    54                     }\
       
    55 
    59 
    56 /**
    60 /**
    57  * @class M2GBitmapUtils
    61  * @class M2GBitmapUtils
    58  * @brief Static methods for alpha blending and bitmaps
    62  * @brief Static methods for alpha blending and bitmaps
    59  */
    63  */
    82                        const TPoint& aPoint,
    86                        const TPoint& aPoint,
    83                        const TRect* aRect,
    87                        const TRect* aRect,
    84                        const CFbsBitmap* aSourceMask,
    88                        const CFbsBitmap* aSourceMask,
    85                        /*MSwtClient* aClientHandle,*/
    89                        /*MSwtClient* aClientHandle,*/
    86                        TBool aUseNativeClear = EFalse);
    90                        TBool aUseNativeClear = EFalse);
    87     
    91 
    88     static TInt BitQBlt(QImage& aTargetQimage,
    92     static TInt BitQBlt(QImage& aTargetQimage,
    89                                 const QImage& aSourceQimage,
    93                         const QImage& aSourceQimage,
    90                                 const TPoint& aPoint,
    94                         const TPoint& aPoint,
    91                                 const TRect* aRect,
    95                         const TRect* aRect,
    92                                 const CFbsBitmap* aSourceMask);
    96                         const CFbsBitmap* aSourceMask);
    93     
    97 
    94     /**
    98     /**
    95      * Checks if two bitmap are equal.
    99      * Checks if two bitmap are equal.
    96      * @since Series S60 3.0
   100      * @since Series S60 3.0
    97      * @param aLhs Left side bitmap
   101      * @param aLhs Left side bitmap
    98      * @param aRhs Right side bitmap
   102      * @param aRhs Right side bitmap