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 TIntAddAnimatedTextureGroupL(const RArray< TInt > &)
IMPORT_C voidAdvanceTime(TReal32)
IMPORT_C voidAppendTextureL(CHuiTexture *, TInt)
IMPORT_C const CHuiTexture &BlankTexture()
IMPORT_C CHuiTexture &BlankTexture()
IMPORT_C voidClearChangedTextures()
IMPORT_C CHuiTexture &CreateTextureL(TInt, MHuiBitmapProvider *, THuiTextureUploadFlags)
IMPORT_C voidDefineFileNameL(TInt, const TDesC &)
voidEnableAutoSizeCalculation(TBool)
IMPORT_C voidEnableTexMemoryCalculation(TBool)
IMPORT_C CHuiEnv &Env()
TInt EstimatedTextureMemUsage(TInt)
IMPORT_C const TDesC &ImagePath()
IMPORT_C TBoolIsLoaded(const TDesC &, const TInt)
IMPORT_C TBoolIsLoaded(TInt)
IMPORT_C TBoolIsLoaded(const CHuiTexture *)
IMPORT_C TIntLoadQueueCount()
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 voidNotifySkinChangedL()
IMPORT_C voidPrependImagePath(TDes &)
IMPORT_C CHuiTextureProcessor &Processor()
IMPORT_C TBoolRelease()
IMPORT_C voidRemoveAnimatedTextureGroup(TInt)
IMPORT_C voidRemoveTexture(CHuiTexture &)
IMPORT_C voidRestoreL()
IMPORT_C voidSetHasChangedTextures()
IMPORT_C voidSetImagePathL(const TDesC &)
IMPORT_C TBoolSetTextureId(CHuiTexture *, TInt)
TState State()
IMPORT_C CHuiTexture *Texture(TInt)
IMPORT_C const CHuiTexture *Texture(TInt)
IMPORT_C CHuiTexture *TextureL(TInt)
IMPORT_C voidUnloadTexture(const TDesC &, const TInt)
IMPORT_C voidUnloadTexture(TInt)
IMPORT_C voidUpdateTextureFromBitmapL(TInt, MHuiBitmapProvider *)
Protected Member Functions
CHuiTextureManager(CHuiEnv &)
IMPORT_C voidBaseConstructL()
IMPORT_C TIntCheckTexture(const TDesC &, TInt)
IMPORT_C TIntCheckTexture(TInt)
NONSHARABLE_CLASS(CTextureEntry)
IMPORT_C voidNotifyTextureLoaded(CHuiTexture &, TInt, TInt)
IMPORT_C voidSetProcessor(CHuiTextureProcessor *)
IMPORT_C CTextureEntry *TextureEntry(TInt)
IMPORT_C TIntTextureEntryCount()
IMPORT_C voidTextureManagerExtension(const TUid &, TAny **)
Private Member Functions
voidCancelLoadingOfTexture(CHuiTexture &)
CHuiTextureAnimationState *CreateAnimationStateL(TInt, const TDesC &, TInt, TInt)
IMPORT_C CHuiTexture &CreateTextureL(CFbsBitmap &, const CFbsBitmap *, THuiTextureUploadFlags, TInt)
IMPORT_C voidDoCancel()
voidDoLoadNextL()
voidDoUnload(TInt)
CHuiTextureAnimationState *FindAnimationState(TInt)
TBool FindGroupIdByTextureId(TInt, TInt &)
RFs &FsSession()
voidImageLoadingCompleteL(SLoadQueueEntry &)
TInt ImageLoadingContinue()
TBool IsInLoadQueue(const CHuiTexture *)
TBool IsInLoadQueue(TInt)
TBool NeedsAnimationState(const CImageDecoder &)
voidNotifyStateChange()
voidNotifyTextureAutoSizeObservers()
SLoadQueueEntry PopLoadedQueueEntry()
voidProcessAnimatedFrameL(SLoadQueueEntry &)
voidRemoveAnimationState(CHuiTextureAnimationState *)
IMPORT_C TIntRunError(TInt)
IMPORT_C voidRunL()
voidStartLoading()
voidTextureMemUsage()
voidUpdateFlags(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
enumTState { EIdle, ELoading }
Protected Member Enumerations
enumTReleaseState { 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_CCHuiTextureManager(CHuiEnv &aEnv)[protected]

Constructor.

Parameters

CHuiEnv & aEnv

~CHuiTextureManager()

IMPORT_C~CHuiTextureManager()[virtual]

Destructor.

Member Functions Documentation

AddAnimatedTextureGroupL(const RArray< TInt > &)

IMPORT_C TIntAddAnimatedTextureGroupL(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 > & aTextureIdstexture ids that form a group.

AdvanceTime(TReal32)

IMPORT_C voidAdvanceTime(TReal32aElapsedTime)const

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

Parameters

TReal32 aElapsedTime

AppendTextureL(CHuiTexture *, TInt)

IMPORT_C voidAppendTextureL(CHuiTexture *aTexture,
TIntaId = 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 * aTextureTexture to transfer to the manager.
TInt aId = 0Id for the texture. Must be unique. Use zero for unassigned id.

BaseConstructL()

IMPORT_C voidBaseConstructL()[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 &)

voidCancelLoadingOfTexture(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 & aTextureReference to the texture of which load is cancelled.

CheckTexture(const TDesC &, TInt)

IMPORT_C TIntCheckTexture(const TDesC &aFileName,
TIntaFrameNumber = 0
)const [protected]

Check the existence of a texture.

Parameters

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

CheckTexture(TInt)

IMPORT_C TIntCheckTexture(TIntaId)const [protected]

Check the existence of a texture.

Parameters

TInt aIdId of the texture to check.

ClearChangedTextures()

IMPORT_C voidClearChangedTextures()

Clears texture changed flags.

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

CHuiTextureAnimationState *CreateAnimationStateL(TIntaGroupId,
const TDesC &aImageFile,
TIntaFrameNumber,
TIntaFrameCount
)[private]

Creates animation state.

Parameters

TInt aGroupIdgroup id.
const TDesC & aImageFileimage file.
TInt aFrameNumberframe number.
TInt aFrameCountframe count.

CreateTextureL(TInt, MHuiBitmapProvider *, THuiTextureUploadFlags)

IMPORT_C CHuiTexture &CreateTextureL(TIntaId,
MHuiBitmapProvider *aBitmapProvider,
THuiTextureUploadFlagsaFlags
)

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 aIdId for the texture. Must be unique. Use zero for unassigned id.
MHuiBitmapProvider * aBitmapProviderA 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 aFlagsSpecify 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,
THuiTextureUploadFlagsaFlags,
TIntid
)[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 & aBitmapThe source bitmap from which the texture is created.
const CFbsBitmap * aMaskPointer 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 voidDefineFileNameL(TIntaId,
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 voidDoCancel()[private, virtual]

Cancel active object operation.

DoLoadNextL()

voidDoLoadNextL()[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)

voidDoUnload(TIntindex)[private]

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

Parameters

TInt index

EnableAutoSizeCalculation(TBool)

voidEnableAutoSizeCalculation(TBoolaEnable = ETrue)

Enables (or disables) texture autosize calculations.

Parameters

TBool aEnable = ETrue

EnableTexMemoryCalculation(TBool)

IMPORT_C voidEnableTexMemoryCalculation(TBoolaEnableTeMemCal)

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(TIntaAverageBitsPerPixel)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(TIntaGroupId)[private]

Finds animation state owned by aGroupId.

Parameters

TInt aGroupId

FindGroupIdByTextureId(TInt, TInt &)

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

Finds group id by texture id.

Parameters

TInt aTextureIdtexture id to look for.
TInt & aGroupIdupdated to contain found group id.

FsSession()

RFs &FsSession()const [private]

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

ImageLoadingCompleteL(SLoadQueueEntry &)

voidImageLoadingCompleteL(SLoadQueueEntry &aEntry)[private]

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

Parameters

SLoadQueueEntry & aEntryqueue 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(TIntid)const [private]

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

Parameters

TInt id

IsLoaded(const TDesC &, const TInt)

IMPORT_C TBoolIsLoaded(const TDesC &aImageName,
const TIntaFrameNumber = 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 & aImageNameName of the image bitmap file to check. ImagePath (if set) will be prepended to this name.
const TInt aFrameNumber = 0

IsLoaded(TInt)

IMPORT_C TBoolIsLoaded(TIntaId)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 aIdId of the texture.

IsLoaded(const CHuiTexture *)

IMPORT_C TBoolIsLoaded(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 * aTextureTexture object.

LoadQueueCount()

IMPORT_C TIntLoadQueueCount()const

Returns the number of images waiting to be loaded.

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

IMPORT_C CHuiTexture &LoadTextureL(const TDesC &aImageFileName,
THuiTextureUploadFlagsaFlags = EHuiTextureUploadFlagDefault,
TIntaId = 0,
TIntaFrameNumber = 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 & aImageFileNameName 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 = EHuiTextureUploadFlagDefaultSpecify flags for the texture loading and uploading - how to convert the bitmap to texture.
TInt aId = 0Id 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 TIntaId,
const TSize &aTextureMaxSize =  TSize(0, 0),
THuiTextureUploadFlagsaFlags = 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 aIdThe 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 = EHuiTextureUploadFlagDefaultSpecify 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,
THuiTextureUploadFlagsaFlags = EHuiTextureUploadFlagDefault,
TIntaId = 0,
TIntaFrameNumber = 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 & aImageNameName 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 & aTextureMaxSizeCan 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 = EHuiTextureUploadFlagDefaultSpecify load/upload behavior - how to convert the bitmap to texture.
TInt aId = 0Id 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 & aDecoderdecoder.

NotifySkinChangedL()

IMPORT_C voidNotifySkinChangedL()

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

NotifyStateChange()

voidNotifyStateChange()const [private]

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

NotifyTextureAutoSizeObservers()

voidNotifyTextureAutoSizeObservers()const [private]

NotifyTextureLoaded(CHuiTexture &, TInt, TInt)

IMPORT_C voidNotifyTextureLoaded(CHuiTexture &aTexture,
TIntaTextureId,
TIntaErrorCode
)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 voidPrependImagePath(TDes &aFileName)const

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

Parameters

TDes & aFileName

ProcessAnimatedFrameL(SLoadQueueEntry &)

voidProcessAnimatedFrameL(SLoadQueueEntry &aEntry)[private]

Processes animated frame.

Parameters

SLoadQueueEntry & aEntryqueue entry.

Processor()

IMPORT_C CHuiTextureProcessor &Processor()

Returns a reference to the texture processor.

panic
THuiPanic::ETextureManagerNoProcessor Texture processor is not available.

Release()

IMPORT_C TBoolRelease()[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 voidRemoveAnimatedTextureGroup(TIntaGroupId)

Removes animated texture group.

Parameters

TInt aGroupIdanimated texture group id.

RemoveAnimationState(CHuiTextureAnimationState *)

voidRemoveAnimationState(CHuiTextureAnimationState *aState)[private]

Removes animation state.

Parameters

CHuiTextureAnimationState * aStatestate to be removed.

RemoveTexture(CHuiTexture &)

IMPORT_C voidRemoveTexture(CHuiTexture &aTexture)[virtual]

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

Parameters

CHuiTexture & aTextureTexture to remove from management.

RestoreL()

IMPORT_C voidRestoreL()[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 TIntRunError(TIntaError)[private, virtual]

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

Parameters

TInt aError

RunL()

IMPORT_C voidRunL()[private, virtual]

Called when image loading (decoding) operation is complete.

SetHasChangedTextures()

IMPORT_C voidSetHasChangedTextures()

Sets a flag that indicates that there are changed textures.

SetImagePathL(const TDesC &)

IMPORT_C voidSetImagePathL(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 & aPathPath for bitmap files.

SetProcessor(CHuiTextureProcessor *)

IMPORT_C voidSetProcessor(CHuiTextureProcessor *aProcessor)[protected]

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

Parameters

CHuiTextureProcessor * aProcessorTexture processor instance. Ownership is transferred.

SetTextureId(CHuiTexture *, TInt)

IMPORT_C TBoolSetTextureId(CHuiTexture *aTexture,
TIntaId
)

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

Parameters

CHuiTexture * aTextureThe managed texture whose ID we want to change.
TInt aIdThe texture ID that we want to assign to the managed texture.

StartLoading()

voidStartLoading()[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(TIntaId)

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(TIntaId)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(TIntaIndex)[protected]

Returns a texture entry.

Parameters

TInt aIndexIndex of the texture.

TextureEntryCount()

IMPORT_C TIntTextureEntryCount()const [protected]

Returns the number of texture entries.

TextureL(TInt)

IMPORT_C CHuiTexture *TextureL(TIntaId)

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 aIdId of the retrieved texture.

TextureManagerExtension(const TUid &, TAny **)

IMPORT_C voidTextureManagerExtension(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 & aExtensionUidUID, which is being used for recognizing the extension
TAny ** aExtensionParamsReturn pointer to the extension API, once recognized from the extension uid

TextureMemUsage()

voidTextureMemUsage()const [private]

UnloadTexture(const TDesC &, const TInt)

IMPORT_C voidUnloadTexture(const TDesC &aImageName,
const TIntaFrameNumber = 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 voidUnloadTexture(TIntaId)

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 &)

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

Update texture flags if needed.

Parameters

const CFbsBitmap & aBitmapBitmap.
const CFbsBitmap * aMaskBitmap
THuiTextureUploadFlags & aFlagsTexture flags. This returns the changed value.

UpdateTextureFromBitmapL(TInt, MHuiBitmapProvider *)

IMPORT_C voidUpdateTextureFromBitmapL(TIntaId,
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 aIdId for the texture. Must be unique. Use zero for unassigned id.
MHuiBitmapProvider * aBitmapProvider = NULLA 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.