|
1 /* |
|
2 * Copyright (c) 2003 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: NvgIconHeader header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _NVGICONHEADER_H_ |
|
20 #define _NVGICONHEADER_H_ |
|
21 |
|
22 #include <e32std.h> |
|
23 |
|
24 /** |
|
25 * TNVGHeaderData |
|
26 * |
|
27 * Datastructure to hold NVG Icon Header information |
|
28 */ |
|
29 struct TNVGHeaderData // be aware of padding! |
|
30 { |
|
31 TUint16 sign; |
|
32 TUint8 version; |
|
33 TUint8 headerSize; |
|
34 TUint32 reserved1; |
|
35 TUint16 reserved2; |
|
36 TUint8 reserved3; |
|
37 TUint8 reserved4:4; // flag |
|
38 TUint8 isMarginCorrection:1; // flag |
|
39 TUint8 isMask:1; // flag |
|
40 TUint8 aspectRatio:2; // flag |
|
41 TInt32 rotation; |
|
42 TInt32 iconColor; |
|
43 TInt32 bitmapid; |
|
44 }; |
|
45 |
|
46 |
|
47 |
|
48 // CONSTANTS |
|
49 static const TInt KIconHeaderLength = sizeof(TNVGHeaderData); |
|
50 |
|
51 // FIXME: find an appropriate place for me. |
|
52 |
|
53 /** |
|
54 * Class TNVGIconHeader |
|
55 * |
|
56 * Class to hold NVG Icon Header information & operations |
|
57 */ |
|
58 class TNVGIconHeader |
|
59 { |
|
60 |
|
61 public: |
|
62 /** |
|
63 * Constructor |
|
64 * |
|
65 * @param aData Descriptor to store the icon header data |
|
66 */ |
|
67 inline TNVGIconHeader(TDes8 &aData) |
|
68 { |
|
69 __ASSERT_ALWAYS(aData.Length() >= KIconHeaderLength, User::Panic(_L("not sufficient size"), KErrBadDescriptor)); |
|
70 iHeader = (TNVGHeaderData *)(aData.LeftTPtr(KIconHeaderLength).Ptr()); |
|
71 } |
|
72 |
|
73 /** |
|
74 * Initializes icon header before writing any data |
|
75 * |
|
76 * @param None |
|
77 */ |
|
78 inline void Initialize() |
|
79 { |
|
80 Mem::FillZ(iHeader,KIconHeaderLength); |
|
81 iHeader->headerSize = KIconHeaderLength; |
|
82 } |
|
83 |
|
84 |
|
85 /** |
|
86 * Set the mask flag in icon header |
|
87 * |
|
88 * @param isMask Flag to turn mask on/off |
|
89 */ |
|
90 inline void SetIsMask(TBool isMask) |
|
91 { |
|
92 iHeader->isMask = isMask; |
|
93 } |
|
94 |
|
95 /** |
|
96 * Get the mask flag from icon header |
|
97 * |
|
98 * @param None |
|
99 */ |
|
100 inline TBool IsMask() const |
|
101 { |
|
102 return iHeader->isMask; |
|
103 } |
|
104 |
|
105 private: |
|
106 |
|
107 TNVGHeaderData *iHeader; |
|
108 }; |
|
109 |
|
110 #endif |
|
111 |