18 #ifndef EQFABRIC_PIXEL_H
19 #define EQFABRIC_PIXEL_H
21 #include <eq/fabric/api.h>
22 #include <lunchbox/log.h>
23 #include <lunchbox/types.h>
30 std::ostream& operator << ( std::ostream& os,
const Pixel& pixel );
48 Pixel() : x( 0 ), y( 0 ), w( 1 ), h( 1 ) {}
51 Pixel(
const uint32_t x_,
const uint32_t y_,
52 const uint32_t w_,
const uint32_t h_ )
53 : x( x_ ), y( y_ ), w( w_ ), h( h_ ) {}
62 x = x * rhs.w + rhs.x;
64 y = y * rhs.h + rhs.y;
74 return x==rhs.x && y==rhs.y && w==rhs.w && h==rhs.h;
83 return x!=rhs.x || y!=rhs.y || w!=rhs.w || h!=rhs.h;
93 LBWARN <<
"Invalid " << *
this << std::endl;
98 LBWARN <<
"Corrected " << *
this << std::endl;
102 bool isValid()
const {
return ( w>0 && x<w && h>0 && y<h ); }
113 inline std::ostream& operator << ( std::ostream& os,
const Pixel& pixel )
116 os <<
"pixel [ " << pixel.x <<
' ' << pixel.y
117 <<
' ' << pixel.w <<
' ' << pixel.h <<
" ]";
133 #endif // EQFABRIC_PIXEL_H
void apply(const Pixel &rhs)
Apply (accumulate) another pixel specification.
bool operator==(const Pixel &rhs) const
Pixel()
Construct a pixel specification covering all pixels of a frustum.
Holds a pixel decomposition specification with methods for manipulation.
Pixel(const uint32_t x_, const uint32_t y_, const uint32_t w_, const uint32_t h_)
Construct a pixel specification with default values.
static const Pixel ALL
A pixel specification covering all pixels.
bool operator!=(const Pixel &rhs) const
void validate()
Make the pixel specification valid.
void invalidate()
Make the pixel specification invalid.