Equalizer  1.12.0
Parallel Rendering Framework
zoom.h
1 
2 /* Copyright (c) 2009-2016, Stefan Eilemann <eile@equalizergraphics.com>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQFABRIC_ZOOM_H
19 #define EQFABRIC_ZOOM_H
20 
21 #include <eq/fabric/api.h>
22 #include <eq/fabric/types.h>
23 #include <eq/fabric/vmmlib.h>
24 
25 namespace eq
26 {
27 namespace fabric
28 {
35 class Zoom : public Vector2f
36 {
37 public:
39  Zoom() : Vector2f( 1.f, 1.f ) {}
40 
42  Zoom( const float x_, const float y_ ) : Vector2f( x_, y_ ) {}
44 
46  bool isValid() const { return ( x() != 0.f && y() != 0.f ); }
47 
49  void validate()
50  {
51  if( x() == 0.f ) x() = 1.f;
52  if( y() == 0.f ) y() = 1.f;
53  }
54 
56  void invalidate() { x() = y() = 0.f; }
57 
59  void apply( const Zoom& rhs )
60  {
61  x() *= rhs.x();
62  y() *= rhs.y();
63  }
64 
66  EQFABRIC_API static const Zoom NONE;
67 };
68 
69 inline std::ostream& operator << ( std::ostream& os, const Zoom& zoom )
70 {
71  if( zoom.isValid( ))
72  os << "zoom [ " << zoom.x() << ' ' << zoom.y() << " ]";
73  return os;
74 }
75 }
76 }
77 namespace lunchbox
78 {
79 template<> inline void byteswap( eq::fabric::Zoom& value )
80 { byteswap< eq::fabric::Vector2f >( value ); }
81 }
82 #endif // EQFABRIC_ZOOM_H
A zoom specification with methods for manipulation.
Definition: zoom.h:35
Defines export visibility macros for library EqualizerFabric.
The Equalizer client library.
Definition: eq/agl/types.h:23
Zoom()
Construct a new zoom specification set to 1, 1.
Definition: zoom.h:39
Zoom(const float x_, const float y_)
Construct a new zoom specification with default values.
Definition: zoom.h:42
static EQFABRIC_API const Zoom NONE
The zoom NONE (1,1) value.
Definition: zoom.h:66