00001
00021
00022
00023
00024
00025 #ifndef __SYNFIG_IMPORTER_H
00026 #define __SYNFIG_IMPORTER_H
00027
00028
00029
00030 #include <map>
00031
00032 #include <ETL/handle>
00033 #include "string.h"
00034
00035
00036
00037 #include "time.h"
00038 #include "gamma.h"
00039
00040
00041
00043 #define SYNFIG_IMPORTER_MODULE_EXT public: static const char name__[], version__[], ext__[],cvs_id__[]; static Importer *create(const char *filename);
00044
00046 #define SYNFIG_IMPORTER_SET_NAME(class,x) const char class::name__[]=x
00047
00049 #define SYNFIG_IMPORTER_SET_EXT(class,x) const char class::ext__[]=x
00050
00052 #define SYNFIG_IMPORTER_SET_VERSION(class,x) const char class::version__[]=x
00053
00055 #define SYNFIG_IMPORTER_SET_CVS_ID(class,x) const char class::cvs_id__[]=x
00056
00058 #define SYNFIG_IMPORTER_INIT(class) synfig::Importer* class::create(const char *filename) { return new class(filename); }
00059
00060
00061
00062
00063
00064 namespace synfig {
00065
00066 class Surface;
00067 class ProgressCallback;
00068
00073 class Importer : public etl::shared_object
00074 {
00075 public:
00076 typedef Importer* (*Factory)(const char *filename);
00077 typedef std::map<String,Factory> Book;
00078 static Book* book_;
00079
00080 static Book& book();
00081
00082 static bool subsys_init();
00083 static bool subsys_stop();
00084
00085 typedef etl::handle<Importer> Handle;
00086 typedef etl::loose_handle<Importer> LooseHandle;
00087 typedef etl::handle<const Importer> ConstHandle;
00088
00089 private:
00090 Gamma gamma_;
00091
00092 protected:
00093 Importer();
00094
00095 public:
00096
00097 Gamma& gamma() { return gamma_; }
00098 const Gamma& gamma()const { return gamma_; }
00099
00100 virtual ~Importer();
00101
00103
00110 virtual bool get_frame(Surface &surface,Time time, ProgressCallback *callback=NULL)=0;
00111
00113 virtual bool is_animated() { return false; }
00114
00116 static Handle open(const String &filename);
00117 };
00118
00119 };
00120
00121
00122
00123 #endif