Alf::ResourcePool Class Reference
Resoure pool is responsible of controlling commonly used image resources in an application. The resources will be indentified by tags, which are not case sensitive.
// create image resources
resourcePool->createLogicalImageResource( "qgn_indi_find_glass" );
resourcePool->setInitialSize( "qgn_indi_find_glass", XYMetric( 64, 64 ) );
resourcePool->setAspectRatio( "qgn_indi_find_glass", ResourcePool::aspectRatioPreserved );
resourcePool->createImageResource(
"my_face",
pic0001.jpg );
// utilize the resource
imageVisual->setImage(
resourcePool->getImageResource( "qgn_indi_find_glass" ) );
sharpImageVisual->setImage(
resourcePool->getImageResource( "my_face" ),
XYMetric( 256, 256 ) );
// when the resource in not used anymore, the resource can be deleted
resourcePool->deleteImageResource( "qgn_indi_find_glass" );
resourcePool->deleteImageResource( "my_face" );
alfresourcepool.lib
- Since
- S60 v5.0.1
Constructor & Destructor Documentation
ResourcePool(CAlfTextureManager &, ResourcePool *)
OSN_IMPORT | ResourcePool | ( | CAlfTextureManager & | aTextureManager, |
| ResourcePool * | aParentPool = NULL |
| ) | |
Constructs a resource pool
Parameters
CAlfTextureManager & aTextureManager | Used texture manager. |
ResourcePool * aParentPool = NULL | Chained parent pool (optional) - not supported currently |
~ResourcePool()
OSN_IMPORT | ~ResourcePool | ( | ) | |
Member Functions Documentation
createFileImageResource(const Utf8 *, const UString &, TAlfTextureFlags)
OSN_IMPORT void | createFileImageResource | ( | const Utf8 * | aTag, |
| const UString & | aFileName, |
| TAlfTextureFlags | aFlag = EAlfTextureFlagLoadAnimAsImage |
| ) | |
Creates an image resource based on a file name. The aFileName can be a full path with the drive letter or it can be relative path to the texture manager defaul path
TextureManager::setImagePath()
Parameters
const Utf8 * aTag | Resource tag. |
const UString & aFileName | File name. |
TAlfTextureFlags aFlag = EAlfTextureFlagLoadAnimAsImage | How to convert the bitmap to texture default all fileimages will be treated as nonanimated |
createLogicalImageResource(const Utf8 *)
OSN_IMPORT void | createLogicalImageResource | ( | const Utf8 * | aTag | ) | |
Creates an image resource based on a logical name. The name will be also used as the image resource tag because the logical name is unique in the system.
The logical name should be format "qgn_xxx_xxx" i.e. as stated in the S60 reference icons document.
Note:
The KAknsIIDQgnXxxXxx format works for a while but it will be deprecated -> use the qgn_xxx_xxx format.
- Exceptions
-
Parameters
const Utf8 * aTag | Resource tag. NULL terminated 8-bit string |
createThemeImageResource(const Utf8 *, const UString &)
OSN_IMPORT void | createThemeImageResource | ( | const Utf8 * | aTag, |
| const UString & | aThemeDefinition |
| ) | |
Creates an image resource based on a theme definition. This definition may concists of several different theme systems.
Currently supported formats: #1 S60 Skin; s60;mifFilePath;mifImageIndex;mifMaskIndex;majorID;minorId
s60: literal "s60", which specifies that the following item definition is based on the S60 Skin system mifFilePath: literal into the multibitmap file (mif/mbm). Can be empty. mifImageIndex:unsigned integer which is the index to the mifFilePath. Only used if mifFilePath is given. mifMaskIndex: unsigned integer which is the mask index to the mifFilePath. Only used if mifFilePath is given. majorID: unsigned integer or hexadecimal starting with 0x of the Major skin ID. Can be empty. minorId: unsigned integer or hexadecimal starting with 0x of the Minor skin ID. Only used if majorID is given.
examples: "s60;;;;268457670;76" // 0x100056c6;0x4c -> KAknsIIDQgnIndiFindGlass "s60;c:\myFile.mif;1;2;;" "s60;myMbmFile.mbm;435;;2342345;234" // If skin ID not found, use mbm file with index 435 (no mask)
Parameters
const Utf8 * aTag | Resource tag. |
const UString & aThemeDefinition | Definition of the theme element. |
deleteImageResource(const Utf8 *)
OSN_IMPORT void | deleteImageResource | ( | const Utf8 * | aTag | ) | |
Parameters
const Utf8 * aTag | Resource tag. |
getImageResource(const Utf8 *)
OSN_IMPORT TAlfImage | getImageResource | ( | const Utf8 * | aTag | ) | |
Finds a image resource with the given tag. The initial size or system default size is used.
If the given resource is not found, the Image::hasTexture() returns false.
Parameters
const Utf8 * aTag | Resource tag. |
getImageResource(const Utf8 *, const TAlfXYMetric &)
OSN_IMPORT TAlfImage | getImageResource | ( | const Utf8 * | aTag, |
| const TAlfXYMetric & | aSizeHint |
| ) | |
Finds a image resouce with the given tag. The size hint may be used to find/re-rasterize the image resource.
If the given resource is not found, the Image::hasTexture() returns false.
Parameters
const Utf8 * aTag | Resource tag. |
const TAlfXYMetric & aSizeHint | Rasteration size hint (only Pixel and RelativeToDisplay supported) |
hasImageResource(const Utf8 *)
OSN_IMPORT bool | hasImageResource | ( | const Utf8 * | aTag | ) | const |
Checks if the given resource identifier exists.
Parameters
const Utf8 * aTag | Resource tag. |
setAspectRatio(const Utf8 *, AspectRatio)
OSN_IMPORT void | setAspectRatio | ( | const Utf8 * | aTag, |
| AspectRatio | aAspectRatio |
| ) | |
Sets aspect ratio mode. This affects to the aspect ratio of the loaded image resource. The new setting will take place when the image resource is loaded.
Note:
Currently only SVG icons are supported. For file image loading, the aspect ratio is preserved.
The blitting of the image resource can still scale and change the aspect ratio of the drawn image.
ImageVisual::setScaleMode
Parameters
const Utf8 * aTag | Resource tag. |
AspectRatio aAspectRatio | Used aspect ratio. |
setInitialSize(const Utf8 *, const TAlfXYMetric &)
OSN_IMPORT void | setInitialSize | ( | const Utf8 * | aTag, |
| const TAlfXYMetric & | aInitialSizeHint |
| ) | |
Sets initial/default loading size for the image resource. The given size is only a hint and the resource pool may used it or ignore it. Without the initial size hint, the image will be rasterized to size determined by the resource pool. The initial size hint can be overridden with the appropriate getImageResource() function.
Parameters
const Utf8 * aTag | Resource tag. |
const TAlfXYMetric & aInitialSizeHint | Initial/default size hint (only Pixel and RelativeToDisplay supported) |
Member Enumerations Documentation
Enum AspectRatio
Enumerators
aspectRatioPreserved = 0 | |
aspectRatioPreservedAndUnusedSpaceRemoved = 1 | |
aspectRatioNotPreserved = 2 | |
aspectRatioPreservedSlice = 3 | |
Member Data Documentation
auto_ptr< ResourcePoolImpl > mResourcePoolImpl
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.