|
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 |
|
19 #ifndef LCDFBSIMAGECACHE_H |
|
20 #define LCDFBSIMAGECACHE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <gdi.h> |
|
24 #include <fbs.h> |
|
25 #include <lcdgr.h> |
|
26 #include <lcdgdrv.h> |
|
27 #include "LcdFbsImage.h" |
|
28 |
|
29 struct TLcdFbsImageEntry |
|
30 { |
|
31 MMIDImage* iImage; |
|
32 TBool iPrimary; |
|
33 TDisplayMode iColorMode; |
|
34 TDisplayMode iAlphaMode; |
|
35 TBool iInvertMask; |
|
36 MMIDBitmapImage* iBitmapRep; |
|
37 }; |
|
38 |
|
39 /** |
|
40 * |
|
41 */ |
|
42 NONSHARABLE_CLASS(CLcdFbsImageCache) : public CBase |
|
43 { |
|
44 public: |
|
45 static CLcdFbsImageCache* NewL(CLcdGraphicsDriver& aDriver, TDisplayMode aDefaultColorMode, TDisplayMode aDefaultAlphaMode, TBool aDefaultInverted); |
|
46 CLcdFbsImageCache(CLcdGraphicsDriver& aDriver); |
|
47 ~CLcdFbsImageCache(); |
|
48 |
|
49 |
|
50 /** |
|
51 * Find the primary bitmap image representation of aImage. |
|
52 * |
|
53 *@return a bitmap image or NULL if no appropriate bitmap representation of aImage exists. |
|
54 */ |
|
55 MMIDBitmapImage* GetBitmapImage(MMIDImage* aImage); |
|
56 |
|
57 /** |
|
58 * Find a bitmap image representation of aImage with color bitmap in displaymode aColorMode, and alpha |
|
59 * bitmap (if present) in displaymode aAlphaMode. If aColorMode or aAlphaMode are equal to |
|
60 * MMIDBitmapImage::EDefaultDisplayMode, then the implementation will select a mode based on the image |
|
61 * pixel format. |
|
62 * |
|
63 *@return a bitmap image or NULL if no appropriate bitmap representation of aImage exists. |
|
64 */ |
|
65 MMIDBitmapImage* GetBitmapImage |
|
66 ( |
|
67 MMIDImage* aImage, |
|
68 TInt aColorMode, |
|
69 TInt aAlphaMode, |
|
70 TBool aInvertMask |
|
71 ); |
|
72 |
|
73 /** |
|
74 * Find or create a bitmap image representation of aImage with a color bitmap in displaymode aColorMode and |
|
75 * alpha bitmap (if present) in displaymode aAlphaMode. |
|
76 * |
|
77 *@return a bitmap image representation. |
|
78 * |
|
79 * Will leave with one of the system error codes if a bitmap representation does not exist and one cannot |
|
80 * be created. |
|
81 */ |
|
82 MMIDBitmapImage* GetBitmapImageL |
|
83 ( |
|
84 MMIDImage* aImage, |
|
85 TInt aColorMode=MMIDBitmapImage::EDefaultDisplayMode, |
|
86 TInt aAlphaMode=MMIDBitmapImage::EDefaultDisplayMode, |
|
87 TBool aInvertMask=EFalse |
|
88 ); |
|
89 |
|
90 void RegisterL(MMIDImage* aImage, TBool aInverted, MMIDBitmapImage* aImageRep); |
|
91 void Purge(MMIDImage* aImage); |
|
92 |
|
93 private: |
|
94 MMIDBitmapImage* CreateBitmapImageRepLC(MMIDImage& aImage, TDisplayMode aColorMode, TDisplayMode aAlphaMode, TBool aInvertMask); |
|
95 void RemoveEntry(TInt); |
|
96 |
|
97 private: |
|
98 CLcdGraphicsDriver& iDriver; |
|
99 TDisplayMode iDefaultColorMode; |
|
100 TDisplayMode iDefaultAlphaMode; |
|
101 TBool iDefaultInverted; |
|
102 RArray<TLcdFbsImageEntry> iEntries; |
|
103 TLinearOrder<TLcdFbsImageEntry> iOrder; |
|
104 }; |
|
105 |
|
106 #endif // LCDFBSIMAGECACHE_H |