zoom.h

00001 
00002 /* Copyright (c) 2009, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef EQ_ZOOM_H
00019 #define EQ_ZOOM_H
00020 
00021 #include <eq/base/base.h>
00022 #include <eq/base/log.h>
00023 #include <eq/client/types.h>  // base class
00024 
00025 namespace eq
00026 {
00033     class Zoom : public Vector2f
00034     {
00035     public:
00040         Zoom() : Vector2f( 1.f, 1.f )  {}
00041         Zoom( const float x_, const float y_ ) : Vector2f( x_, y_ ) {}
00043 
00045         bool isValid() const { return ( x() != 0.f && y() != 0.f ); }
00046 
00048         void validate()
00049             {
00050                 if( x() == 0.f ) x() = 1.f;
00051                 if( y() == 0.f ) y() = 1.f;
00052             }
00053             
00054 
00055         
00057         void invalidate() { x() = y() = 0.f; }
00058 
00059         EQ_EXPORT static const Zoom NONE;
00060     };
00061 
00062     inline std::ostream& operator << ( std::ostream& os, const Zoom& zoom )
00063     {
00064         if( zoom.isValid( ))
00065             os << "zoom     [ " << zoom.x() << ' ' << zoom.y() << " ]";
00066         return os;
00067     }
00068 }
00069 
00070 #endif // EQ_ZOOM_H
Generated on Mon Aug 10 18:58:41 2009 for Equalizer 0.9 by  doxygen 1.5.8