FX_RECT Struct Reference

Public Member Functions

 FX_RECT ()
 Construct a rect not initialized.
 
 FX_RECT (int left1, int top1, int right1, int bottom1)
 Construct a rect with left-top and right bottom corners. More...
 
FX_BOOL Contains (const FX_RECT &other_rect) const
 Check if current rectangle fully contains the other provided rectangle. That means to check if the other rectangle is fully inside current one. More...
 
FX_BOOL Contains (int x, int y) const
 Check if current rectangle contains the provided point. That means to check if the provided point is inside current one. More...
 
int Height () const
 Get the height of the rect. More...
 
void Intersect (const FX_RECT &src)
 Intersect with a rect. More...
 
void Intersect (int left1, int top1, int right1, int bottom1)
 Intersect with a rect. More...
 
FX_BOOL IsEmpty () const
 Verify whether the rect is empty. More...
 
void Normalize ()
 Normalize the rect. Make sure left <= right, top <= bottom. More...
 
void Offset (int dx, int dy)
 Shift the coordinates by delta value of x and y directions. More...
 
FX_BOOL operator!= (const FX_RECT &src) const
 Compare(!=) operator overload. Compare two rectangles. Please make sure they are normalized first. More...
 
FX_BOOL operator== (const FX_RECT &src) const
 Compare(==) operator overload. Compare two rectangles. Please make sure they are normalized first. More...
 
void Union (const FX_RECT &other_rect)
 Union with a rect. More...
 
int Width () const
 Get the width of the rect. More...
 

Public Attributes

int bottom
 The bottom.
 
int left
 The left.
 
int right
 The right.
 
int top
 The top.
 

Detailed Description

The struct represents integer rectangle for Windows coordinates. Defined as equivalent of Windows RECT structure, with some convenient function members. This structure use Windows space where Y axis runs from top to bottom.

Constructor & Destructor Documentation

◆ FX_RECT()

FX_RECT::FX_RECT ( int  left1,
int  top1,
int  right1,
int  bottom1 
)
inline

Construct a rect with left-top and right bottom corners.

Parameters
[in]left1The left.
[in]top1The top.
[in]right1The right.
[in]bottom1The bottom.

Member Function Documentation

◆ Contains() [1/2]

FX_BOOL FX_RECT::Contains ( const FX_RECT other_rect) const
inline

Check if current rectangle fully contains the other provided rectangle. That means to check if the other rectangle is fully inside current one.

Parameters
[in]other_rectThe other provided rect.
Returns
TRUE means current rect fully contains the other rectangle, while FALSE means not.

◆ Contains() [2/2]

FX_BOOL FX_RECT::Contains ( int  x,
int  y 
) const
inline

Check if current rectangle contains the provided point. That means to check if the provided point is inside current one.

Parameters
[in]xThe x coordinate of the provided point.
[in]yThe y coordinate of the provided point.
Returns
TRUE means current rect contains the provided point, while FALSE means not.

◆ Height()

int FX_RECT::Height ( ) const
inline

Get the height of the rect.

Returns
The height of the rect.

◆ Intersect() [1/2]

void FX_RECT::Intersect ( const FX_RECT src)

Intersect with a rect.

Parameters
[in]srcThe rect to intersect with.
Returns
None.

◆ Intersect() [2/2]

void FX_RECT::Intersect ( int  left1,
int  top1,
int  right1,
int  bottom1 
)
inline

Intersect with a rect.

Parameters
[in]left1The left of the rect to intersect with.
[in]top1The top of the rect to intersect with.
[in]right1The right of the rect to intersect with.
[in]bottom1The bottom of the rect to intersect with.
Returns
None.

◆ IsEmpty()

FX_BOOL FX_RECT::IsEmpty ( ) const
inline

Verify whether the rect is empty.

Returns
TRUE means current rect is empty, while FALSE means not.

◆ Normalize()

void FX_RECT::Normalize ( )

Normalize the rect. Make sure left <= right, top <= bottom.

Returns
None.

◆ Offset()

void FX_RECT::Offset ( int  dx,
int  dy 
)
inline

Shift the coordinates by delta value of x and y directions.

Parameters
[in]dxThe delta value of x-direction.
[in]dyThe delta value of y-direction.
Returns
None.

◆ operator!=()

FX_BOOL FX_RECT::operator!= ( const FX_RECT src) const
inline

Compare(!=) operator overload. Compare two rectangles. Please make sure they are normalized first.

Parameters
[in]srcThe rect to compare.
Returns
TRUE means not equal, while FALSE means equal.

◆ operator==()

FX_BOOL FX_RECT::operator== ( const FX_RECT src) const
inline

Compare(==) operator overload. Compare two rectangles. Please make sure they are normalized first.

Parameters
[in]srcThe rect to compare.
Returns
TRUE means equal, while FALSE means not equal.

◆ Union()

void FX_RECT::Union ( const FX_RECT other_rect)

Union with a rect.

Parameters
[in]other_rectThe rect to union with.
Returns
None.

◆ Width()

int FX_RECT::Width ( ) const
inline

Get the width of the rect.

Returns
The width of the rect.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.