00001 /* === S Y N F I G ========================================================= */ 00021 /* ========================================================================= */ 00022 00023 /* === S T A R T =========================================================== */ 00024 00025 #ifndef __SYNFIG_TRANSFORM_H 00026 #define __SYNFIG_TRANSFORM_H 00027 00028 /* === H E A D E R S ======================================================= */ 00029 00030 #include <ETL/handle> 00031 #include "vector.h" 00032 #include <list> 00033 #include "rect.h" 00034 #include "guid.h" 00035 00036 /* === M A C R O S ========================================================= */ 00037 00038 /* === T Y P E D E F S ===================================================== */ 00039 00040 /* === C L A S S E S & S T R U C T S ======================================= */ 00041 00042 namespace synfig { 00043 00044 class Transform : public etl::shared_object 00045 { 00046 GUID guid_; 00047 00048 public: 00049 typedef etl::handle<Transform> Handle; 00050 00051 protected: 00052 Transform(const GUID& guid):guid_(guid) { } 00053 00054 public: 00055 00056 const GUID& get_guid()const { return guid_; } 00057 00058 virtual ~Transform() { } 00059 virtual synfig::Vector perform(const synfig::Vector& x)const=0; 00060 virtual synfig::Vector unperform(const synfig::Vector& x)const=0; 00061 00062 virtual synfig::Rect perform(const synfig::Rect& x)const; 00063 virtual synfig::Rect unperform(const synfig::Rect& x)const; 00064 00065 }; // END of class Transform 00066 00067 class TransformStack : public std::list<Transform::Handle> 00068 { 00069 public: 00070 GUID get_guid()const; 00071 00072 synfig::Vector perform(const synfig::Vector& x)const; 00073 synfig::Vector unperform(const synfig::Vector& x)const; 00074 00075 synfig::Rect perform(const synfig::Rect& x)const; 00076 synfig::Rect unperform(const synfig::Rect& x)const; 00077 00078 void push(const Transform::Handle& x) { if(x)push_back(x); } 00079 void pop() { pop_back(); } 00080 }; // END of class TransformStack 00081 00082 }; // END of namespace synfig 00083 00084 /* === E N D =============================================================== */ 00085 00086 #endif