zoom.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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>
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