|
1 /* |
|
2 * Copyright (c) 2005-2008 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: Expands basic effect set. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSRLEXPAND_H |
|
20 #define AKNSRLEXPAND_H |
|
21 |
|
22 // CONSTANTS |
|
23 enum TAknsRlScanIndex |
|
24 { |
|
25 AknsRlIA = 0, // Index for A |
|
26 AknsRlIB = 1, // Index for B |
|
27 AknsRlIMA = 2, // Index for mask A |
|
28 AknsRlIMB = 3 // Index for mask B |
|
29 }; |
|
30 |
|
31 // FUNCTIONS |
|
32 template<class T> |
|
33 void BitmapData( const CFbsBitmap& aBitmap, TInt aWidth, T*& aPtr, TInt& aPitch ) |
|
34 { |
|
35 |
|
36 aPtr = reinterpret_cast<T*>(aBitmap.DataAddress()); |
|
37 // ScanLineLength returns bytes |
|
38 TInt scanW = CFbsBitmap::ScanLineLength( aWidth, aBitmap.DisplayMode()) / sizeof(T); |
|
39 aPitch = scanW - aWidth; |
|
40 } |
|
41 |
|
42 /** |
|
43 * CleanupStack item to unlock bitmap heap in leave situations. |
|
44 */ |
|
45 static void AknsRlLockCleanup( TAny* aItem ) |
|
46 { |
|
47 CFbsBitmap* bmp = static_cast<CFbsBitmap*>( aItem ); |
|
48 bmp->UnlockHeap( ETrue ); |
|
49 } |
|
50 |
|
51 // CLASS DECLARATION(S) |
|
52 /** |
|
53 * Used for accessing constant color scanlines and bitmap scanlines via the same |
|
54 * interface. Memory is allocated to constant color scanlines, bitmap data is |
|
55 * only referenced. |
|
56 */ |
|
57 NONSHARABLE_CLASS( CAknsRlScanline ) |
|
58 { |
|
59 friend class CAknsRlScanlines; |
|
60 |
|
61 private: |
|
62 CAknsRlScanline(); |
|
63 ~CAknsRlScanline(); |
|
64 |
|
65 void DeleteMem(); |
|
66 TUint32 BytesToDwords( TUint32 aBytes ) const; |
|
67 void AllocateL( TUint32 aDwords ); |
|
68 |
|
69 void Color8L( TInt aWidth, TUint8 aValue ); |
|
70 void Color16L( TInt aWidth, TUint16 aValue ); |
|
71 void Color32L( TInt aWidth, TUint32 aValue ); |
|
72 |
|
73 void Bitmap8L( TInt aWidth, const CFbsBitmap& aBitmap ); |
|
74 void Bitmap16L( TInt aWidth, const CFbsBitmap& aBitmap ); |
|
75 void Bitmap32L( TInt aWidth, const CFbsBitmap& aBitmap ); |
|
76 |
|
77 private: |
|
78 TUint32 iSize; // In bytes |
|
79 TInt iPitch; |
|
80 TBool iMemOwned; |
|
81 TUint32* iMem32; |
|
82 }; |
|
83 |
|
84 /** |
|
85 * Scanline cache for RgbA, MaskA, RgbB, MaskB layers. |
|
86 */ |
|
87 NONSHARABLE_CLASS( CAknsRlScanlines ): public CBase |
|
88 { |
|
89 private: |
|
90 CAknsRlScanlines(); |
|
91 |
|
92 public: |
|
93 static CAknsRlScanlines* NewL(); |
|
94 ~CAknsRlScanlines(); |
|
95 |
|
96 inline void Config8L( TAknsRlScanIndex aScan, TUint32 aWidth, TUint8 aValue ); |
|
97 inline void Config16L( TAknsRlScanIndex aScan, TUint32 aWidth, TUint16 aValue ); |
|
98 inline void Config32L( TAknsRlScanIndex aScan, TUint32 aWidth, TUint32 aValue ); |
|
99 |
|
100 inline void Config8L( TAknsRlScanIndex aScan, TInt aWidth, const CFbsBitmap& aBitmap ); |
|
101 inline void Config16L( TAknsRlScanIndex aScan, TInt aWidth, const CFbsBitmap& aBitmap ); |
|
102 inline void Config32L( TAknsRlScanIndex aScan, TInt aWidth, const CFbsBitmap& aBitmap ); |
|
103 |
|
104 inline TUint8* Mem8( TAknsRlScanIndex aScan ) const; |
|
105 inline TUint16* Mem16( TAknsRlScanIndex aScan ) const; |
|
106 inline TUint32* Mem32( TAknsRlScanIndex aScan ) const; |
|
107 |
|
108 inline TInt Pitch( TAknsRlScanIndex aScan ) const; |
|
109 |
|
110 private: |
|
111 CAknsRlScanline iScans[4]; |
|
112 }; |
|
113 |
|
114 // INLINED MEMBERS |
|
115 #include "AknsRlExpand.inl" |
|
116 |
|
117 #endif // AKNSRLEXPAND_H |