diff options
| author | Tim Redfern <tim@getdrop.com> | 2017-09-13 13:36:26 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@getdrop.com> | 2017-09-13 13:36:26 +0100 |
| commit | b4972d6ba659cec3759fd87d6f0489a040e0fbf6 (patch) | |
| tree | 8646589d0db594c69eb5c6d6d86f6d05d8e3043f /gui/src/threadedChainImageLoader.h | |
| parent | 304c8f22dfb4e068685b2a1e1023129a7cd12eb4 (diff) | |
chainImageSet and threadedChainImageLoader
Diffstat (limited to 'gui/src/threadedChainImageLoader.h')
| -rw-r--r-- | gui/src/threadedChainImageLoader.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/gui/src/threadedChainImageLoader.h b/gui/src/threadedChainImageLoader.h new file mode 100644 index 0000000..01f0d03 --- /dev/null +++ b/gui/src/threadedChainImageLoader.h @@ -0,0 +1,53 @@ +#pragma once + +#include "ofThread.h" +#include "chainImage.h" +#include "ofURLFileLoader.h" +#include "ofTypes.h" +#include "ofThreadChannel.h" + + +using namespace std; + +class threadedChainImageLoader : public ofThread { +public: + threadedChainImageLoader(); + ~threadedChainImageLoader(); + + void loadFromDisk(chainImage& image, string file); + void loadFromURL(chainImage& image, string url); + + + +private: + void update(ofEventArgs & a); + virtual void threadedFunction(); + void urlResponse(ofHttpResponse & response); + + // Entry to load. + struct chainImageLoaderEntry { + chainImageLoaderEntry() { + image = NULL; + } + + chainImageLoaderEntry(chainImage & pImage) { + image = &pImage; + } + chainImage* image; + string filename; + string url; + string name; + }; + + + typedef map<string, chainImageLoaderEntry>::iterator entry_iterator; + + int nextID; + int lastUpdate; + + map<string,chainImageLoaderEntry> images_async_loading; // keeps track of images which are loading async + ofThreadChannel<chainImageLoaderEntry> images_to_load_from_disk; + ofThreadChannel<chainImageLoaderEntry> images_to_update; +}; + + |
