- Main Page
- Related Pages
- Namespaces
- Classes
- Files

# target.h

Go to the documentation of this file.

    00001 /* === S Y N F I G ========================================================= */
    00022 /* ========================================================================= */
    00023
    00024 /* === S T A R T =========================================================== */
    00025
    00026 #ifndef __SYNFIG_TARGET_H
    00027 #define __SYNFIG_TARGET_H
    00028
    00029 /* === H E A D E R S ======================================================= */
    00030
    00031 #include <sigc++/signal.h>
    00032 #include "string_decl.h"
    00033 #include <utility>
    00034 //#include <list>
    00035 #include <map>
    00036 #include <ETL/handle>
    00037 #include "renddesc.h"
    00038 //#include "general.h"
    00039 #include "color.h"
    00040 #include "canvas.h"
    00041
    00042 /* === M A C R O S ========================================================= */
    00043
    00045 #define SYNFIG_TARGET_MODULE_EXT public: static const char name__[], version__[], ext__[],cvs_id__[]; static Target *create(const char *filename);
    00046
    00048 #define SYNFIG_TARGET_SET_NAME(class,x) const char class::name__[]=x
    00049
    00051 #define SYNFIG_TARGET_SET_EXT(class,x) const char class::ext__[]=x
    00052
    00054 #define SYNFIG_TARGET_SET_VERSION(class,x) const char class::version__[]=x
    00055
    00057 #define SYNFIG_TARGET_SET_CVS_ID(class,x) const char class::cvs_id__[]=x
    00058
    00060 #define SYNFIG_TARGET_INIT(class) synfig::Target* class::create(const char *filename) { return new class(filename); }
    00061
    00062 /* === T Y P E D E F S ===================================================== */
    00063
    00064 /* === C L A S S E S & S T R U C T S ======================================= */
    00065
    00066 namespace synfig {
    00067
    00068 class Surface;
    00069 class RendDesc;
    00070 class Canvas;
    00071 class ProgressCallback;
    00072
    00077 class Target : public etl::shared_object
    00078 {
    00079 public:
    00080     typedef etl::handle<Target> Handle;
    00081     typedef etl::loose_handle<Target> LooseHandle;
    00082     typedef etl::handle<const Target> ConstHandle;
    00083
    00084     /*
    00085  -- ** -- S I G N A L S -------------------------------------------------------
    00086     */
    00087
    00088 private:
    00089
    00090     sigc::signal<void> signal_progress_;
    00091
    00092     /*
    00093  -- ** -- S I G N A L   I N T E R F A C E -------------------------------------
    00094     */
    00095
    00096 public:
    00097
    00098     sigc::signal<void>& signal_progress() { return signal_progress_; }
    00099
    00100     /*
    00101  -- ** -- C O N S T R U C T O R S ---------------------------------------------
    00102     */
    00103
    00104 public:
    00105     typedef Target* (*Factory)(const char *filename);
    00106
    00108     typedef std::map<String,std::pair<Factory,String> > Book;
    00109
    00110     typedef std::map<String,String> ExtBook;
    00111
    00113     static Book* book_;
    00114
    00116     static ExtBook* ext_book_;
    00117
    00118     static Book& book();
    00119     static ExtBook& ext_book();
    00120
    00121     static bool subsys_init();
    00122     static bool subsys_stop();
    00123
    00125     RendDesc desc;
    00126
    00127     etl::handle<Canvas> canvas;
    00128
    00129     int quality_;
    00130     Gamma gamma_;
    00131
    00132     bool remove_alpha;
    00133
    00134     bool avoid_time_sync_;
    00135
    00136 protected:
    00137
    00138     Target();
    00139
    00140 public:
    00141     virtual ~Target() { }
    00142
    00143     int get_quality()const { return quality_; }
    00144
    00145     void set_quality(int q) { quality_=q; }
    00146
    00147     void set_avoid_time_sync(bool x=true) { avoid_time_sync_=x; }
    00148
    00149     bool get_avoid_time_sync()const { return avoid_time_sync_; }
    00150
    00151     bool get_remove_alpha()const { return remove_alpha; }
    00152
    00153     void set_remove_alpha(bool x=true) { remove_alpha=x; }
    00154
    00155     Gamma &gamma() { return gamma_; }
    00156
    00157     const Gamma &gamma()const { return gamma_; }
    00158
    00159     virtual void set_canvas(etl::handle<Canvas> c);
    00160
    00161     const etl::handle<Canvas> &get_canvas()const { return canvas; }
    00162
    00163     RendDesc &rend_desc() { return desc; }
    00164     const RendDesc &rend_desc()const { return desc; }
    00165
    00167     virtual bool render(ProgressCallback *cb=NULL)=0;
    00168
    00170
    00174     virtual bool set_rend_desc(RendDesc *d) { desc=*d; return true; }
    00175
    00176     virtual bool init() { return true; }
    00177
    00179     static Handle create(const String &type, const String &filename);
    00180 }; // END of class Target
    00181
    00182 }; // END of namespace synfig
    00183
    00184 /* === E N D =============================================================== */
    00185
    00186 #include "canvas.h"
    00187 #endif