|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Declares the MHuiTexture interface. MHuiTexture is the most |
|
15 * generic interface that all textures need to implement. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __HUITEXTUREIF_H__ |
|
22 #define __HUITEXTUREIF_H__ |
|
23 |
|
24 |
|
25 /* Forward declarations. */ |
|
26 class MHuiSegmentedTexture; |
|
27 class MHuiShadowedTexture; |
|
28 |
|
29 |
|
30 /** Data buffer formats for uploading textures. */ |
|
31 enum THuiTextureFormat |
|
32 { |
|
33 /** RGB, 5-6-5 bits per channel. */ |
|
34 EHuiTextureFormatRgb565, |
|
35 |
|
36 /** RGB, 8 bits per channel. */ |
|
37 EHuiTextureFormatRgb888, |
|
38 |
|
39 /** RGBA, 8 bits per channel. */ |
|
40 EHuiTextureFormatRgba8888, |
|
41 |
|
42 /** Luminance + Alpha, 8 bits per channel. */ |
|
43 EHuiTextureFormatLa88, |
|
44 |
|
45 /** RGB, PVRTC 4 bpp. */ |
|
46 EHuiTextureFormatRgbPVRTC4, |
|
47 |
|
48 /** RGBA, PVRTC 4 bpp. */ |
|
49 EHuiTextureFormatRgbaPVRTC4, |
|
50 |
|
51 /** RGB, PVRTC 2 bpp. */ |
|
52 EHuiTextureFormatRgbPVRTC2, |
|
53 |
|
54 /** RGBA, PVRTC 2 bpp. */ |
|
55 EHuiTextureFormatRgbaPVRTC2 |
|
56 }; |
|
57 |
|
58 |
|
59 /** Flags for texture uploading. */ |
|
60 enum THuiTextureUploadFlags |
|
61 { |
|
62 /** No special actions/behavior needed. */ |
|
63 EHuiTextureUploadFlagDefault = 0, |
|
64 |
|
65 /** |
|
66 * @deprecated This is default functionality |
|
67 */ |
|
68 EHuiTextureUploadFlagRetainResolution = 1, |
|
69 |
|
70 /** |
|
71 * Automatically generates a shadow for the texture in texture upload |
|
72 * phase. |
|
73 */ |
|
74 EHuiTextureUploadFlagGenerateShadow = 2, |
|
75 |
|
76 /** |
|
77 * Use to retain the color depth of the |
|
78 * ((up)loaded) image as well as possible. Otherwise |
|
79 * the toolkit may reduce the color depth of the texture |
|
80 * to conserve memory. |
|
81 */ |
|
82 EHuiTextureUploadFlagRetainColorDepth = 4, |
|
83 |
|
84 // note: value 0x8 is reserved in client server model so we leave hole here |
|
85 |
|
86 /** |
|
87 * Set if it is not necessary to retain the |
|
88 * full resolution of the bitmap (tries to match texture resolution |
|
89 * with bitmap resolution). |
|
90 * This may save some memory with hardware acceleration, but image quality changes to worse |
|
91 */ |
|
92 EHuiTextureUploadFlagDoNotRetainResolution = 0x10, |
|
93 |
|
94 /** |
|
95 * Use the provided bitmap directly for the texture, without conversion or copying. The bitmaps |
|
96 * should be in the correct format and they shall not be compressed or have duplicated handle. |
|
97 * If the direct bitmap cannot be used, this flag is ignored internally. |
|
98 */ |
|
99 EHuiTextureFlagAllowDirectBitmapUsage = 0x20, |
|
100 |
|
101 /** |
|
102 * If given to texture's SegmentUpload() while bitmap being uploaded is in NVG format, |
|
103 * the texture will have NVG ObjectCached data created for quicker drawing. |
|
104 * |
|
105 * By default if no flags is given as parameters, the NVG data will be rasterized |
|
106 * into PBuffer (=VGImage) during upload, since using VGImages is the fastet way. |
|
107 */ |
|
108 EHuiTextureUploadFlagUsePureNvg = 0x40 |
|
109 }; |
|
110 |
|
111 |
|
112 /** |
|
113 * MHuiTexture is the most generic interface that all texture classes need to |
|
114 * implement. Using MHuiTexture, it is possible to determine which interfaces |
|
115 * a specific texture supports. |
|
116 */ |
|
117 class MHuiTexture |
|
118 { |
|
119 public: |
|
120 |
|
121 /* Destructor. */ |
|
122 |
|
123 /** |
|
124 * Virtual destructor. |
|
125 */ |
|
126 IMPORT_C virtual ~MHuiTexture(); |
|
127 |
|
128 |
|
129 /* Interface methods. */ |
|
130 |
|
131 /** |
|
132 * @return The texture as a MHuiSegmentedTexture interface, or NULL is |
|
133 * the texture does not implement the segmented texture interface. |
|
134 */ |
|
135 virtual MHuiSegmentedTexture* SegmentedTexture() = 0; |
|
136 |
|
137 virtual const MHuiSegmentedTexture* SegmentedTexture() const = 0; |
|
138 |
|
139 /** |
|
140 * @return The texture as a MHuiShadowedTexture interface, or NULL is |
|
141 * the texture does not implement the shadowed texture interface. |
|
142 */ |
|
143 virtual MHuiShadowedTexture* ShadowedTexture() = 0; |
|
144 |
|
145 virtual const MHuiShadowedTexture* ShadowedTexture() const = 0; |
|
146 |
|
147 /** |
|
148 * Returns true if the texture has changed since the last change |
|
149 * notification. Changed means that the bitmap data of the texture |
|
150 * has been modified, and must be re-uploaded to texture memory. |
|
151 */ |
|
152 virtual TBool TextureChanged() const = 0; |
|
153 |
|
154 /** |
|
155 * Clears the changed status of the visual. |
|
156 */ |
|
157 virtual void TextureClearChanged() const = 0; |
|
158 |
|
159 /** |
|
160 * Determines whether the texture has content. Only textures that |
|
161 * have content can be drawn. |
|
162 * |
|
163 * Note that a texture that has not finished loading will return EFalse |
|
164 * here, because its content will only become available after it has |
|
165 * been fully loaded. |
|
166 * |
|
167 * @return ETrue, if this texture has content. |
|
168 */ |
|
169 virtual TBool HasContent() const = 0; |
|
170 |
|
171 virtual void TextureExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) = 0; |
|
172 |
|
173 }; |
|
174 |
|
175 |
|
176 #endif // __HUITEXTUREIF_H__ |