The standard implementation of the IImageEngine interface. ImageEngine is the respository for all of the ImageSets loaded from the current RuleSets. Each ImageSet is stored in a string-based hash map where the ImageSet key is the string key in the hash. Since multiple ImageSets may have the same key, each string in the hash is mapped to a std::list of ImageSets, so that multiple ImageSets can share the same key in peace and harmony. The functions required by the IImageEngine interface are implemented by taking the hash and performing the necessary operations. See the function documentation below for details.
ImageEngine.h
The standard implementation of the IImageEngine interface. | |
Stops the ImageEngine. | |
Returns a single image based on the key/name combination. | |
Fills an array with all images belonging to a given key. | |
Reads images from a .tex file. | |
Loads images from a .tex file on demand. | |
The string hash of ImageSets. |
| void Stop() |
Stops the ImageEngine. Clears the hash of ImageSets.
|
Returns a single image based on the key/name combination. The image is scaled to the given size, if any. If the key does not exist, or the name does not exist in the given key, an error message is thrown to the screen.
NOTE: Returning a wxImage by value is acceptable, because wxImage is reference counted internally and no data is actually copied.
| key | The image group key to search in. |
| name | The image name to look up. |
| size | The size of the outgoing image. |
The image. May be an empty image if the image was not based on the given key and name.
|
Fills an array with all images belonging to a given key. The array is filled with std::pair<wxString, wxImage> combinations The string is the name of the image, and the wxImage is the image itself.
| key | The image group key of the images to retrieve. |
| array | The outgoing array of string/image pairs. |
Loads images from a .tex file on demand. | |
The string hash of ImageSets. |
|
Loads images from a .tex file on demand. The image retrieval strategy for ImageEngine assumes that any image loaded from a certain .tex file probably means that another request for an image from that same .tex file is going to come soon. Therefore, it keeps the currently loaded .tex file in a local cache. The LoadOnDemand function manages that local cache, only loading a new .tex file when the existing one doesn’t provide the image the caller is looking for.
| filename | The name of the .tex file the image is in. |
| size | The number of images in the .tex file. |
| ImageSetHash mImageSetHash |
The string hash of ImageSets. All of the loaded ImageSets are stored grouped together by their key. Any particular key may have multiple ImageSets to look through in order to find exactly which image to use, so each string key in the hash actually maps to a std::list of ImageSets that might all share the key.
| void Stop() |
|
|
|
|
| ImageSetHash mImageSetHash |