CHuiTextureManager Class Reference

class CHuiTextureManager : public CActive

CHuiTextureManager is responsible for managing the texture objects used by the application. It provides asynchronous loading of image data into CHuiTexture instances. The texture manager also manages font textures, which can be used for compositing text in text meshes.

The texture manager makes sure that only one copy of each image is loaded at a time, so even if the application requests the same image several times it is only loaded once. Textures are identified either by an integer ID or by their file name.

TodoDocument supported image (file) formats / how are the images loaded

CHuiTextureManager is owned by CHuiEnv, and should be accessed via a CHuiEnv instance. You should never construct your own texturemanagers.

hitchcock.lib

Inherits from

Public Member Functions
~CHuiTextureManager ()
IMPORT_C TInt AddAnimatedTextureGroupL (const RArray < TInt > &)
IMPORT_C void AdvanceTime ( TReal32 )
IMPORT_C void AppendTextureL ( CHuiTexture *, TInt )
IMPORT_C const CHuiTexture & BlankTexture ()
IMPORT_C CHuiTexture & BlankTexture ()
IMPORT_C void ClearChangedTextures ()
IMPORT_C CHuiTexture & CreateTextureL ( TInt , MHuiBitmapProvider *, THuiTextureUploadFlags )
IMPORT_C void DefineFileNameL ( TInt , const TDesC &)
void EnableAutoSizeCalculation ( TBool )
IMPORT_C void EnableTexMemoryCalculation ( TBool )
IMPORT_C CHuiEnv & Env ()
TInt EstimatedTextureMemUsage ( TInt )
IMPORT_C const TDesC & ImagePath ()
IMPORT_C TBool IsLoaded (const TDesC &, const TInt )
IMPORT_C TBool IsLoaded ( TInt )
IMPORT_C TBool IsLoaded (const CHuiTexture *)
IMPORT_C TInt LoadQueueCount ()
IMPORT_C CHuiTexture & LoadTextureL (const TDesC &, THuiTextureUploadFlags , TInt , TInt )
IMPORT_C CHuiTexture & LoadTextureL (const TInt , const TSize &, THuiTextureUploadFlags )
IMPORT_C CHuiTexture & LoadTextureL (const TDesC &, const TSize &, THuiTextureUploadFlags , TInt , TInt )
IMPORT_C void NotifySkinChangedL ()
IMPORT_C void PrependImagePath ( TDes &)
IMPORT_C CHuiTextureProcessor & Processor ()
IMPORT_C TBool Release ()
IMPORT_C void RemoveAnimatedTextureGroup ( TInt )
IMPORT_C void RemoveTexture ( CHuiTexture &)
IMPORT_C void RestoreL ()
IMPORT_C void SetHasChangedTextures ()
IMPORT_C void SetImagePathL (const TDesC &)
IMPORT_C TBool SetTextureId ( CHuiTexture *, TInt )
TState State ()
IMPORT_C CHuiTexture * Texture ( TInt )
IMPORT_C const CHuiTexture * Texture ( TInt )
IMPORT_C CHuiTexture * TextureL ( TInt )
IMPORT_C void UnloadTexture (const TDesC &, const TInt )
IMPORT_C void UnloadTexture ( TInt )
IMPORT_C void UpdateTextureFromBitmapL ( TInt , MHuiBitmapProvider *)
Protected Member Functions
CHuiTextureManager (CHuiEnv &)
IMPORT_C void BaseConstructL ()
IMPORT_C TInt CheckTexture (const TDesC &, TInt )
IMPORT_C TInt CheckTexture ( TInt )
NONSHARABLE_CLASS (CTextureEntry)
IMPORT_C void NotifyTextureLoaded ( CHuiTexture &, TInt , TInt )
IMPORT_C void SetProcessor ( CHuiTextureProcessor *)
IMPORT_C CTextureEntry * TextureEntry ( TInt )
IMPORT_C TInt TextureEntryCount ()
IMPORT_C void TextureManagerExtension (const TUid &, TAny **)
Private Member Functions
void CancelLoadingOfTexture ( CHuiTexture &)
CHuiTextureAnimationState * CreateAnimationStateL ( TInt , const TDesC &, TInt , TInt )
IMPORT_C CHuiTexture & CreateTextureL ( CFbsBitmap &, const CFbsBitmap *, THuiTextureUploadFlags , TInt )
IMPORT_C void DoCancel ()
void DoLoadNextL ()
void DoUnload ( TInt )
CHuiTextureAnimationState * FindAnimationState ( TInt )
TBool FindGroupIdByTextureId ( TInt , TInt &)
RFs & FsSession ()
void ImageLoadingCompleteL ( SLoadQueueEntry &)
TInt ImageLoadingContinue ()
TBool IsInLoadQueue (const CHuiTexture *)
TBool IsInLoadQueue ( TInt )
TBool NeedsAnimationState (const CImageDecoder &)
void NotifyStateChange ()
void NotifyTextureAutoSizeObservers ()
SLoadQueueEntry PopLoadedQueueEntry ()
void ProcessAnimatedFrameL ( SLoadQueueEntry &)
void RemoveAnimationState (CHuiTextureAnimationState *)
IMPORT_C TInt RunError ( TInt )
IMPORT_C void RunL ()
void StartLoading ()
void TextureMemUsage ()
void UpdateFlags (const CFbsBitmap &, const CFbsBitmap *, THuiTextureUploadFlags &)
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TState { EIdle , ELoading }
Protected Member Enumerations
enum TReleaseState { ENormal , EReleasing , EReleased , EPartiallyReleased , ERestoring }
Inherited Enumerations
CActive:TPriority
Public Attributes
RHuiObserverArray < MHuiTimeObserver > iAnimatedTextures
RHuiObserverArray < MHuiTextureLoadingCompletedObserver > iLoadObservers
RHuiObserverArray < MHuiTextureManagerStateChangedObserver > iStateObservers
RHuiObserverArray < MHuiTextureAutoSizeObserver > iTextureAutoSizeObservers
Private Attributes
RArray < TAnimatedTextureGroupItem > iAnimatedTextureGroupItems
CHuiTextureAnimationState * iAnimationWithoutGroup
RPointerArray < CHuiTextureAnimationState > iAnimations
CFbsBitmap * iBitmap
CHuiTexture * iBlankTexture
TBool iEnableTexMemCalculation
CHuiEnv & iEnv
RFs & iFS
TInt iFontIdEnumerator
TBool iHasChangedTextures
HBufC * iImagePath
RArray < SLoadQueueEntry > iLoadQueue
TBool iLoadQueueHadValidTexture
CFbsBitmap * iMaskBitmap
CHuiTextureProcessor * iProcessor
TReleaseState iReleaseState
TState iState
TBool iTextureAutoSizingEnabled
RPointerArray < CTextureEntry > iTextures
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CHuiTextureManager(CHuiEnv &)

IMPORT_C CHuiTextureManager ( CHuiEnv & aEnv ) [protected]

Constructor.

Parameters

CHuiEnv & aEnv

~CHuiTextureManager()

IMPORT_C ~CHuiTextureManager ( ) [virtual]

Destructor.

Member Functions Documentation

AddAnimatedTextureGroupL(const RArray< TInt > &)

IMPORT_C TInt AddAnimatedTextureGroupL ( const RArray < TInt > & aTextureIds )

Adds animated texture group. Use this method to inform texture manager that when texture is loaded, it's allowed to use previous state of the group. Each texture id should belong at most to one group. This method should be called before using these texture ids to load textures.

Parameters

const RArray < TInt > & aTextureIds texture ids that form a group.

AdvanceTime(TReal32)

IMPORT_C void AdvanceTime ( TReal32 aElapsedTime ) const

Informs the texture manager that time has progressed. The manager will update any animated textures.

Parameters

TReal32 aElapsedTime

AppendTextureL(CHuiTexture *, TInt)

IMPORT_C void AppendTextureL ( CHuiTexture * aTexture,
TInt aId = 0
) [virtual]

Appends a texture to the texture manager's list of managed textures. Ownership of the texture is transferred to the manager; when the manager is destroyed, the texture will be destroyed, too.

leave
KErrAlreadyExists if a texture with the given id already exists.
TodoDoes not check (or replace) already existing duplicate textures having matching id.

Parameters

CHuiTexture * aTexture Texture to transfer to the manager.
TInt aId = 0 Id for the texture. Must be unique. Use zero for unassigned id.

BaseConstructL()

IMPORT_C void BaseConstructL ( ) [protected]

Second-phase constructor.

BlankTexture()

IMPORT_C const CHuiTexture & BlankTexture ( ) const

Returns the blank texture. This can be used as a dummy texture if no real texture is available.

BlankTexture()

IMPORT_C CHuiTexture & BlankTexture ( )

Returns the blank texture. This can be used as a dummy texture if no real texture is available. Will generate the blank texture if the texture is not yet available.

CancelLoadingOfTexture(CHuiTexture &)

void CancelLoadingOfTexture ( CHuiTexture & aTexture ) [private]

Cancels the scheduled or ongoing loading of a texture. If the texture is found from load queue it is immediately removed from the queue. If the removed texture was being loaded at the time this method is called the loading is cancelled and restarted from the next unloaded texture.

Parameters

CHuiTexture & aTexture Reference to the texture of which load is cancelled.

CheckTexture(const TDesC &, TInt)

IMPORT_C TInt CheckTexture ( const TDesC & aFileName,
TInt aFrameNumber = 0
) const [protected]

Check the existence of a texture.

Parameters

const TDesC & aFileName File name of the texture.
TInt aFrameNumber = 0

CheckTexture(TInt)

IMPORT_C TInt CheckTexture ( TInt aId ) const [protected]

Check the existence of a texture.

Parameters

TInt aId Id of the texture to check.

ClearChangedTextures()

IMPORT_C void ClearChangedTextures ( )

Clears texture changed flags.

CreateAnimationStateL(TInt, const TDesC &, TInt, TInt)

CHuiTextureAnimationState * CreateAnimationStateL ( TInt aGroupId,
const TDesC & aImageFile,
TInt aFrameNumber,
TInt aFrameCount
) [private]

Creates animation state.

Parameters

TInt aGroupId group id.
const TDesC & aImageFile image file.
TInt aFrameNumber frame number.
TInt aFrameCount frame count.

CreateTextureL(TInt, MHuiBitmapProvider *, THuiTextureUploadFlags)

IMPORT_C CHuiTexture & CreateTextureL ( TInt aId,
MHuiBitmapProvider * aBitmapProvider,
THuiTextureUploadFlags aFlags
)

Creates a texture by calling the ProvideBitmapL method of the passed MHuiBitmapProvider .

If a texture with the given id is already created or loaded the previously existing texture is returned. If texture with the given id has been unloaded with UnloadTexture() method then the id is reused by loading a new texture on the id.

If EHuiTextureFlagAllowDirectBitmapUsage flag is used, the provided bitmaps should be in the preferred format. That can be found using CHuiDisplay::GetPreferredTextureFormats(). Also the bitmaps shall not be compressed or have duplicated handle.

leave
KErrArgument The bitmap and the mask bitmap are incompatible (different size) or in incorrect format

Parameters

TInt aId Id for the texture. Must be unique. Use zero for unassigned id.
MHuiBitmapProvider * aBitmapProvider A bitmap provider that will load the bitmaps for us. The ProvideBitmapL method of this will be called, which should load or generate the needed bitmaps.
THuiTextureUploadFlags aFlags Specify load/upload behavior - how to convert the bitmap to texture.

CreateTextureL(CFbsBitmap &, const CFbsBitmap *, THuiTextureUploadFlags, TInt)

IMPORT_C CHuiTexture & CreateTextureL ( CFbsBitmap & aBitmap,
const CFbsBitmap * aMask,
THuiTextureUploadFlags aFlags,
TInt id
) [private, virtual]

Creates a texture from the given CFbsBitmap and its mask bitmap. This is a synchronous method call and will result in consequent call of TextureLoadingCompleted of all observers if the texture creation was successful. As filename cannot be acquired for created textures the user provided string will be used. Note that the filename has to be unique for all textures. Textures are identified by their filename and if a texture with existing filename is loaded / created then already loaded / created texture will be returned instead of creating a new texture.

Note:

There are problems in creating textures from icon bitmaps exported using AknsUtils::CreateAppIconLC() . It seems that it is impossible to access the bitmap data of created icon directly using DataAddtess() - method or THuiBitmapUtil - method. HUIToolkit relies on these methods. To create textures from the system icons you have to copy the icons to temporary CFbsBitmaps. Notice that duplicating the bitmap handle with CFbsBitmap::Duplicate is not enough. You have to make a physical copy.

leave
KErrArgument The bitmap and the mask bitmap are incompatible (different size).

Parameters

CFbsBitmap & aBitmap The source bitmap from which the texture is created.
const CFbsBitmap * aMask Pointer to the mask bitmap that is used as alpha blending mask for the texture. This parameter can be NULL for textures without alpha channel.
THuiTextureUploadFlags aFlags
TInt id

DefineFileNameL(TInt, const TDesC &)

IMPORT_C void DefineFileNameL ( TInt aId,
const TDesC & aImageName
)

Define (register) a texture resource (filename/path) for a texture id. Enables calling the LoadTextureL only with an id. This resource will then be loaded when LoadTextureL is called with the id.

Parameters

TInt aId
const TDesC & aImageName

DoCancel()

IMPORT_C void DoCancel ( ) [private, virtual]

Cancel active object operation.

DoLoadNextL()

void DoLoadNextL ( ) [private]
Sets up image decoding and starts to load the first entry in the load queue.
leave
Standard error code if decoder initialization/resource read fails.

DoUnload(TInt)

void DoUnload ( TInt index ) [private]

Unloads a texture having given index in the texture array (iTextures).

Parameters

TInt index

EnableAutoSizeCalculation(TBool)

void EnableAutoSizeCalculation ( TBool aEnable = ETrue )

Enables (or disables) texture autosize calculations.

Parameters

TBool aEnable = ETrue

EnableTexMemoryCalculation(TBool)

IMPORT_C void EnableTexMemoryCalculation ( TBool aEnableTeMemCal )

Sets a flag if texture memory usage calculation should be done and printed.

Parameters

TBool aEnableTeMemCal

Env()

IMPORT_C CHuiEnv & Env ( )

Determines the environment the manager belongs to.

EstimatedTextureMemUsage(TInt)

TInt EstimatedTextureMemUsage ( TInt aAverageBitsPerPixel ) const

Estimated mem usage for textures assuming that textures which have pixel content are using given amount of memory per pixel.

Parameters

TInt aAverageBitsPerPixel

FindAnimationState(TInt)

CHuiTextureAnimationState * FindAnimationState ( TInt aGroupId ) [private]

Finds animation state owned by aGroupId.

Parameters

TInt aGroupId

FindGroupIdByTextureId(TInt, TInt &)

TBool FindGroupIdByTextureId ( TInt aTextureId,
TInt & aGroupId
) const [private]

Finds group id by texture id.

Parameters

TInt aTextureId texture id to look for.
TInt & aGroupId updated to contain found group id.

FsSession()

RFs & FsSession ( ) const [private]

Returns the file server session that should be used by the manager.

ImageLoadingCompleteL(SLoadQueueEntry &)

void ImageLoadingCompleteL ( SLoadQueueEntry & aEntry ) [private]

Called when an image has finished loading. Handles uploading of the loaded bitmap to the texture.

Parameters

SLoadQueueEntry & aEntry queue entry.

ImageLoadingContinue()

TInt ImageLoadingContinue ( ) [private]

Called when a sub-image has been loaded (before calling ImageLoadingCompleteL ). This method checks if we need to continue loading.

ImagePath()

IMPORT_C const TDesC & ImagePath ( ) const

Returns the current image path. LoadTexture() Call to load textures from this location.

IsInLoadQueue(const CHuiTexture *)

TBool IsInLoadQueue ( const CHuiTexture * texture ) const [private]

Returns true if the given texture is still in the load queue.

Parameters

const CHuiTexture * texture

IsInLoadQueue(TInt)

TBool IsInLoadQueue ( TInt id ) const [private]

Returns true if the given texture is still in the load queue.

Parameters

TInt id

IsLoaded(const TDesC &, const TInt)

IMPORT_C TBool IsLoaded ( const TDesC & aImageName,
const TInt aFrameNumber = 0
) const

Checks if a texture exists, has content and is not found from the texture load queue.

Mainly meant for file-based textures to check if the texture is ready to be used.

Note that textures may have some temporary placeholder content already before they have been fully loaded!

For CreateTextureL -based textures it is recommended to use CHuiTexture::HasContent() directly.

LoadTextureL() CreateTextureL() CHuiTexture::HasContent()

Parameters

const TDesC & aImageName Name of the image bitmap file to check. ImagePath (if set) will be prepended to this name.
const TInt aFrameNumber = 0

IsLoaded(TInt)

IMPORT_C TBool IsLoaded ( TInt aId ) const

Checks if a texture exists, has content and is not found from the texture load queue.

Mainly meant for file-based textures to check if the texture is ready to be used.

Note that textures may have some temporary placeholder content already before they have been fully loaded!

For CreateTextureL -based textures it is recommended to use CHuiTexture::HasContent() directly.

LoadTextureL() CreateTextureL() CHuiTexture::HasContent()

Parameters

TInt aId Id of the texture.

IsLoaded(const CHuiTexture *)

IMPORT_C TBool IsLoaded ( const CHuiTexture * aTexture ) const

Checks if a texture exists, has content and is not found from the texture load queue.

Mainly meant for file-based textures to check when the texture is ready to be used.

Note that textures may have some temporary placeholder content already before they have been fully loaded!

For CreateTextureL -based textures it is recommended to use CHuiTexture::HasContent() directly.

LoadTextureL() CreateTextureL() CHuiTexture::HasContent()

Parameters

const CHuiTexture * aTexture Texture object.

LoadQueueCount()

IMPORT_C TInt LoadQueueCount ( ) const

Returns the number of images waiting to be loaded.

LoadTextureL(const TDesC &, THuiTextureUploadFlags, TInt, TInt)

IMPORT_C CHuiTexture & LoadTextureL ( const TDesC & aImageFileName,
THuiTextureUploadFlags aFlags = EHuiTextureUploadFlagDefault,
TInt aId = 0,
TInt aFrameNumber = 0
)

Loads an image and makes it a texture. The bitmap files are searched in the path specified with SetImagePathL. The format of the loaded image must be supported by the system (Series 60) codecs.

LoadTextureL is an asynchronous method, which returns an empty texture which is loaded and filled in the background. Register an MHuiTextureLoadingCompletedObserver instance to the iLoadedObservers array, whose TextureLoadingCompleted() method will be called when textures finish loading. The same observer is also called if an error occurs during the loading process. The other method is to check if an image has been loaded with TextureManagers IsLoaded() .

If a texture with the given id or filename is already loaded the previously loaded texture is returned. If texture with the given id has been unloaded with UnloadTexture() method then the id is reused by loading a new texture on the id.

Note:

If both image name and id are left undefined ("" and zero), will return a blank texture.

SetImagePathL() To set the image search path. Set to "" to use absolute image filenames. iLoadObservers MHuiTextureLoadingCompletedObserver::TextureLoadingCompleted() IsLoaded()

Parameters

const TDesC & aImageFileName Name of the image bitmap file to load. Relative to the image load path. If empty filename is used, will check if a filename for the id has been defined and load a texture using that resource location, if possible.
THuiTextureUploadFlags aFlags = EHuiTextureUploadFlagDefault Specify flags for the texture loading and uploading - how to convert the bitmap to texture.
TInt aId = 0 Id for the texture. Must be unique, but may be left unassigned. Use zero for unassigned id.
TInt aFrameNumber = 0

LoadTextureL(const TInt, const TSize &, THuiTextureUploadFlags)

IMPORT_C CHuiTexture & LoadTextureL ( const TInt aId,
const TSize & aTextureMaxSize =  TSize (0, 0),
THuiTextureUploadFlags aFlags = EHuiTextureUploadFlagDefault
)

Loads an image based on pre-registered id and file name.

DefineFileName()LoadTextureL is an asynchronous method, which returns an empty texture which is loaded and filled in the background. Register an MHuiTextureLoadingCompletedObserver instance to the iLoadedObservers array, whose TextureLoadingCompleted() method will be called when textures finish loading. The same observer is also called if an error occurs during the loading process. The other method is to check if an image has been loaded with TextureManagers IsLoaded() .

If a texture with the given id or filename is already loaded the previously loaded texture is returned. If texture with the given id has been unloaded with UnloadTexture() method then the id is reused by loading a new texture on the id.

SetImagePathL() To set the image search path. Set to "" to use absolute image filenames. iLoadObservers MHuiTextureLoadingCompletedObserver::TextureLoadingCompleted() IsLoaded()

Parameters

const TInt aId The id of the texture/filename to load. The id must have a filename assigned by a call to DefineFileName(). If the id is left undefined (zero), will return a blank texture.
const TSize & aTextureMaxSize =  TSize (0, 0) Can be used to define a maximum dimensions for the final texture. The image data loaded will be scaled (down) and fitted to these dimensions. Use zero or below-zero values if size does not matter. If the texture size is larger than the texture size supported by the GL, the texture will be split to multiple segments.
THuiTextureUploadFlags aFlags = EHuiTextureUploadFlagDefault Specify upload behavior - how to convert the bitmap to texture and other load/upload behavior.

LoadTextureL(const TDesC &, const TSize &, THuiTextureUploadFlags, TInt, TInt)

IMPORT_C CHuiTexture & LoadTextureL ( const TDesC & aImageName,
const TSize & aTextureMaxSize,
THuiTextureUploadFlags aFlags = EHuiTextureUploadFlagDefault,
TInt aId = 0,
TInt aFrameNumber = 0
)

Loads an image and makes it a texture. The bitmap files are searched in the path specified with SetImagePathL. The format of the loaded image must be supported by the system (Series 60) codecs.

LoadTextureL is an asynchronous method, which returns an empty texture which is loaded and filled in the background. Register an MHuiTextureLoadingCompletedObserver instance to the iLoadedObservers array, whose TextureLoadingCompleted() method will be called when textures finish loading. The same observer is also called if an error occurs during the loading process. The other method is to check if an image has been loaded with TextureManagers IsLoaded() .

If a texture with the given id or filename is already loaded the previously loaded texture is returned. If texture with the given id has been unloaded with UnloadTexture() method then the id is reused by loading a new texture on the id.

Note:

If both image name and id are left undefined ("" and zero), will return a blank texture.

SetImagePathL() To set the image search path. Set to "" to use absolute image filenames. iLoadObservers MHuiTextureLoadingCompletedObserver::TextureLoadingCompleted() IsLoaded()

Parameters

const TDesC & aImageName Name of the image bitmap file to load. If empty filename is used, will check if a filename for the aId has been defined (using DefineFileNameL()) and load a texture using that resource location, if possible.
const TSize & aTextureMaxSize Can be used to define a maximum dimensions for the final texture. The image data loaded will be scaled (down) and fitted to these dimensions. Use zero or below-zero values if size does not matter. If the texture size is larger than the texture size supported by the GL, the texture will be split to multiple segments.
THuiTextureUploadFlags aFlags = EHuiTextureUploadFlagDefault Specify load/upload behavior - how to convert the bitmap to texture.
TInt aId = 0 Id for the texture. Must be unique. Use zero for unassigned id.
TInt aFrameNumber = 0

NONSHARABLE_CLASS(CTextureEntry)

NONSHARABLE_CLASS ( CTextureEntry ) [protected, inline]

Permanent registration entry for textures.

Parameters

CTextureEntry

NeedsAnimationState(const CImageDecoder &)

TBool NeedsAnimationState ( const CImageDecoder & aDecoder ) [private, static]

Checks if animation state is needed.

Parameters

const CImageDecoder & aDecoder decoder.

NotifySkinChangedL()

IMPORT_C void NotifySkinChangedL ( )

Releases and restores skin dependent textures. Usually called after system skin has been changed.

NotifyStateChange()

void NotifyStateChange ( ) const [private]

Helper method that notifies observers of texture manager state change. iStateObservers

NotifyTextureAutoSizeObservers()

void NotifyTextureAutoSizeObservers ( ) const [private]

NotifyTextureLoaded(CHuiTexture &, TInt, TInt)

IMPORT_C void NotifyTextureLoaded ( CHuiTexture & aTexture,
TInt aTextureId,
TInt aErrorCode
) const [protected]

Helper method that notifies observers of texture load completion. iLoadObservers

Parameters

CHuiTexture & aTexture
TInt aTextureId
TInt aErrorCode

PopLoadedQueueEntry()

SLoadQueueEntry PopLoadedQueueEntry ( ) [private]

Cleans up the topmost load queue entry and removes it from the load queue. Deletes the decoder, but not the loaded texture entry.

PrependImagePath(TDes &)

IMPORT_C void PrependImagePath ( TDes & aFileName ) const

Prepends the image path to the beginning of the file name, if necessary.

Parameters

TDes & aFileName

ProcessAnimatedFrameL(SLoadQueueEntry &)

void ProcessAnimatedFrameL ( SLoadQueueEntry & aEntry ) [private]

Processes animated frame.

Parameters

SLoadQueueEntry & aEntry queue entry.

Processor()

IMPORT_C CHuiTextureProcessor & Processor ( )

Returns a reference to the texture processor.

panic
THuiPanic::ETextureManagerNoProcessor Texture processor is not available.

Release()

IMPORT_C TBool Release ( ) [virtual]

Releases texture manager resources. Releases all textures. Called when the render plugin is released.

While the release operation is in progress, it is not possible to delete CHuiTexture instances or create new ones. After the release has been completed, textures can again be deleted and created.

panic
ETextureManagerTextureConstructedDuringRelease A new CHuiTexture was constructed and added to the texture manager during the release operation.
panic
ETextureManagerTextureDestroyedDuringRelease An existing CHuiTexture was destroyed and removed from the texture manager during the release operation.
RestoreL()

RemoveAnimatedTextureGroup(TInt)

IMPORT_C void RemoveAnimatedTextureGroup ( TInt aGroupId )

Removes animated texture group.

Parameters

TInt aGroupId animated texture group id.

RemoveAnimationState(CHuiTextureAnimationState *)

void RemoveAnimationState ( CHuiTextureAnimationState * aState ) [private]

Removes animation state.

Parameters

CHuiTextureAnimationState * aState state to be removed.

RemoveTexture(CHuiTexture &)

IMPORT_C void RemoveTexture ( CHuiTexture & aTexture ) [virtual]

Removes a texture from management. The texture's ownership is transferred to the caller.

Parameters

CHuiTexture & aTexture Texture to remove from management.

RestoreL()

IMPORT_C void RestoreL ( ) [virtual]

Restores texture manager resources. Restores the content of all textures released in Release() . Called when render plugin restored.

While the restore operation is in progress, it is not possible to delete CHuiTexture instances or create new ones. After the restore has been completed, textures can again be deleted and created.

panic
ETextureManagerTextureConstructedDuringRestore A new CHuiTexture was constructed and added to the texture manager during the restore operation.
panic
ETextureManagerTextureDestroyedDuringRestore An existing CHuiTexture was destroyed and removed from the texture manager during the restore operation.
Release()

RunError(TInt)

IMPORT_C TInt RunError ( TInt aError ) [private, virtual]

Handles a leave occurring in the request completion event handler RunL() .

Parameters

TInt aError

RunL()

IMPORT_C void RunL ( ) [private, virtual]

Called when image loading (decoding) operation is complete.

SetHasChangedTextures()

IMPORT_C void SetHasChangedTextures ( )

Sets a flag that indicates that there are changed textures.

SetImagePathL(const TDesC &)

IMPORT_C void SetImagePathL ( const TDesC & aPath )

Sets the path where bitmaps are loaded from. If drive is not included, tries to resolver that using CCoeEnv

LoadTexture() Call to load textures from this location.

Parameters

const TDesC & aPath Path for bitmap files.

SetProcessor(CHuiTextureProcessor *)

IMPORT_C void SetProcessor ( CHuiTextureProcessor * aProcessor ) [protected]

Sets the texture processor of the manager. Ownership of the processor is given to the manager.

Parameters

CHuiTextureProcessor * aProcessor Texture processor instance. Ownership is transferred.

SetTextureId(CHuiTexture *, TInt)

IMPORT_C TBool SetTextureId ( CHuiTexture * aTexture,
TInt aId
)

Iterates through the managed textures to find aTexture, and then assigns it a new ID of aId.

Parameters

CHuiTexture * aTexture The managed texture whose ID we want to change.
TInt aId The texture ID that we want to assign to the managed texture.

StartLoading()

void StartLoading ( ) [private]

Starts loading next images from the load queue. If scheduling a queue entry fails for some reason, the entry is discarded and the next queue entry is processed.

State()

TState State ( ) const [inline]

Returns the state of the texture manager.

Texture(TInt)

IMPORT_C CHuiTexture * Texture ( TInt aId )

Retuns a texture having given id. Will return a blank texture if the id was not found. With this method there is a danger of editing the blank texture instead of the real texture you intended to edit.

Parameters

TInt aId

Texture(TInt)

IMPORT_C const CHuiTexture * Texture ( TInt aId ) const

Retuns a texture having given id. Will return a default blank texture if the id was not found.

Parameters

TInt aId

TextureEntry(TInt)

IMPORT_C CTextureEntry * TextureEntry ( TInt aIndex ) [protected]

Returns a texture entry.

Parameters

TInt aIndex Index of the texture.

TextureEntryCount()

IMPORT_C TInt TextureEntryCount ( ) const [protected]

Returns the number of texture entries.

TextureL(TInt)

IMPORT_C CHuiTexture * TextureL ( TInt aId )

Returns a texture associated with the given id. Will leave if no associated texture exists. If the texture is defined using the DefineFileNameL but the texture data is not yet loaded then this method call will result in LoadTextureL call.

leave
KErrNotFound If a texture with the given id does not exist.

Parameters

TInt aId Id of the retrieved texture.

TextureManagerExtension(const TUid &, TAny **)

IMPORT_C void TextureManagerExtension ( const TUid & aExtensionUid,
TAny ** aExtensionParams
) [protected, virtual]

Provides expandability, helps keeping the binary compatibility. Since virtual table is now exported and this class is dll derivable and the implementation is more difficult to change, hence this method, which can provide additional extension APIs.

Parameters

const TUid & aExtensionUid UID, which is being used for recognizing the extension
TAny ** aExtensionParams Return pointer to the extension API, once recognized from the extension uid

TextureMemUsage()

void TextureMemUsage ( ) const [private]

UnloadTexture(const TDesC &, const TInt)

IMPORT_C void UnloadTexture ( const TDesC & aImageName,
const TInt aFrameNumber = 0
)

Unloads a texture from memory.

This method releases the texture id and image name for reusing. LoadTexture().
Note:

May unload several textures from memory, if they have the sane image name assigned!

Parameters

const TDesC & aImageName
const TInt aFrameNumber = 0

UnloadTexture(TInt)

IMPORT_C void UnloadTexture ( TInt aId )

Unloads a texture from memory.

This method releases the texture id and image name for reusing. LoadTexture().

Parameters

TInt aId

UpdateFlags(const CFbsBitmap &, const CFbsBitmap *, THuiTextureUploadFlags &)

void UpdateFlags ( const CFbsBitmap & aBitmap,
const CFbsBitmap * aMaskBitmap,
THuiTextureUploadFlags & aFlags
) [private]

Update texture flags if needed.

Parameters

const CFbsBitmap & aBitmap Bitmap.
const CFbsBitmap * aMaskBitmap
THuiTextureUploadFlags & aFlags Texture flags. This returns the changed value.

UpdateTextureFromBitmapL(TInt, MHuiBitmapProvider *)

IMPORT_C void UpdateTextureFromBitmapL ( TInt aId,
MHuiBitmapProvider * aBitmapProvider = NULL
)

Update the texture content by calling the ProvideBitmapL method for the existing provider. Also a new provider can be given as a parameter. The texture must exist prior calling this method.

If EHuiTextureFlagAllowDirectBitmapUsage flag is used, the provided bitmaps should be in the preferred format. That can be found using CHuiDisplay::GetPreferredTextureFormats(). Also the bitmaps shall not be compressed or have duplicated handle.

leave
KErrNotFound The texture id does not exist or the source bitmap is not found.
leave
KErrArgument The bitmap and the mask bitmap are incompatible (different size) or in incorrect format

Parameters

TInt aId Id for the texture. Must be unique. Use zero for unassigned id.
MHuiBitmapProvider * aBitmapProvider = NULL A bitmap provider that will load the bitmaps for us. The ProvideBitmapL method of this will be called, which should load or generate the needed bitmaps.

Member Enumerations Documentation

Enum TReleaseState

Enumerators

ENormal

The texture manager is operating normally in the non-released state.

EReleasing

The texture manager is currently releasing textures.

EReleased

The texture manager is operating normally in the released state.

EPartiallyReleased

The texture manager is operating normally in the partly released state. This occurs if some of the textures cannot be released

ERestoring

The texture manager is current restoring textures.

Enum TState

States of a CHuiTextureManager object.

Enumerators

EIdle

Indicates that the manager is in idle state. A new bitmap loading operation can be started.

ELoading

Indicates that the manager is loading a bitmap.

Member Data Documentation

RArray< TAnimatedTextureGroupItem > iAnimatedTextureGroupItems

RArray < TAnimatedTextureGroupItem > iAnimatedTextureGroupItems [private]

Array of animated texture group items.

RHuiObserverArray< MHuiTimeObserver > iAnimatedTextures

RHuiObserverArray < MHuiTimeObserver > iAnimatedTextures

Animated textures.

CHuiTextureAnimationState * iAnimationWithoutGroup

CHuiTextureAnimationState * iAnimationWithoutGroup [private]

Animation state that does not belong to any group. Own.

RPointerArray< CHuiTextureAnimationState > iAnimations

RPointerArray < CHuiTextureAnimationState > iAnimations [private]

Array of animation states. Own.

CFbsBitmap * iBitmap

CFbsBitmap * iBitmap [private]

Bitmap for loading asynchronously into.

CHuiTexture * iBlankTexture

CHuiTexture * iBlankTexture [private]

Empty texture that is returned if an invalid image is specified.

TBool iEnableTexMemCalculation

TBool iEnableTexMemCalculation [private]

To do texture memory usage calculation and print it as info messages

CHuiEnv & iEnv

CHuiEnv & iEnv [private]

Environment.

RFs & iFS

RFs & iFS [private]

Open file server session for image loading.

TInt iFontIdEnumerator

TInt iFontIdEnumerator [private]

Counter for generating new font identifiers.

TBool iHasChangedTextures

TBool iHasChangedTextures [private]

Flag to optimize changed texture lookup

HBufC * iImagePath

HBufC * iImagePath [private]

Path where image files are loaded from.

RHuiObserverArray< MHuiTextureLoadingCompletedObserver > iLoadObservers

RHuiObserverArray < MHuiTextureLoadingCompletedObserver > iLoadObservers

Observers that are notified loaded textures of the manager. Applications may directly add and remove their own observers using this public property.

RArray< SLoadQueueEntry > iLoadQueue

RArray < SLoadQueueEntry > iLoadQueue [private]

Queue of loading tasks.

TBool iLoadQueueHadValidTexture

TBool iLoadQueueHadValidTexture [private]

This variable tells whether there has been a valid texture in the load queue that we have started to load in the current texture load loop. This variable indicates that we have started to load at least one texture during the load loop.

CFbsBitmap * iMaskBitmap

CFbsBitmap * iMaskBitmap [private]

Mask bitmap for loading alpha channels.

CHuiTextureProcessor * iProcessor

CHuiTextureProcessor * iProcessor [private]

Texture processor instance.

TReleaseState iReleaseState

TReleaseState iReleaseState [private]

State of the release/restore process.

TState iState

TState iState [private]

State of the texture manager.

RHuiObserverArray< MHuiTextureManagerStateChangedObserver > iStateObservers

RHuiObserverArray < MHuiTextureManagerStateChangedObserver > iStateObservers

Observers that are notified of changes in the state of the manager. Applications may directly add and remove their own observers using this public property.

RHuiObserverArray< MHuiTextureAutoSizeObserver > iTextureAutoSizeObservers

RHuiObserverArray < MHuiTextureAutoSizeObserver > iTextureAutoSizeObservers

Observers that are notified when toolkit notices a change in texture auto size e.g. it is now being drawn as different size than before. Observers are notified possibly between every frame, they should handle notifications as quickly as possible.

TBool iTextureAutoSizingEnabled

TBool iTextureAutoSizingEnabled [private]

Flag to tell wheter texture autosizing is enabled

RPointerArray< CTextureEntry > iTextures

RPointerArray < CTextureEntry > iTextures [private]

Registry of all textures within this toolkit. Accessed by texture ids (iId) or texture filenames (iFileName). Members may be NULL if a texture is not loaded.