#include <ImageCache.h>
Public Types | |
| typedef boost::shared_ptr< vigra::BRGBImage > | ImageCacheRGB8Ptr |
| use reference counted pointers | |
| typedef boost::shared_ptr< vigra::UInt16RGBImage > | ImageCacheRGB16Ptr |
| typedef boost::shared_ptr< vigra::FRGBImage > | ImageCacheRGBFloatPtr |
| typedef boost::shared_ptr< vigra::BImage > | ImageCache8Ptr |
| typedef boost::shared_ptr< Entry > | EntryPtr |
| a shared pointer to the entry | |
| typedef boost::shared_ptr< Request > | RequestPtr |
| Reference counted request for an image to load. | |
Public Member Functions | |
| virtual | ~ImageCache () |
| dtor. | |
| EntryPtr | getImage (const std::string &filename) |
| get a image. | |
| EntryPtr | getImageIfAvailable (const std::string &filename) |
| Get an image if already loaded. | |
| EntryPtr | getSmallImage (const std::string &filename) |
| get an small image. | |
| EntryPtr | getSmallImageIfAvailable (const std::string &filename) |
| Get a small image if already loaded. | |
| RequestPtr | requestAsyncImage (const std::string &filename) |
| Request an image be loaded. | |
| RequestPtr | requestAsyncSmallImage (const std::string &filename) |
| Request a small image be loaded. | |
| void | removeImage (const std::string &filename) |
| remove a specific image (and dependant images) from the cache | |
| void | flush () |
| release all images in the cache. | |
| void | softFlush () |
| a soft version of flush. | |
| void | SetUpperLimit (long newUpperLimit) |
| sets the upper limit, which is used by softFlush() | |
| void | postEvent (RequestPtr request, EntryPtr entry) |
| Pass on a loaded event for any images loaded asynchronously. | |
| void | setProgressDisplay (AppBase::MultiProgressDisplay *disp) |
| void | clearProgressDisplay (AppBase::MultiProgressDisplay *disp) |
Static Public Member Functions | |
| ImageCache & | getInstance () |
| get the global ImageCache object | |
Public Attributes | |
| void(* | asyncLoadCompleteSignal )(RequestPtr, EntryPtr) |
| Signal for when a asynchronous load completes. | |
Private Member Functions | |
| ImageCache () | |
| void | spawnAsyncThread () |
| Start a background thread to load an image. | |
Static Private Member Functions | |
| template<class SrcPixelType, class DestIterator, class DestAccessor> | |
| void | importAndConvertImage (const vigra::ImageImportInfo &info, vigra::pair< DestIterator, DestAccessor > dest, const std::string &type) |
| template<class SrcPixelType, class DestIterator, class DestAccessor, class MaskIterator, class MaskAccessor> | |
| void | importAndConvertAlphaImage (const vigra::ImageImportInfo &info, vigra::pair< DestIterator, DestAccessor > dest, vigra::pair< MaskIterator, MaskAccessor > mask, const std::string &type) |
| void | loadSafely (RequestPtr request, EntryPtr large=EntryPtr()) |
| Load a requested image in a way that will work in parallel. | |
| EntryPtr | loadImageSafely (const std::string &filename) |
| Load a full size image, in a way that will work in parallel. | |
| EntryPtr | loadSmallImageSafely (EntryPtr entry) |
| Load a small image, in a way that will work in parallel. | |
Private Attributes | |
| long | upperBound |
| std::map< std::string, EntryPtr > | images |
| AppBase::MultiProgressDisplay * | m_progress |
| int | m_accessCounter |
| std::map< std::string, RequestPtr > | m_requests |
| std::map< std::string, RequestPtr > | m_smallRequests |
| std::map< std::string, vigra::BImage * > | pyrImages |
Static Private Attributes | |
| ImageCache * | instance = NULL |
is a singleton for easy access from everywhere. The cache is used as an image source, that needs to know how to reproduce the requested images, in case that they have been deleted.
Definition at line 50 of file ImageCache.h.
|
|
a shared pointer to the entry
Definition at line 104 of file ImageCache.h. Referenced by getImage(), getImageIfAvailable(), getSmallImage(), getSmallImageIfAvailable(), loadImageSafely(), loadSafely(), loadSmallImageSafely(), and spawnAsyncThread(). |
|
|
Definition at line 58 of file ImageCache.h. Referenced by loadImageSafely(). |
|
|
Definition at line 56 of file ImageCache.h. Referenced by loadImageSafely(), and loadSmallImageSafely(). |
|
|
use reference counted pointers
Definition at line 55 of file ImageCache.h. Referenced by loadImageSafely(), and loadSmallImageSafely(). |
|
|
Definition at line 57 of file ImageCache.h. Referenced by loadImageSafely(), and loadSmallImageSafely(). |
|
|
Reference counted request for an image to load. Hold on to this when you want an image to load. If you no longer want the image, just delete it. Deleting it before the image loads lets other images load next. Connect to the ready signal to respond to the image loading. To keep the image loaded, keep the EntryPtr given to the signal handler. It is reference counted, so you can freely copy and delete it. Definition at line 143 of file ImageCache.h. Referenced by requestAsyncImage(), requestAsyncSmallImage(), and spawnAsyncThread(). |
|
|
Definition at line 147 of file ImageCache.h. Referenced by getInstance(). |
|
|
dtor.
Definition at line 155 of file ImageCache.h. |
|
|
Definition at line 307 of file ImageCache.h. |
|
|
release all images in the cache. useful on project load, or maybe before stitching really big pictures Definition at line 158 of file ImageCache.cpp. |
|
|
get a image. it will be loaded if its not already in the cache Hold the EntryPtr as long as the image data is needed! If it isn't vital that the real image is obtained immediately, use getImageIfAvailable instead. This means you can keep the UI responsive while the real image is fetched from a disk or network and decoded. Definition at line 503 of file ImageCache.cpp. References EntryPtr, images, loadImageSafely(), m_accessCounter, m_progress, AppBase::MultiProgressDisplay::popTask(), and AppBase::MultiProgressDisplay::pushTask(). Referenced by PreviewColorPickerTool::CalcCorrectionForImage(), getSmallImage(), LensCalFrame::OnFindLines(), and postEvent(). |
|
|
Get an image if already loaded. If not already in the cache, the pointer returned is 0. Hold a non-zero EntryPtr as long as the image data is needed. If you really need the image immediately, use getImage() instead. Definition at line 704 of file ImageCache.cpp. References EntryPtr, images, and m_accessCounter. Referenced by postEvent(), and spawnAsyncThread(). |
|
|
get the global ImageCache object
Definition at line 294 of file ImageCache.cpp. References ImageCache(), and instance. Referenced by PreviewColorPickerTool::CalcCorrectionForImage(), LensCalFrame::LensCalFrame(), loadSafely(), LensCalFrame::OnFindLines(), LensCalFrame::OnRemoveImage(), and LensCalFrame::~LensCalFrame(). |
|
|
get an small image. This image is 512x512 pixel maximum and can be used for icons and different previews. It is directly derived from the original. If it isn't vital that the real image is obtained immediately, use getSmallImageIfAvailable instead. This means you can keep the UI responsive while the real image is fetched, decoded, and scaled. Definition at line 718 of file ImageCache.cpp. References DEBUG_DEBUG, DEBUG_INFO, EntryPtr, getImage(), images, loadSmallImageSafely(), m_accessCounter, m_progress, AppBase::MultiProgressDisplay::popTask(), AppBase::MultiProgressDisplay::pushTask(), softFlush(), and makefile::string. Referenced by postEvent(). |
|
|
Get a small image if already loaded. The EntryPtr returned is 0 if the image isn't loaded yet. This image is 512x512 pixels maximum and can be used for icons and different previews. It is directly derived from the original. If you really need the image immediately, use getSmallImage() instead. Definition at line 804 of file ImageCache.cpp. References EntryPtr, images, m_accessCounter, softFlush(), and makefile::string. Referenced by postEvent(). |
|
||||||||||||||||||||||||
|
Definition at line 485 of file ImageCache.cpp. References vigra::importImageAlpha(), celeste::max(), and vigra_ext::transformImage(). |
|
||||||||||||||||||||
|
Definition at line 381 of file ImageCache.cpp. References celeste::max(), and vigra_ext::transformImage(). |
|
|
Load a full size image, in a way that will work in parallel. If the image cannot be loaded, the pointer returned is 0. Definition at line 535 of file ImageCache.cpp. References DEBUG_DEBUG, DEBUG_ERROR, DEBUG_FATAL, vigra_ext::destImage(), EntryPtr, ImageCache8Ptr, ImageCacheRGB16Ptr, ImageCacheRGB8Ptr, ImageCacheRGBFloatPtr, vigra::importImageAlpha(), celeste::info(), and vigra_ext::srcImageRange(). Referenced by getImage(), and loadSafely(). |
|
||||||||||||
|
Load a requested image in a way that will work in parallel. When done, it sends an event with the newly created EntryPtr and request.
Definition at line 956 of file ImageCache.cpp. References asyncLoadCompleteSignal, DEBUG_ERROR, EntryPtr, getInstance(), loadImageSafely(), and loadSmallImageSafely(). Referenced by spawnAsyncThread(). |
|
|
Load a small image, in a way that will work in parallel. If the image cannot be loaded, the pointer returned is 0.
Definition at line 747 of file ImageCache.cpp. References EntryPtr, ImageCacheRGB16Ptr, ImageCacheRGB8Ptr, ImageCacheRGBFloatPtr, and vigra_ext::reduceNTimes(). Referenced by getSmallImage(), and loadSafely(). |
|
||||||||||||
|
Pass on a loaded event for any images loaded asynchronously. Call from the main GUI thread when an ImageLoadedEvent occurs. The ImageLoadedEvent originates from async_load_thread.
Definition at line 858 of file ImageCache.cpp. References getImage(), getImageIfAvailable(), getSmallImage(), getSmallImageIfAvailable(), images, m_requests, m_smallRequests, spawnAsyncThread(), and makefile::string. |
|
|
remove a specific image (and dependant images) from the cache
Definition at line 129 of file ImageCache.cpp. References images, pyrImages, makefile::string, and HuginBase::ImageCache::PyramidKey::toString(). |
|
|
Request an image be loaded. This function returns quickly even when the image is not cached.
Definition at line 820 of file ImageCache.cpp. References m_requests, m_smallRequests, RequestPtr, and spawnAsyncThread(). |
|
|
Request a small image be loaded. This function returns quickly even when the image is not cached.
Definition at line 839 of file ImageCache.cpp. References m_requests, m_smallRequests, RequestPtr, and spawnAsyncThread(). |
|
|
Definition at line 303 of file ImageCache.h. Referenced by LensCalFrame::LensCalFrame(), and LensCalFrame::~LensCalFrame(). |
|
|
sets the upper limit, which is used by softFlush()
Definition at line 248 of file ImageCache.h. Referenced by LensCalFrame::LensCalFrame(). |
|
|
a soft version of flush. Releases some images if they go over a certain threshold Definition at line 171 of file ImageCache.cpp. References cout, DEBUG_ASSERT, DEBUG_DEBUG, images, pyrImages, and upperBound. Referenced by getSmallImage(), getSmallImageIfAvailable(), and LensCalFrame::OnRemoveImage(). |
|
|
Start a background thread to load an image.
Definition at line 922 of file ImageCache.cpp. References DEBUG_DEBUG, EntryPtr, getImageIfAvailable(), loadSafely(), m_requests, m_smallRequests, and RequestPtr. Referenced by postEvent(), requestAsyncImage(), and requestAsyncSmallImage(). |
|
|
Signal for when a asynchronous load completes. If you use the requestAsync functions, ensure there is something connected to this signal. The signal is raised in another thread, so the handler must be thread safe. The signal handler must pass the request and entry to postEvent from the main thread when it is safe. For example, it you can wrap the request and entry in some wxEvent and the main thread can handle it later. Referenced by loadSafely(). |
|
|
Definition at line 312 of file ImageCache.h. Referenced by flush(), getImage(), getImageIfAvailable(), getSmallImage(), getSmallImageIfAvailable(), postEvent(), removeImage(), and softFlush(). |
|
|
Definition at line 126 of file ImageCache.cpp. Referenced by getInstance(). |
|
|
Definition at line 317 of file ImageCache.h. Referenced by getImage(), getImageIfAvailable(), getSmallImage(), and getSmallImageIfAvailable(). |
|
|
Definition at line 315 of file ImageCache.h. Referenced by getImage(), and getSmallImage(). |
|
|
Definition at line 320 of file ImageCache.h. Referenced by postEvent(), requestAsyncImage(), requestAsyncSmallImage(), and spawnAsyncThread(). |
|
|
Definition at line 323 of file ImageCache.h. Referenced by postEvent(), requestAsyncImage(), requestAsyncSmallImage(), and spawnAsyncThread(). |
|
|
Definition at line 382 of file ImageCache.h. Referenced by flush(), removeImage(), and softFlush(). |
|
|
Definition at line 272 of file ImageCache.h. Referenced by softFlush(). |
1.3.9.1