Foxit PDF SDK
CFX_FloatRect Class Reference

Inherits CFX_Object.

Public Member Functions

 CFX_FloatRect ()
 Construct an empty rectangle.
 
 CFX_FloatRect (FX_FLOAT left1, FX_FLOAT bottom1, FX_FLOAT right1, FX_FLOAT top1)
 Construct a rectangle with left-bottom and right-top corners. More...
 
 CFX_FloatRect (const FX_FLOAT *pArray)
 Construct a rectangle with an array of left, bottom, right, top values. More...
 
 CFX_FloatRect (const FX_RECT &rect)
 Construct a rectangle with a FX_RECT object. More...
 
FX_BOOL Contains (const CFX_FloatRect &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 (FX_FLOAT x, FX_FLOAT y) const
 Check if current rectangle fully contains the provided point. That means to check if the provided point is inside current rectangle. More...
 
void Deflate (FX_FLOAT x, FX_FLOAT y)
 Decreases the width and height of the rectangle. More...
 
void Deflate (FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top)
 Decreases the width and height of the rectangle. More...
 
void Deflate (const CFX_FloatRect &rt)
 Decreases the width and height of the rectangle. More...
 
FX_RECT GetClosestRect () const
 Get a closest integer rectangle. More...
 
FX_RECT GetInnerRect () const
 Convert to an inner integer rectangle. More...
 
FX_RECT GetOutterRect () const
 Convert to an outer integer rectangle. More...
 
FX_FLOAT Height () const
 Get the height of the rectangle. More...
 
void Inflate (FX_FLOAT x, FX_FLOAT y)
 Increases the width and height of the rectangle. More...
 
void Inflate (FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top)
 Increases the width and height of the rectangle. More...
 
void Inflate (const CFX_FloatRect &rt)
 Increases the width and height of the rectangle. More...
 
void InitRect (FX_FLOAT x, FX_FLOAT y)
 Initialize the rectangle to a single point. More...
 
void Intersect (const CFX_FloatRect &other_rect)
 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, and bottom <= top. More...
 
FX_BOOL operator != (const CFX_FloatRect &src) const
 Compare(!=) operator overload. Compare two rectangles. Please make sure they are normalized first. More...
 
FX_BOOL operator== (const CFX_FloatRect &src) const
 Compare(==) operator overload. Compare two rectangles. Please make sure they are normalized first. More...
 
void Reset ()
 Reset rectangle, set coordinates to 0. More...
 
int Substract4 (CFX_FloatRect &substract_rect, CFX_FloatRect *pRects)
 Subtract a rectangle area from this rectangle. The result might be up to 4 rectangles. The number of result rectangles are returned. Caller must prepare enough rectangles (up to 4). More...
 
void Transform (const CFX_Matrix *pMatrix)
 Transform a rectangle. The result rectangle is always normalized. More...
 
void Translate (FX_FLOAT e, FX_FLOAT f)
 Translate rectangle. More...
 
void Union (const CFX_FloatRect &other_rect)
 Union with a rect. More...
 
void UpdateRect (FX_FLOAT x, FX_FLOAT y)
 Update the rectangle to contain the specified point. More...
 
FX_FLOAT Width () const
 Get the width of the rectangle. More...
 

Static Public Member Functions

static CFX_FloatRect GetBBox (const CFX_PointF *pPoints, int nPoints)
 Get the bounding box of input points array. More...
 

Public Attributes

FX_FLOAT bottom
 The bottom.
 
FX_FLOAT left
 The left.
 
FX_FLOAT right
 The right.
 
FX_FLOAT top
 The top.
 

Detailed Description

A float-point coordination rectangle. A normalized float-point rectangle always has top larger than bottom, which is the opposite of Windows rectangle.

Constructor & Destructor Documentation

◆ CFX_FloatRect() [1/3]

CFX_FloatRect::CFX_FloatRect ( FX_FLOAT  left1,
FX_FLOAT  bottom1,
FX_FLOAT  right1,
FX_FLOAT  top1 
)
inline

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

Parameters
[in]left1The x-coordinate of the input left-bottom corner.
[in]bottom1The y-coordinate of the input left-bottom corner.
[in]right1The x-coordinate of the input right-top corner.
[in]top1The y-coordinate of the input right-top corner.

◆ CFX_FloatRect() [2/3]

CFX_FloatRect::CFX_FloatRect ( const FX_FLOAT pArray)
inline

Construct a rectangle with an array of left, bottom, right, top values.

Parameters
[in]pArrayThe input array.

◆ CFX_FloatRect() [3/3]

CFX_FloatRect::CFX_FloatRect ( const FX_RECT rect)

Construct a rectangle with a FX_RECT object.

Parameters
[in]rectThe input FX_RECT object.

Member Function Documentation

◆ Contains() [1/2]

FX_BOOL CFX_FloatRect::Contains ( const CFX_FloatRect 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.

Parameters
[in]other_rectThe other provided rect.
Returns
true means current rectangle fully contains the other one, while false means not.

◆ Contains() [2/2]

FX_BOOL CFX_FloatRect::Contains ( FX_FLOAT  x,
FX_FLOAT  y 
) const

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

Parameters
[in]xThe x coordinate of the provided point.
[in]yThe y coordinate of the provided point.
Returns
true means current rectangle contains the provided point, while false means not.

◆ Deflate() [1/3]

void CFX_FloatRect::Deflate ( FX_FLOAT  x,
FX_FLOAT  y 
)
inline

Decreases the width and height of the rectangle.

Parameters
[in]xThe number to deflate the left and right of the rectangle.
[in]yThe number to deflate the top and bottom of the rectangle.
Returns
None.

◆ Deflate() [2/3]

void CFX_FloatRect::Deflate ( FX_FLOAT  left,
FX_FLOAT  bottom,
FX_FLOAT  right,
FX_FLOAT  top 
)
inline

Decreases the width and height of the rectangle.

Parameters
[in]leftThe number to deflate the left of the rectangle.
[in]bottomThe number to deflate the bottom of the rectangle.
[in]rightThe number to deflate the right of the rectangle.
[in]topThe number to deflate the top of the rectangle.
Returns
None.

◆ Deflate() [3/3]

void CFX_FloatRect::Deflate ( const CFX_FloatRect rt)
inline

Decreases the width and height of the rectangle.

Parameters
[in]rtThe rectangle to deflate each side.
Returns
None.

◆ GetBBox()

static CFX_FloatRect CFX_FloatRect::GetBBox ( const CFX_PointF pPoints,
int  nPoints 
)
static

Get the bounding box of input points array.

Parameters
[in]pPointsThe input points array.
[in]nPointsThe number of points in the array.
Returns
A floating-point coordination rectangle.

◆ GetClosestRect()

FX_RECT CFX_FloatRect::GetClosestRect ( ) const

Get a closest integer rectangle.

Returns
The closest integer rectangle.

◆ GetInnerRect()

FX_RECT CFX_FloatRect::GetInnerRect ( ) const

Convert to an inner integer rectangle.

Returns
The inner integer rectangle.

◆ GetOutterRect()

FX_RECT CFX_FloatRect::GetOutterRect ( ) const

Convert to an outer integer rectangle.

Returns
The outer integer rectangle.

◆ Height()

FX_FLOAT CFX_FloatRect::Height ( ) const
inline

Get the height of the rectangle.

Returns
Height of the rectangle.

◆ Inflate() [1/3]

void CFX_FloatRect::Inflate ( FX_FLOAT  x,
FX_FLOAT  y 
)
inline

Increases the width and height of the rectangle.

Parameters
[in]xThe number to inflate the left and right of the rectangle.
[in]yThe number to inflate the top and bottom of the rectangle.
Returns
None.

◆ Inflate() [2/3]

void CFX_FloatRect::Inflate ( FX_FLOAT  left,
FX_FLOAT  bottom,
FX_FLOAT  right,
FX_FLOAT  top 
)
inline

Increases the width and height of the rectangle.

Parameters
[in]leftThe number to inflate the left of the rectangle.
[in]bottomThe number to inflate the bottom of the rectangle.
[in]rightThe number to inflate the right of the rectangle.
[in]topThe number to inflate the top of the rectangle.
Returns
None.

◆ Inflate() [3/3]

void CFX_FloatRect::Inflate ( const CFX_FloatRect rt)
inline

Increases the width and height of the rectangle.

Parameters
[in]rtThe rectangle to inflate each side.
Returns
None.

◆ InitRect()

void CFX_FloatRect::InitRect ( FX_FLOAT  x,
FX_FLOAT  y 
)
inline

Initialize the rectangle to a single point.

Parameters
[in]xThe x-coordinate of the input point.
[in]yThe y-coordinate of the input point.
Returns
None.

◆ Intersect()

void CFX_FloatRect::Intersect ( const CFX_FloatRect other_rect)

Intersect with a rect.

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

◆ IsEmpty()

FX_BOOL CFX_FloatRect::IsEmpty ( ) const
inline

Verify whether the rect is empty.

Returns
true meanas current rect is empty, while false means not.

◆ Normalize()

void CFX_FloatRect::Normalize ( )

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

Returns
None.

◆ operator !=()

FX_BOOL CFX_FloatRect::operator != ( const CFX_FloatRect 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 CFX_FloatRect::operator== ( const CFX_FloatRect 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.

◆ Reset()

void CFX_FloatRect::Reset ( )
inline

Reset rectangle, set coordinates to 0.

Returns
None.

◆ Substract4()

int CFX_FloatRect::Substract4 ( CFX_FloatRect substract_rect,
CFX_FloatRect pRects 
)

Subtract a rectangle area from this rectangle. The result might be up to 4 rectangles. The number of result rectangles are returned. Caller must prepare enough rectangles (up to 4).

Parameters
[in]substract_rectThe rectangle to be subtracted.
[out]pRectsThe rectangle array to receive result rectangles.
Returns
The number of result rectangles.

◆ Transform()

void CFX_FloatRect::Transform ( const CFX_Matrix pMatrix)

Transform a rectangle. The result rectangle is always normalized.

Parameters
[in]pMatrixThe transformation matrix.
Returns
None.

◆ Translate()

void CFX_FloatRect::Translate ( FX_FLOAT  e,
FX_FLOAT  f 
)
inline

Translate rectangle.

Parameters
[in]eOffset in X-axis.
[in]fOffset in Y-axis.
Returns
None.

◆ Union()

void CFX_FloatRect::Union ( const CFX_FloatRect other_rect)

Union with a rect.

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

◆ UpdateRect()

void CFX_FloatRect::UpdateRect ( FX_FLOAT  x,
FX_FLOAT  y 
)

Update the rectangle to contain the specified point.

Parameters
[in]xThe x-coordinate of the input point.
[in]yThe y-coordinate of the input point.
Returns
None.

◆ Width()

FX_FLOAT CFX_FloatRect::Width ( ) const
inline

Get the width of the rectangle.

Returns
Width of the rectangle.