00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00035
00036
00037 #ifndef OPENIMAGEIO_IMAGECACHE_H
00038 #define OPENIMAGEIO_IMAGECACHE_H
00039
00040 #include "ustring.h"
00041 #include "imageio.h"
00042
00043
00044
00045 #ifdef OPENIMAGEIO_NAMESPACE
00046 namespace OPENIMAGEIO_NAMESPACE {
00047 #endif
00048
00049 namespace OpenImageIO {
00050
00051 namespace pvt {
00052
00053 class ImageCacheImpl;
00054 };
00055
00056
00057
00058
00063 class DLLPUBLIC ImageCache {
00064 public:
00071 static ImageCache *create (bool shared=true);
00072
00075 static void destroy (ImageCache * x);
00076
00077 ImageCache (void) { }
00078 virtual ~ImageCache () { }
00079
00082 virtual void clear () = 0;
00083
00095 virtual bool attribute (const std::string &name, TypeDesc type,
00096 const void *val) = 0;
00097
00098 virtual bool attribute (const std::string &name, int val) = 0;
00099 virtual bool attribute (const std::string &name, float val) = 0;
00100 virtual bool attribute (const std::string &name, double val) = 0;
00101 virtual bool attribute (const std::string &name, const char *val) = 0;
00102 virtual bool attribute (const std::string &name,
00103 const std::string &val) = 0;
00104
00106 virtual bool getattribute (const std::string &name, TypeDesc type,
00107 void *val) = 0;
00108
00109 virtual bool getattribute (const std::string &name, int &val) = 0;
00110 virtual bool getattribute (const std::string &name, float &val) = 0;
00111 virtual bool getattribute (const std::string &name, double &val) = 0;
00112 virtual bool getattribute (const std::string &name, char **val) = 0;
00113 virtual bool getattribute (const std::string &name, std::string &val) = 0;
00114
00117 virtual std::string resolve_filename (const std::string &filename) const=0;
00118
00123 virtual bool get_image_info (ustring filename, ustring dataname,
00124 TypeDesc datatype, void *data) = 0;
00125
00132 virtual bool get_imagespec (ustring filename, ImageSpec &spec,
00133 int subimage=0) = 0;
00134
00146 virtual const ImageSpec *imagespec (ustring filename, int subimage=0) = 0;
00147
00160 virtual bool get_pixels (ustring filename, int subimage,
00161 int xbegin, int xend, int ybegin, int yend,
00162 int zbegin, int zend,
00163 TypeDesc format, void *result) = 0;
00164
00167 class Tile;
00168
00175 virtual Tile * get_tile (ustring filename, int subimage,
00176 int x, int y, int z) = 0;
00177
00180 virtual void release_tile (Tile *tile) const = 0;
00181
00186 virtual const void * tile_pixels (Tile *tile, TypeDesc &format) const = 0;
00187
00192 virtual std::string geterror () const = 0;
00193
00196 virtual std::string getstats (int level=1) const = 0;
00197
00208 virtual void invalidate (ustring filename) = 0;
00209
00219 virtual void invalidate_all (bool force=false) = 0;
00220
00221 private:
00222
00223
00224 void operator delete (void *todel) { }
00225 };
00226
00227
00228 };
00229
00230
00231 #ifdef OPENIMAGEIO_NAMESPACE
00232 };
00233 using namespace OPENIMAGEIO_NAMESPACE;
00234 #endif
00235
00236 #endif // OPENIMAGEIO_IMAGECACHE_H