Equalizer 1.0

zoom.h

00001 
00002 /* Copyright (c) 2009-2010, 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 EQFABRIC_ZOOM_H
00019 #define EQFABRIC_ZOOM_H
00020 
00021 #include <eq/fabric/api.h>
00022 #include <eq/fabric/types.h>
00023 
00024 namespace eq
00025 {
00026 namespace fabric
00027 {
00034     class Zoom : public Vector2f
00035     {
00036     public:
00038         Zoom() : Vector2f( 1.f, 1.f )  {}
00039 
00044         Zoom( const float x_, const float y_ ) : Vector2f( x_, y_ ) {}
00046 
00048         bool isValid() const { return ( x() != 0.f && y() != 0.f ); }
00049 
00051         void validate()
00052             {
00053                 if( x() == 0.f ) x() = 1.f;
00054                 if( y() == 0.f ) y() = 1.f;
00055             }
00056 
00058         void invalidate() { x() = y() = 0.f; }
00059 
00061         void apply( const Zoom& rhs )
00062             {
00063                 x() *= rhs.x();
00064                 y() *= rhs.y();
00065             }
00066 
00068         EQFABRIC_API static const Zoom NONE;
00069     };
00070 
00071     inline std::ostream& operator << ( std::ostream& os, const Zoom& zoom )
00072     {
00073         if( zoom.isValid( ))
00074             os << "zoom     [ " << zoom.x() << ' ' << zoom.y() << " ]";
00075         return os;
00076     }
00077 }
00078 }
00079 #endif // EQFABRIC_ZOOM_H
Generated on Sun May 8 2011 19:11:08 for Equalizer 1.0 by  doxygen 1.7.3