Equalizer  2.1.0
Parallel Rendering Framework
zoom.h
1 
2 /* Copyright (c) 2009-2017, 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()
40  : Vector2f(1.f, 1.f)
41  {
42  }
43 
45  Zoom(const float x_, const float y_)
46  : Vector2f(x_, y_)
47  {
48  }
50 
52  bool isValid() const { return (x() != 0.f && y() != 0.f); }
54  void validate()
55  {
56  if (x() == 0.f)
57  x() = 1.f;
58  if (y() == 0.f)
59  y() = 1.f;
60  }
61 
63  void invalidate() { x() = y() = 0.f; }
65  void apply(const Zoom& rhs)
66  {
67  x() *= rhs.x();
68  y() *= rhs.y();
69  }
70 
72  EQFABRIC_API static const Zoom NONE;
73 };
74 
75 inline std::ostream& operator<<(std::ostream& os, const Zoom& zoom)
76 {
77  if (zoom.isValid())
78  os << "zoom [ " << zoom.x() << ' ' << zoom.y() << " ]";
79  return os;
80 }
81 }
82 }
83 
84 #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
std::ostream & operator<<(std::ostream &os, const AxisEvent &event)
Print the axis event to the given output stream.
Definition: axisEvent.h:49
Zoom(const float x_, const float y_)
Construct a new zoom specification with default values.
Definition: zoom.h:45
static EQFABRIC_API const Zoom NONE
The zoom NONE (1,1) value.
Definition: zoom.h:72