26
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-2009 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: Texture Manager component
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef C_GLXTEXTUREMANAGER_H
|
|
22 |
#define C_GLXTEXTUREMANAGER_H
|
|
23 |
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <gdi.h>
|
|
26 |
#include <AknsConstants.h>
|
|
27 |
#include <glxmediaid.h>
|
|
28 |
#include "mglxskinchangeobserver.h"
|
|
29 |
|
|
30 |
class TAknsItemID;
|
|
31 |
class CAlfTexture;
|
|
32 |
class TMPXAttribute;
|
|
33 |
class CGlxDRMUtility;
|
|
34 |
class CGlxMedia;
|
|
35 |
class CAlfImageLoaderUtil;
|
|
36 |
class CAlfTextureManager;
|
|
37 |
class MGlxCache;
|
|
38 |
class TGlxMedia;
|
|
39 |
class CGlxResolutionUtility;
|
|
40 |
class CGlxTextureManagerImpl;
|
|
41 |
class MGlxTextureObserver;
|
|
42 |
|
|
43 |
/**
|
|
44 |
* CGlxTextureManager
|
|
45 |
*
|
|
46 |
* Texture Manager component.
|
|
47 |
*
|
|
48 |
* @author David Holland
|
|
49 |
*
|
|
50 |
*/
|
|
51 |
NONSHARABLE_CLASS ( CGlxTextureManager ) : public CBase,
|
|
52 |
public MGlxSkinChangeObserver
|
|
53 |
{
|
|
54 |
public:
|
|
55 |
/**
|
|
56 |
* Two-phased constructor
|
|
57 |
* @param aAlfTextureManager The Alf Texture Manager
|
|
58 |
* @return Constructed object
|
|
59 |
*/
|
|
60 |
IMPORT_C static CGlxTextureManager* NewL(
|
|
61 |
CAlfTextureManager& aAlfTextureManager);
|
|
62 |
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Destructor
|
|
66 |
*/
|
|
67 |
~CGlxTextureManager();
|
|
68 |
/**
|
|
69 |
* Determins if the texture need updating
|
|
70 |
* @param aMediaId The Id of the media item
|
|
71 |
* @param aIdSpaceId The Id of the Id space in which the media Id is defined
|
|
72 |
* @param aRequiredSize The preferred size of the texture
|
|
73 |
* @return ETrue if the texture needs updating. EFalse if not.
|
|
74 |
*/
|
|
75 |
IMPORT_C TBool TextureNeedsUpdating(TGlxMedia aMedia, TGlxIdSpaceId aIdSpaceId,
|
|
76 |
const TSize& aRequiredSize);
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Requests the best match texture. If it already exists this method does nothing.
|
|
80 |
* However if it doed not exist it will create it and replace the old texture
|
|
81 |
* if necessary.
|
|
82 |
* @param aSize The size of the requested texture
|
|
83 |
* @param aMedia The TGlxMedia item
|
|
84 |
* @param aIdSpaceId The Id of the Id space in which the media Id is defined
|
|
85 |
* @param aObserver Observer for the texture.
|
|
86 |
* @return Created texture, or NULL if the texture alreay exists
|
|
87 |
*/
|
|
88 |
|
|
89 |
IMPORT_C CAlfTexture& CreateNewTextureForMediaL(
|
|
90 |
TSize aSize,
|
|
91 |
const TGlxMedia& aMedia,
|
|
92 |
const TGlxIdSpaceId& aIdSpaceId,
|
|
93 |
MGlxTextureObserver* aObserver );
|
|
94 |
/**
|
|
95 |
* Create a texture from an Avkon icon
|
|
96 |
* @param aId The Id associated with the icon in the Skin
|
|
97 |
* @param aBitmapId The Id associated with the bitmap in the Avkon icon bitmap file
|
|
98 |
* The bitmap Id is used if no icon is found for the skin Id
|
|
99 |
* @param aRequestedSize requested size. If default used size is based on size of original graphic
|
|
100 |
* @return Created texture
|
|
101 |
*/
|
|
102 |
IMPORT_C CAlfTexture& CreateAvkonIconTextureL(const TAknsItemID &aID,
|
|
103 |
TInt aBitmapId,
|
|
104 |
TSize aRequestedSize = TSize(0,0));
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Create a texture from an Avkon icon
|
|
108 |
* @param aId The Id associated with the icon in the Skin
|
|
109 |
* @param aBitmapId The Id associated with the bitmap in the Avkon icon bitmap file
|
|
110 |
* The bitmap Id is used if no icon is found for the skin Id
|
|
111 |
* @param aDefaultColor colour use if skin clour not specified or not found
|
|
112 |
* @param aSkinColorId Id of the skin colour table
|
|
113 |
* @param aSkinColorIndex Index of the colour in the table
|
|
114 |
* @param aRequestedSize requested size. If default used size is based on size of original graphic
|
|
115 |
* @return Created texture
|
|
116 |
*/
|
|
117 |
IMPORT_C CAlfTexture& CreateColorAvkonIconTextureL(
|
|
118 |
const TAknsItemID& aID,
|
|
119 |
TInt aBitmapId,
|
|
120 |
TRgb aDefaultColor,
|
|
121 |
const TAknsItemID& aSkinColorId = KAknsIIDNone,
|
|
122 |
TInt aSkinColorIndex = 0,
|
|
123 |
TSize aRequestedSize = TSize(0,0));
|
|
124 |
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Create a texture from an Avkon icon
|
|
128 |
* @param aId The Id associated with the icon in the Skin
|
|
129 |
* @param aRequestedSize requested size. If default used size is based on size of original graphic
|
|
130 |
* @return Created texture
|
|
131 |
*/
|
|
132 |
IMPORT_C CAlfTexture& CreateAvkonIconTextureL(const TAknsItemID &aID,
|
|
133 |
TSize aRequestedSize = TSize(0,0));
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Create a texture from an icon within the application
|
|
137 |
* @param aIconResourceId The Id associated with the icon .mif file
|
|
138 |
* @param aFilename The full path name of the .mif file
|
|
139 |
* @param aRequestedSize requested size. If default used size is based on size of original graphic
|
|
140 |
* @return Created texture
|
|
141 |
*/
|
|
142 |
IMPORT_C CAlfTexture& CreateIconTextureL(TInt aIconResourceId,
|
|
143 |
TDesC& aFilename,
|
|
144 |
TSize aRequestedSize = TSize(0,0));
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Create a texture from an icon within the application, modifying the icon colour
|
|
148 |
* @param aIconResourceId The Id associated with the icon .mif file
|
|
149 |
* @param aFilename The full path name of the .mif file
|
|
150 |
* @param aDefaultColor colour use if skin clour not specified or not found
|
|
151 |
* @param aSkinColorId Id of the skin colour table
|
|
152 |
* @param aSkinColorIndex Index of the colour in the table
|
|
153 |
* @param aRequestedSize requested size. If default used size is based on size of original graphic
|
|
154 |
* @return Created texture
|
|
155 |
*/
|
|
156 |
IMPORT_C CAlfTexture& CreateColorIconTextureL(
|
|
157 |
TInt aIconResourceId,
|
|
158 |
TDesC& aFilename,
|
|
159 |
TRgb aDefaultColor,
|
|
160 |
const TAknsItemID& aSkinColorId = KAknsIIDNone,
|
|
161 |
TInt aSkinColorIndex = 0,
|
|
162 |
TSize aRequestedSize = TSize(0,0));
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Create a texture from a bitmap from the attribute of a media item
|
|
166 |
* @param aMediaId The Id of the media item
|
|
167 |
* @param aIdSpaceId The Id of the Id space in which the media Id is defined
|
|
168 |
* @param aRequiredSize The preferred size of the texture
|
|
169 |
* @param aObserver Observer for the texture.
|
|
170 |
* @param aScaleGridTnm ETrue if the grid tnm to be scaled else EFalse by default.
|
|
171 |
* @return Created texture
|
|
172 |
*/
|
|
173 |
IMPORT_C CAlfTexture& CreateThumbnailTextureL(
|
|
174 |
const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId,
|
|
175 |
const TSize& aRequiredSize, MGlxTextureObserver* aObserver,
|
|
176 |
TBool aScaleGridTnm=EFalse);
|
|
177 |
|
|
178 |
/**
|
|
179 |
* Create a texture from a zoomed thumbnail attribute of a media item
|
|
180 |
* @param aMedia The media item
|
|
181 |
* @param aAttribute Which attribute
|
|
182 |
* @param aIdSpaceId The Id of the Id space in which the media Id is defined
|
|
183 |
* @param aObserver Observer for the texture.
|
|
184 |
* @return Created texture
|
|
185 |
*/
|
|
186 |
IMPORT_C CAlfTexture& CreateZoomedTextureL(const TGlxMedia& aMedia,
|
|
187 |
const TMPXAttribute& aAttribute,
|
|
188 |
TGlxIdSpaceId aIdSpaceId, MGlxTextureObserver* aObserver);
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Create a texture from a zoomed thumbnail for a given texture ID
|
|
192 |
* @param aTextureId The texture id, for which the texture is removed.
|
|
193 |
* @return Created texture
|
|
194 |
*/
|
|
195 |
IMPORT_C CAlfTexture* CreateZoomedTextureL() ;
|
|
196 |
|
|
197 |
/**
|
|
198 |
* Create an animated texture from a GIF file
|
|
199 |
* @param aFilename The filename of the GIF file
|
|
200 |
* @param aSize The size of the GIF file
|
|
201 |
* @param aMedia The media item
|
|
202 |
* @param aIdSpaceId The Id of the Id space in which the media Id is defined
|
|
203 |
* @return Created texture: ownership transfered
|
|
204 |
*/
|
|
205 |
IMPORT_C CAlfTexture& CreateAnimatedGifTextureL( const TDesC& aFilename,
|
|
206 |
const TSize& aSize, const TGlxMedia& aMedia, TGlxIdSpaceId aIdSpaceId );
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Creates a flat color texture and returns the reference to it
|
|
210 |
* Note that the texture ownership stays within texture manager
|
|
211 |
* @param aColour the color for the texture
|
|
212 |
*/
|
|
213 |
IMPORT_C CAlfTexture& CreateFlatColourTextureL( TRgb aColour );
|
|
214 |
|
|
215 |
/**
|
|
216 |
* Removes the texture if it was created by CreateThumbnailTextureL or
|
|
217 |
* CreateZoomedTextureL
|
|
218 |
* @param aTexture The texture to be removed
|
|
219 |
*/
|
|
220 |
IMPORT_C void RemoveTexture(const CAlfTexture& aTexture);
|
|
221 |
/**
|
|
222 |
* Removes the texture if it was created by CreateThumbnailTextureL or
|
|
223 |
* CreateZoomedTextureL
|
|
224 |
* @param aTexture The texture to be removed
|
|
225 |
*/
|
|
226 |
IMPORT_C void RemoveZoomList();
|
|
227 |
|
|
228 |
/**
|
|
229 |
* Removes the texture if it was created by CreateThumbnailTextureL or
|
|
230 |
* CreateZoomedTextureL
|
|
231 |
* @param aMediaId The MediaId to be removed
|
|
232 |
* @param aAllTexture Flag to remove all textures
|
|
233 |
* Bug fix for PKAA-7NRBYZ - added bAllTexture param
|
|
234 |
*/
|
|
235 |
IMPORT_C void RemoveTexture(const TGlxMediaId& aMediaId, TBool aAllTexture=EFalse);
|
|
236 |
|
|
237 |
/**
|
|
238 |
* Removes ALL Textures
|
|
239 |
*/
|
|
240 |
IMPORT_C void FlushTextures() ;
|
|
241 |
|
|
242 |
/**
|
|
243 |
* Animate the given media.
|
|
244 |
* @param aMediaId The Id of the media to be animated
|
|
245 |
* @param aState Animation state [ETrue to Start, EFalse to Stop]
|
|
246 |
*/
|
|
247 |
IMPORT_C void AnimateMediaItem(const TGlxMediaId& aMediaId, TBool aState);
|
|
248 |
|
|
249 |
/**
|
|
250 |
* Creates textures for the given GIF media
|
|
251 |
* @param aMedia The media item
|
|
252 |
* @param aIdSpaceId The Id of the Id space in which the media Id is defined
|
|
253 |
* @param aFrameNumber frame number of gif media
|
|
254 |
* @param aBitmap Bitmap for the particular frame
|
|
255 |
* @return Created texture: ownership transfered
|
|
256 |
*/
|
|
257 |
IMPORT_C CAlfTexture& CreateDRMAnimatedGifTextureL(const TGlxMedia& aMedia,
|
|
258 |
TGlxIdSpaceId aIdSpaceId, TInt aFrameNumber, CFbsBitmap* aBitmap, CFbsBitmap* aBitmapMask);
|
|
259 |
|
|
260 |
public: // from MGlxSkinChangeObserver
|
|
261 |
|
|
262 |
void HandleSkinChanged();
|
|
263 |
|
|
264 |
|
|
265 |
private:
|
|
266 |
//implementation class
|
|
267 |
CGlxTextureManagerImpl* iImpl;
|
|
268 |
};
|
|
269 |
|
|
270 |
|
|
271 |
|
|
272 |
#endif // C_GLXTEXTUREMANAGER_H
|