affineanimator.h

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

Generated on Sun Mar 11 10:01:27 2007 by  doxygen 1.5.1