moreupdates
[synfig.git] / synfig-core / trunk / src / synfig / transform.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file transform.h
3 **      \brief Template Header
4 **
5 **      $Id: transform.h,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_TRANSFORM_H
25 #define __SYNFIG_TRANSFORM_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <ETL/handle>
30 #include "vector.h"
31 #include <list>
32 #include "rect.h"
33 #include "guid.h"
34
35 /* === M A C R O S ========================================================= */
36
37 /* === T Y P E D E F S ===================================================== */
38
39 /* === C L A S S E S & S T R U C T S ======================================= */
40
41 namespace synfig {
42
43 class Transform : public etl::shared_object
44 {
45         GUID guid_;
46         
47 public:
48         typedef etl::handle<Transform> Handle;
49
50 protected:
51         Transform(const GUID& guid=GUID(0)):guid_(guid) { }
52
53 public:
54
55         const GUID& get_guid()const { return guid_; }
56
57         virtual ~Transform() { }
58         virtual synfig::Vector perform(const synfig::Vector& x)const=0;
59         virtual synfig::Vector unperform(const synfig::Vector& x)const=0;
60
61         virtual synfig::Rect perform(const synfig::Rect& x)const;
62         virtual synfig::Rect unperform(const synfig::Rect& x)const;
63
64 }; // END of class Transform
65
66 class TransformStack : public std::list<Transform::Handle>
67 {
68 public:
69         GUID get_guid()const;
70
71         synfig::Vector perform(const synfig::Vector& x)const;
72         synfig::Vector unperform(const synfig::Vector& x)const;
73         
74         synfig::Rect perform(const synfig::Rect& x)const;
75         synfig::Rect unperform(const synfig::Rect& x)const;
76         
77         void push(const Transform::Handle& x) { if(x)push_back(x); }
78         void pop() { pop_back(); }
79 }; // END of class TransformStack
80
81 }; // END of namespace synfig
82
83 /* === E N D =============================================================== */
84
85 #endif