CimageManager allows all the image loading for an application to happen in once nice tidy place.
This class is heavily under construction and as such you are advised to *not use it yet!*.
1.0.1 Added getImageOnPath function
Definition at line 44 of file CImageManager.hpp.
static bool Exponent::GUI::Graphics::CImageManager::addAnimation | ( | const CSystemString & | path, | |
const CString & | filename, | |||
const CString & | referenceName, | |||
const long | frameHeight, | |||
const long | numberOfFrames | |||
) | [static] |
Add an animation image
path | The folder that contains the image | |
filename | The name of the file to load. Currently only TGA 32bpp format is supported | |
referenceName | The name to refere to the image with, this must be unique | |
frameHeight | The height of each frame | |
numberOfFrames | The number of frames in the image |
bool | True if the image was loaded, false otherwise |
static bool Exponent::GUI::Graphics::CImageManager::addImage | ( | const CSystemString & | path, | |
const CString & | filename, | |||
const CString & | referenceName | |||
) | [static] |
Add an image to the manager
path | The folder that contains the image | |
filename | The name of the file to load. Currently only TGA 32bpp format is supported | |
referenceName | The name to refere to the image with, this must be unique |
bool | True if the image was loaded, false otherwise |
static void Exponent::GUI::Graphics::CImageManager::clearImageLibrary | ( | ) | [static] |
Remove all the items from the image library
static CImageManager::CAnimationReference* Exponent::GUI::Graphics::CImageManager::getAnimation | ( | const CString & | referenceName | ) | [static] |
Get an animation image with a specific name
referenceName | The name of the image |
CAnimationReference* | The image requeseted or null on error |
static IImage* Exponent::GUI::Graphics::CImageManager::getAnimation | ( | const CString & | referenceName, | |
long & | frameHeight, | |||
long & | numberOfFrames | |||
) | [static] |
Get an animation image with a specific name
referenceName | The name of the image | |
frameHeight | On return contains the height of each frame | |
numberOfFrames | On return contains the number of frames in the image |
IImage | * The image requeseted or null on error |
static const CSystemString& Exponent::GUI::Graphics::CImageManager::getDefaultPathToImages | ( | ) | [inline, static] |
Get the default path
const | CSystemString& The default image path |
Definition at line 237 of file CImageManager.hpp.
References CIMAGE_MANAGER_DEFAULT_RESOURCE_PATH.
static IImage* Exponent::GUI::Graphics::CImageManager::getImage | ( | const CString & | referenceName | ) | [static] |
Get an image with a specific name
referenceName | The name of the image |
IImage | * The image requeseted or null on error |
static IImage* Exponent::GUI::Graphics::CImageManager::getImageOnPath | ( | const CSystemString & | path | ) | [static] |
Get an image from a path
path | The path to the image |
IImage* | The image or NULL on error |
static CString Exponent::GUI::Graphics::CImageManager::getReferenceNameForImage | ( | const IImage * | image | ) | [static] |
Get a reference name for an image
image | The image |
CString | The reference name or CSTRING_EMPTY_STRING on error |
static bool Exponent::GUI::Graphics::CImageManager::loadFromDefinitionFile | ( | const CSystemString & | filename | ) | [static] |
Load the images from a file
The image manager expects the filename to point to a valid xml document. Each xml document should have (inside the root) two children, one for animations, one for images
The images have 3 tags, The relative path, the filename and the reference name
The animations have five attributes, the 3 above, a frame height (height of each frame in the image list) and a number of frames (total number of frames in animation)
Here is example code to write a definition file
// Add to a root node CXMLNode *root = new CXMLNode(CIMAGE_MANAGER_XML_TAG_ROOT, NULL); root->addAttribute(CIMAGE_MANAGER_XML_TAG_VERSION, "1.0.0"); // Currently only one defined. But make sure you include for future usage // One image and one animation node CXMLNode *images = new CXMLNode(CIMAGE_MANAGER_XML_TAG_IMAGES, root); CXMLNode *animations = new CXMLNode(CIMAGE_MANAGER_XML_TAG_ANIMATIONS, root); // Add our images CXMLNode *myImage = new CXMLNode(CIMAGE_MANAGER_XML_TAG_CHILD_IMAGE, images); myImage->addAttribute(CIMAGE_MANAGER_XML_ATTRIBUTE_IMAGE_RELATIVE_PATH, "/Path/To/Place"); myImage->addAttribute(CIMAGE_MANAGER_XML_ATTRIBUTE_IMAGE_FILENAME, "MyImage.tga"); myImage->addAttribute(CIMAGE_MANAGER_XML_ATTRIBUTE_IMAGE_NAME, "MyImagesName"); // Add our animations CXMLNode *myAnimation = new CXMLNode(CIMAGE_MANAGER_XML_TAG_CHILD_IMAGE, animations); myAnimation->addAttribute(CIMAGE_MANAGER_XML_ATTRIBUTE_IMAGE_RELATIVE_PATH, "/Path/To/Place"); myAnimation->addAttribute(CIMAGE_MANAGER_XML_ATTRIBUTE_IMAGE_FILENAME, "MyImage.tga"); myAnimation->addAttribute(CIMAGE_MANAGER_XML_ATTRIBUTE_IMAGE_NAME, "MyImagesName"); myAnimation->addAttribute(CIMAGE_MANAGER_XML_ATTRIBUTE_ANIMATION_FRAME_HEIGHT, "25"); myAnimation->addAttribute(CIMAGE_MANAGER_XML_ATTRIBUTE_ANIMATION_NUM_FRAMES, "127");
filename | The name of the file that contains the image definitons |
bool | True if loaded properly, false otherwise |
static bool Exponent::GUI::Graphics::CImageManager::readFromXML | ( | const CSystemString & | filename | ) | [static, protected] |
Read from an XML document
filename | The name of the file to load |
bool | TRue if loaded, false otherwise |
static void Exponent::GUI::Graphics::CImageManager::setDefaultPathToImages | ( | const CSystemString & | defaultPath | ) | [static] |
Set the default path to images
defaultPath | The default path. All added images expect path parameter to be relative to tis position |
TCountedPointerArray<CAnimationReference> Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_ANIMATIONS [static, protected] |
The array of animation images
Definition at line 372 of file CImageManager.hpp.
CSystemString Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_DEFAULT_RESOURCE_PATH [static, protected] |
Default resource path
Definition at line 373 of file CImageManager.hpp.
Referenced by getDefaultPathToImages().
TCountedPointerArray<CImageReference> Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_IMAGES [static, protected] |
The array of normal images
Definition at line 371 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_ATTRIBUTE_ANIMATION_FRAME_HEIGHT[] [static] |
The attribute name fot the animations number of frames
Definition at line 61 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_ATTRIBUTE_ANIMATION_NUM_FRAMES[] [static] |
The attribute name fot the animations number of frames
Definition at line 62 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_ATTRIBUTE_IMAGE_FILENAME[] [static] |
The attribute name for the image filename
Definition at line 58 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_ATTRIBUTE_IMAGE_NAME[] [static] |
The attribute name for the image reference
Definition at line 59 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_ATTRIBUTE_IMAGE_RELATIVE_PATH[] [static] |
The attribute name for the image relative path
Definition at line 57 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_TAG_ANIMATIONS[] [static] |
The tag used to start the animations block
Definition at line 54 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_TAG_CHILD_IMAGE[] [static] |
The tag used to declare an image
Definition at line 56 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_TAG_IMAGES[] [static] |
The tag used to start the images block
Definition at line 53 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_TAG_ROOT[] [static] |
The tag used for the root of an image xml file
Definition at line 51 of file CImageManager.hpp.
const char Exponent::GUI::Graphics::CImageManager::CIMAGE_MANAGER_XML_TAG_VERSION[] [static] |
Version of the XML file
Definition at line 52 of file CImageManager.hpp.