Nana C++ Library. Reference for users.
What we need to use nana
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
nana::rectangle Struct Reference

Public Member Functions

 rectangle ()
 a zero-size rectangle at (0, 0). More...
 
 rectangle (int x, int y, unsigned width, unsigned height)
 
 rectangle (const size &)
 a rectangle with specified size at coordinate (0, 0). More...
 
 rectangle (const point &, const size &=size())
 
bool operator== (const rectangle &rhs) const
 
bool operator!= (const rectangle &rhs) const
 
point position () const noexcept
 
rectangleposition (const point &) noexcept
 
size dimension () const noexcept
 
rectangledimension (const size &) noexcept
 
rectanglepare_off (int pixels)
 Pares the specified pixels off the rectangle. More...
 
int right () const noexcept
 
int bottom () const noexcept
 
bool is_hit (int x, int y) const
 
bool is_hit (const point &pos) const
 
bool empty () const
 true if width * height == 0. More...
 
rectangleshift ()
 Swap position x and y, size width and height. More...
 

Public Attributes

int x
 
int y
 
unsigned width
 
unsigned height
 

Detailed Description

Constructor & Destructor Documentation

nana::rectangle::rectangle ( )

a zero-size rectangle at (0, 0).

nana::rectangle::rectangle ( int  x,
int  y,
unsigned  width,
unsigned  height 
)
nana::rectangle::rectangle ( const size sz)
explicit

a rectangle with specified size at coordinate (0, 0).

nana::rectangle::rectangle ( const point pos,
const size sz = size() 
)
explicit

Member Function Documentation

int nana::rectangle::bottom ( ) const
noexcept
size nana::rectangle::dimension ( ) const
noexcept
Examples:
stretch_image.cpp.
rectangle & nana::rectangle::dimension ( const size sz)
noexcept
bool nana::rectangle::empty ( ) const

true if width * height == 0.

bool nana::rectangle::is_hit ( int  x,
int  y 
) const
bool nana::rectangle::is_hit ( const point pos) const
bool nana::rectangle::operator!= ( const rectangle rhs) const
bool nana::rectangle::operator== ( const rectangle rhs) const
rectangle & nana::rectangle::pare_off ( int  pixels)

Pares the specified pixels off the rectangle.

It's equal to x += pixels; y + pixels; width -= (pixels << 1); height -= (pixels << 1);

Parameters
pixelsThe number of pixels to be pared. If the number that multiples pixels twice is larger than width/height, the width/height will be zero. If the pixels is a negative number, the width/height is add the number that multiple pixels twice.
Returns
The reference of *this.
point nana::rectangle::position ( ) const
noexcept
Examples:
stretch_image.cpp.
rectangle & nana::rectangle::position ( const point p)
noexcept
int nana::rectangle::right ( ) const
noexcept
rectangle & nana::rectangle::shift ( )

Swap position x and y, size width and height.

Member Data Documentation

unsigned nana::rectangle::height
unsigned nana::rectangle::width
int nana::rectangle::x
int nana::rectangle::y