javauis/lcdui_akn/lcdgr/inc/LcdImage.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2005 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef LCDIMAGE_H
       
    19 #define LCDIMAGE_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <fbs.h>
       
    23 
       
    24 #include <lcdgdrv.h>
       
    25 
       
    26 #include "fbslcdgraphics.h" // for TDrawRegion.
       
    27 
       
    28 class TAcceleratedBitmapInfo;
       
    29 class TBitmapLockCount;
       
    30 class CLcdFbsImage;
       
    31 
       
    32 /**
       
    33  * MIDP LCDUI Image peer
       
    34  */
       
    35 NONSHARABLE_CLASS(CLcdImage) : public CBase
       
    36 {
       
    37 public:
       
    38     /**
       
    39      *
       
    40      */
       
    41     CLcdImage(CLcdGraphicsDriver& aDriver, TBool aMutable);
       
    42 
       
    43     /**
       
    44      *
       
    45      */
       
    46     ~CLcdImage();
       
    47 
       
    48     /**
       
    49      * 2nd phase constructor for blank (white) images.
       
    50      */
       
    51     void ConstructL(const TSize& aSize, const TImageType& aImageType);
       
    52 
       
    53     /**
       
    54      * 2nd phase constructor from bitmaps.
       
    55      *
       
    56      * Where possible (bitmaps match aImageType ) makes a shallow copy (Duplicate) of aColorBitmap
       
    57      * and optional aAlphaBitmap, otherwise makes a deep copy converting to aImageType.
       
    58      */
       
    59     void ConstructL(CFbsBitmap* aColorBitmap, CFbsBitmap* aAlphaBitmap, const TImageType& aImageType);
       
    60 
       
    61     TSize Size() const;
       
    62     TTransparency Transparency() const;
       
    63 
       
    64     /**
       
    65      *
       
    66      */
       
    67     void Lock(TBitmapLockCount& aLockCount, TAcceleratedBitmapInfo& aColorBitmap, TAcceleratedBitmapInfo& aAlphaBitmap) const;
       
    68 
       
    69     /**
       
    70      *
       
    71      */
       
    72     void Unlock(TBitmapLockCount& aLockCount) const;
       
    73 
       
    74     /**
       
    75      *
       
    76      */
       
    77     void SetPixels(const TRect& aRect, const TUint32* aARGBArray, TInt aLength, TInt aOffset, TInt aLinePitch, const TSize& aSize, TBool aProcessAlpha);
       
    78 
       
    79     /**
       
    80      *
       
    81      */
       
    82     void GetPixels(const TRect& aRect, TUint32* aARGBArray, TInt aLength, TInt aOffset, TInt aLinePitch, const TSize& aSize);
       
    83 
       
    84     /**
       
    85      * Copy a region of pixels from aSourceImage applying a transformation.
       
    86      */
       
    87     void CopyRegion(CLcdImage& aSourceImage, const TDrawRegion&, const TRect& aClipRect);
       
    88 
       
    89     /**
       
    90     Detect pixel level collision between two Images.
       
    91     @param aRect1       image1 collison rect in image1 co-ordinates
       
    92     @param aTransform1  image1 transform
       
    93     @param aPoint1      position of image1 collison rect in painter's co-ordinates.
       
    94 
       
    95     @param aImage2      image2
       
    96     @param aRect2       image2 collison rect in image2 co-ordinates
       
    97     @param aTransform2  image2 transform
       
    98     @param aPoint2      position of image2 collison rect in painter's co-ordinates.
       
    99     */
       
   100     TBool DetectCollision(const TRect& aRect1, TInt aTransform1, const TPoint& aPoint1,
       
   101                           const CLcdImage& aImage2,
       
   102                           const TRect& aRect2, TInt aTransform2, const TPoint& aPoint2);
       
   103 
       
   104     //
       
   105     // Consider drawing surface accessor instead.
       
   106     //
       
   107     TBool Mutable();
       
   108 
       
   109     /**
       
   110      * Change image type - may be used to allow mutable images to contain tranparent pixels.
       
   111      */
       
   112     TInt SetImageType(const TImageType& aType);
       
   113 
       
   114     //
       
   115     // Temporary.
       
   116     //
       
   117     CLcdFbsImage* FbsImage();
       
   118 
       
   119 private:
       
   120     CLcdGraphicsDriver& iDriver;
       
   121     CLcdFbsImage*       iFbsImage;
       
   122     TTransparency       iTransparency;
       
   123     TBool               iMutable;
       
   124 };
       
   125 
       
   126 #endif // LCDIMAGE_H