papyrus logo

affineanimator.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the papyrus library.                             *
00006  *                                                                         *
00007  *   papyrus is free software; you can redistribute it and/or modify       *
00008  *   it under the terms of the GNU Lesser General Public License           *
00009  *   version 3.0 as published by the Free Software Foundation.             *
00010  *                                                                         *
00011  *   papyrus is distributed in the hope that it will be useful,            *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Lesser General Public License version 3.0 for more details.       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with the papyrus library. If not, see                   *
00018  *   <http://www.gnu.org/licenses/>.                                       *
00019  ***************************************************************************/
00020 #ifndef PAPYRUSAFFINEANIMATOR_H
00021 #define PAPYRUSAFFINEANIMATOR_H
00022 
00023 #include <set>
00024 
00025 #include <papyrus/animator.h>
00026 
00027 #include <papyrus/drawable.h>
00028 
00029 namespace Papyrus
00030 {
00031 
00035   class AffineAnimator : public Animator
00036   {
00037     protected:
00038       AffineAnimator ( const Glib::ustring& id,
00039                        double tx=0.0, double ty=0.0,
00040                        double scalex=1.0, double scaley=1.0,
00041                        double rotation=0.0,
00042                        double skewx=0.0, double skewy=0.0
00043                      );
00044 
00045     public:
00047       typedef std::set<Drawable::pointer> Drawables;
00048 
00050       typedef PapyrusPointer<AffineAnimator> pointer;
00051 
00052       static AffineAnimator::pointer create ( const Glib::ustring& id=Glib::ustring(),
00053                                               double tx=0.0, double ty=0.0,
00054                                               double scalex=1.0, double scaley=1.0,
00055                                               double rotation=0.0,
00056                                               double skewx=0.0, double skewy=0.0
00057                                             );
00058 
00059       static AffineAnimator::pointer create ( double tx, double ty,
00060                                               double scalex=1.0, double scaley=1.0,
00061                                               double rotation=0.0,
00062                                               double skewx=0.0, double skewy=0.0
00063                                             );
00064       
00065       virtual ~AffineAnimator();
00066 
00067       void add ( Drawable::pointer d );
00068 
00069       void remove ( Drawable::pointer d );
00070 
00071       const Drawables& drawables();
00072 
00073       double get_translate_x();
00074 
00075       double get_translate_y();
00076 
00077       void get_translate ( double& tx, double& ty );
00078 
00079       void set_translate_x ( double tx );
00080 
00081       void set_translate_y ( double ty );
00082 
00083       void set_translate ( double tx, double ty );
00084 
00085       double get_scale_x();
00086 
00087       double get_scale_y();
00088 
00089       void get_scale ( double& sx, double& sy );
00090 
00091       void set_scale_x ( double sx );
00092 
00093       void set_scale_y ( double sy );
00094 
00095       void set_scale ( double scale_x, double scale_y );
00096 
00097       void set_scale ( double s );
00098 
00099       double get_rotate();
00100 
00101       void set_rotate ( double r );
00102 
00103       double get_skew_x();
00104 
00105       void set_skew_x ( double skewx );
00106 
00107       double get_skew_y();
00108 
00109       void set_skew_y ( double skewy );
00110 
00111       void get_skew ( double& skewx, double& skewy );
00112 
00113       void set_skew ( double skewx, double skewy );
00114 
00115     protected:
00116       double m_tx, m_ty, m_scalex, m_scaley, m_r, m_skewx, m_skewy, m_revscalex, m_revscaley;
00117       Drawables m_drawables;
00118 
00119       virtual int animate ( int n=1 );
00120 
00121   };
00122 
00123 }
00124 
00125 #endif

Generated on Fri Apr 16 12:40:10 2010 for papyrus by doxygen 1.6.1