#include <imagemanager.h>


Public Member Functions | |
| ImageManager () | |
| virtual | ~ImageManager () |
| virtual ImagePtr | create (IResourceLoader *loader=0) |
| virtual ImagePtr | create (const std::string &name, IResourceLoader *loader=0) |
| virtual ImagePtr | load (const std::string &name, IResourceLoader *loader=0) |
| virtual ImagePtr | loadBlank (uint32_t width, uint32_t height) |
| virtual ImagePtr | loadBlank (const std::string &name, uint32_t width, uint32_t height) |
| virtual ImagePtr | add (Image *res) |
| virtual bool | exists (const std::string &name) |
| virtual bool | exists (ResourceHandle handle) |
| virtual void | reload (const std::string &name) |
| virtual void | reload (ResourceHandle handle) |
| virtual void | reloadAll () |
| virtual void | loadUnreferenced () |
| virtual void | free (const std::string &name) |
| virtual void | free (ResourceHandle handle) |
| virtual void | freeAll () |
| virtual void | freeUnreferenced () |
| virtual void | remove (ImagePtr &resource) |
| virtual void | remove (const std::string &name) |
| virtual void | remove (ResourceHandle handle) |
| virtual void | removeAll () |
| virtual void | removeUnreferenced () |
| virtual ImagePtr | get (const std::string &name) |
| virtual ImagePtr | get (ResourceHandle handle) |
| virtual ResourceHandle | getResourceHandle (const std::string &name) |
An interface for managing images.
Definition at line 54 of file imagemanager.h.
| FIFE::ImageManager::ImageManager | ( | ) | [inline] |
Default constructor.
Definition at line 59 of file imagemanager.h.
| FIFE::ImageManager::~ImageManager | ( | ) | [virtual] |
Destructor.
Definition at line 42 of file imagemanager.cpp.
Add an Image to the manager
This function will create a ImagePtr and add the Image to the manager. The manager assumes ownership of the Image so DO NOT delete it.
| res | A pointer to the Image |
Definition at line 151 of file imagemanager.cpp.
References exists().
Referenced by create(), and loadBlank().

| ImagePtr FIFE::ImageManager::create | ( | IResourceLoader * | loader = 0 |
) | [virtual] |
Creates a blank Image but does not load it immediately
| loader | A pointer to the custom resource loader. The default is NULL. If this parameter is present the resource will use the loader to load instead of the default built in functions. |
Definition at line 91 of file imagemanager.cpp.
References add().
Referenced by load().

| ImagePtr FIFE::ImageManager::create | ( | const std::string & | name, | |
| IResourceLoader * | loader = 0 | |||
| ) | [virtual] |
Creates a blank Image but does not load it immediately
| name | The resource name. Typically a filename. | |
| loader | A pointer to the custom resource loader. The default is NULL. If this parameter is present the resource will use the loader to load instead of the default built in functions. |
Definition at line 96 of file imagemanager.cpp.
| bool FIFE::ImageManager::exists | ( | const std::string & | name | ) | [virtual] |
Checks to see if an Image exists
This function will search the manager for Images that match the parameter
| name | The name of the Image |
Definition at line 170 of file imagemanager.cpp.
Referenced by add(), and create().

| bool FIFE::ImageManager::exists | ( | ResourceHandle | handle | ) | [virtual] |
Checks to see if an Image exists
This function will search the manager for Images that match the parameter
| handle | The handle of the Image |
Definition at line 179 of file imagemanager.cpp.
| void FIFE::ImageManager::free | ( | const std::string & | name | ) | [virtual] |
Frees an Image from memory
The Image is not deleted but it's data is freed. This calls the Image::free() function and it is up to the resource to properly free it's memory. The manager keeps a reference to the Image in case its required in the future.
| name | The name of the Image |
Definition at line 243 of file imagemanager.cpp.
| void FIFE::ImageManager::free | ( | ResourceHandle | handle | ) | [virtual] |
Frees an Image from memory
The Image is not deleted but it's data is freed. This calls the Image::free() function and it is up to the resource to properly free it's memory. The manager keeps a reference to the Image in case its required in the future.
| handle | The handle of the Image |
Definition at line 256 of file imagemanager.cpp.
| void FIFE::ImageManager::freeAll | ( | ) | [virtual] |
Frees all Images
This calls the Image::free() function for every Image the manager is managing. It does not remove them from the manager.
Definition at line 268 of file imagemanager.cpp.
| void FIFE::ImageManager::freeUnreferenced | ( | ) | [virtual] |
Frees all unreferenced Image
This calls the IResource::free() function for Images that have no external references to them. It does not remove them from the manager.
Definition at line 284 of file imagemanager.cpp.
| ImagePtr FIFE::ImageManager::get | ( | const std::string & | name | ) | [virtual] |
Gets a shared pointer to the Image
If the Image is not defined it will attempt to create and load the Image based on the name (it assumes the name is a filename)
| name | The name of the Image |
Definition at line 394 of file imagemanager.cpp.
References load().
| ImagePtr FIFE::ImageManager::get | ( | ResourceHandle | handle | ) | [virtual] |
Gets a shared pointer to the Image
If the resource is not defined it returns an empty (or invalid) ImagePtr and makes an entry in the log.
| handle | The handle of the resource |
Definition at line 410 of file imagemanager.cpp.
| ResourceHandle FIFE::ImageManager::getResourceHandle | ( | const std::string & | name | ) | [virtual] |
Gets an Image handle by name
Returns the Image handle associated with the name
| name | The name of the Image |
Definition at line 448 of file imagemanager.cpp.
| ImagePtr FIFE::ImageManager::load | ( | const std::string & | name, | |
| IResourceLoader * | loader = 0 | |||
| ) | [virtual] |
Creates a blank resource and loads it from disk
This function will create the Image if necessary and load the Image from disk. If the Image is not defined it will call ImageManager::create() before loading.
| name | The resource name. Typically a filename. | |
| loader | A pointer to the custom resource loader. The default is NULL. If this parameter is present the resource will use the loader to load instead of the default built in functions. |
Definition at line 106 of file imagemanager.cpp.
References create().
Referenced by get().

| ImagePtr FIFE::ImageManager::loadBlank | ( | const std::string & | name, | |
| uint32_t | width, | |||
| uint32_t | height | |||
| ) | [virtual] |
Loads a blank resource
| name | ||
| width | ||
| height |
Definition at line 138 of file imagemanager.cpp.
References add().
| ImagePtr FIFE::ImageManager::loadBlank | ( | uint32_t | width, | |
| uint32_t | height | |||
| ) | [virtual] |
Loads a blank resource
| width | ||
| height |
Definition at line 129 of file imagemanager.cpp.
References add().
| void FIFE::ImageManager::loadUnreferenced | ( | ) | [virtual] |
Loads all unreferenced Images
All Images that have no external references will be loaded into memory.
Definition at line 229 of file imagemanager.cpp.
| void FIFE::ImageManager::reload | ( | ResourceHandle | handle | ) | [virtual] |
Reloads a resource
This function will reload an Image if it is managed by the manager. If not it creates an entry in the log specifying that the Image could not be found. It will load the Image if it is not already loaded.
| handle | The handle of the resource |
Definition at line 202 of file imagemanager.cpp.
| void FIFE::ImageManager::reload | ( | const std::string & | name | ) | [virtual] |
Reloads an Image
This function will reload an Image if it is managed by the manager. If not it creates an entry in the log specifying that the Image could not be found. It will load the Image if it is not already loaded.
| name | The name of the resource |
Definition at line 188 of file imagemanager.cpp.
| void FIFE::ImageManager::reloadAll | ( | ) | [virtual] |
Reloads all Images
This function will reload all Images managed by the manager. It will load an Image if it is not already loaded.
Definition at line 217 of file imagemanager.cpp.
| void FIFE::ImageManager::remove | ( | const std::string & | name | ) | [virtual] |
Removes an Image from the manager
This removes all references to the Image from the manager. It does not however guarantee that the resources destructor is called. If the client has any left over references to the resource it will not be freed.
| name | The name of the Image |
Definition at line 316 of file imagemanager.cpp.
| void FIFE::ImageManager::remove | ( | ResourceHandle | handle | ) | [virtual] |
Removes an Image from the manager
This removes all references to the Image from the manager. It does not however guarantee that the resources destructor is called. If the client has any left over references to the resource it will not be freed.
| handle | The handle of the Image |
Definition at line 338 of file imagemanager.cpp.
| void FIFE::ImageManager::remove | ( | ImagePtr & | resource | ) | [virtual] |
Removes an Image from the manager
This removes all references to the Image from the manager. It does not however guarantee that the resources destructor is called. If the client has any left over references to the resource it will not be freed.
| resource | A ImagePtr to the image to be removed from the manager |
Definition at line 299 of file imagemanager.cpp.
| void FIFE::ImageManager::removeAll | ( | ) | [virtual] |
Removes all Images from the manager
This effectively removes all references to all Images from the manager. If there are left over shared pointers to any resources they will not be deleted.
Definition at line 361 of file imagemanager.cpp.
| void FIFE::ImageManager::removeUnreferenced | ( | ) | [virtual] |
Removes all unreferenced Images
This effectively removes all Images that dont have an external reference. The resources will be deleted.
Definition at line 373 of file imagemanager.cpp.
1.7.1