Foxit PDF SDK
com.foxit.sdk.common.fxcrt.RectF Class Reference

Public Member Functions

 RectF ()
 Construct an empty rectangle.

 
 RectF (float left1, float bottom1, float right1, float top1)
 Construct a rectangle with left-bottom and right-top corners.
More...
 
 RectF (RectI rect)
 Construct a rectangle with a rectangle object.
More...
 
boolean contains (RectF other_rect)
 Check if current rectangle fully contains the other provided rectangle. That means to check if the other rectangle is fully inside current one.
More...
 
boolean contains (float x, float y)
 Check if current rectangle fully contains the provided point. That means to check if the provided point is inside current rectangle.
More...
 
void deflate (float x, float y)
 Decreases the width and height of the rectangle.
More...
 
void deflate (float left, float bottom, float right, float top)
 Decreases the width and height of the rectangle.
More...
 
void deflate (RectF rt)
 Decreases the width and height of the rectangle.
More...
 
float getBottom ()
 Get the bottom. More...
 
RectI getClosestRect ()
 Get a closest integer rectangle.
More...
 
RectI getInnerRect ()
 Convert to an inner integer rectangle.
More...
 
float getLeft ()
 Get the left. More...
 
RectI getOuterRect ()
 Convert to an outer integer rectangle.
More...
 
float getRight ()
 Get the right. More...
 
float getTop ()
 Get the top. More...
 
float height ()
 Get the height of the rectangle.
More...
 
void inflate (float x, float y)
 Increases the width and height of the rectangle.
More...
 
void inflate (float left, float bottom, float right, float top)
 Increases the width and height of the rectangle.
More...
 
void inflate (RectF rt)
 Increases the width and height of the rectangle.
More...
 
void initRect (float x, float y)
 Initialize the rectangle to a single point.
More...
 
void intersect (RectF other_rect)
 Intersect with a rect.
More...
 
boolean isEmpty ()
 Verify whether the rect is empty.
More...
 
void normalize ()
 Normalize the rect. Make sure left <= right, and bottom <= top.
More...
 
void reset ()
 Reset rectangle, set coordinates to 0.
More...
 
void setBottom (float value)
 Set the bottom. More...
 
void setLeft (float value)
 Set the left. More...
 
void setRight (float value)
 Set the right. More...
 
void setTop (float value)
 Set the top. More...
 
void transform (Matrix2D pMatrix)
 Transform a rectangle. The result rectangle is always normalized.
More...
 
void translate (float e, float f)
 Translate rectangle.
More...
 
void union (RectF other_rect)
 Union with a rect.
More...
 
void updateRect (float x, float y)
 Update the rectangle to contain the specified point.
More...
 
float width ()
 Get the width of the rectangle.
More...
 

Static Public Member Functions

static RectF getBBox (PointF pPoints, int nPoints)
 Get the bounding box of input points array.
More...
 
static boolean isRectAdjacent (RectF rect1, RectF rect2, float alignmentTolerance, float distanceTolerance, int direction)
 Check if a rectangle is adjacent to the other rectangle in the horizontal or vertical direction.
More...
 

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

◆ RectF() [1/2]

com.foxit.sdk.common.fxcrt.RectF.RectF ( float  left1,
float  bottom1,
float  right1,
float  top1 
)

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.

◆ RectF() [2/2]

com.foxit.sdk.common.fxcrt.RectF.RectF ( RectI  rect)

Construct a rectangle with a rectangle object.

Parameters
[in]rectThe input rectangle object.

Member Function Documentation

◆ contains() [1/2]

boolean com.foxit.sdk.common.fxcrt.RectF.contains ( RectF  other_rect)

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]

boolean com.foxit.sdk.common.fxcrt.RectF.contains ( float  x,
float  y 
)

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 com.foxit.sdk.common.fxcrt.RectF.deflate ( float  x,
float  y 
)

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 com.foxit.sdk.common.fxcrt.RectF.deflate ( float  left,
float  bottom,
float  right,
float  top 
)

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 com.foxit.sdk.common.fxcrt.RectF.deflate ( RectF  rt)

Decreases the width and height of the rectangle.

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

◆ getBBox()

static RectF com.foxit.sdk.common.fxcrt.RectF.getBBox ( 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.

◆ getBottom()

com.foxit.sdk.common.fxcrt.RectF.getBottom ( )

Get the bottom.

Returns
The bottom.

◆ getClosestRect()

RectI com.foxit.sdk.common.fxcrt.RectF.getClosestRect ( )

Get a closest integer rectangle.

Returns
The closest integer rectangle.

◆ getInnerRect()

RectI com.foxit.sdk.common.fxcrt.RectF.getInnerRect ( )

Convert to an inner integer rectangle.

Returns
The inner integer rectangle.

◆ getLeft()

com.foxit.sdk.common.fxcrt.RectF.getLeft ( )

Get the left.

Returns
The left.

◆ getOuterRect()

RectI com.foxit.sdk.common.fxcrt.RectF.getOuterRect ( )

Convert to an outer integer rectangle.

Returns
The outer integer rectangle.

◆ getRight()

com.foxit.sdk.common.fxcrt.RectF.getRight ( )

Get the right.

Returns
The right.

◆ getTop()

com.foxit.sdk.common.fxcrt.RectF.getTop ( )

Get the top.

Returns
The top.

◆ height()

float com.foxit.sdk.common.fxcrt.RectF.height ( )

Get the height of the rectangle.

Returns
Height of the rectangle.

◆ inflate() [1/3]

void com.foxit.sdk.common.fxcrt.RectF.inflate ( float  x,
float  y 
)

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 com.foxit.sdk.common.fxcrt.RectF.inflate ( float  left,
float  bottom,
float  right,
float  top 
)

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 com.foxit.sdk.common.fxcrt.RectF.inflate ( RectF  rt)

Increases the width and height of the rectangle.

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

◆ initRect()

void com.foxit.sdk.common.fxcrt.RectF.initRect ( float  x,
float  y 
)

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 com.foxit.sdk.common.fxcrt.RectF.intersect ( RectF  other_rect)

Intersect with a rect.

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

◆ isEmpty()

boolean com.foxit.sdk.common.fxcrt.RectF.isEmpty ( )

Verify whether the rect is empty.

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

◆ isRectAdjacent()

static boolean com.foxit.sdk.common.fxcrt.RectF.isRectAdjacent ( RectF  rect1,
RectF  rect2,
float  alignmentTolerance,
float  distanceTolerance,
int  direction 
)
static

Check if a rectangle is adjacent to the other rectangle in the horizontal or vertical direction.

Parameters
[in]rect1A rectangle which is to be check if adjacent to parameter rect2.
[in]rect2The other rectangle.
[in]alignmentToleranceAlignment tolerance to be allowed between two rectangles. Measured in coordinate units, and should be non-negative value.
[in]distanceToleranceDistance tolerance to be allowed between two rectangles. Measured in coordinate units, and should be non-negative value.
[in]directionSpecify a direction to judge adjacent state between two rectangles:
  • 0 means horizontal direction.
  • 1 means vertical direction.

Returns
true means the specified rectangle is adjacent to the other specified rectangle in specified direction, while false means the specified rectangle is not adjacent to the other specified rectangle in specified direction.

◆ normalize()

void com.foxit.sdk.common.fxcrt.RectF.normalize ( )

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

Returns
None.

◆ reset()

void com.foxit.sdk.common.fxcrt.RectF.reset ( )

Reset rectangle, set coordinates to 0.

Returns
None.

◆ setBottom()

com.foxit.sdk.common.fxcrt.RectF.setBottom ( float  value)

Set the bottom.

Parameters
[in]valueThe bottom.
Returns
None.

◆ setLeft()

com.foxit.sdk.common.fxcrt.RectF.setLeft ( float  value)

Set the left.

Parameters
[in]valueThe left.
Returns
None.

◆ setRight()

com.foxit.sdk.common.fxcrt.RectF.setRight ( float  value)

Set the right.

Parameters
[in]valueThe right.
Returns
None.

◆ setTop()

com.foxit.sdk.common.fxcrt.RectF.setTop ( float  value)

Set the top.

Parameters
[in]valueThe top.
Returns
None.

◆ transform()

void com.foxit.sdk.common.fxcrt.RectF.transform ( Matrix2D  pMatrix)

Transform a rectangle. The result rectangle is always normalized.

Parameters
[in]pMatrixThe transformation matrix.
Returns
None.

◆ translate()

void com.foxit.sdk.common.fxcrt.RectF.translate ( float  e,
float  f 
)

Translate rectangle.

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

◆ union()

void com.foxit.sdk.common.fxcrt.RectF.union ( RectF  other_rect)

Union with a rect.

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

◆ updateRect()

void com.foxit.sdk.common.fxcrt.RectF.updateRect ( float  x,
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()

float com.foxit.sdk.common.fxcrt.RectF.width ( )

Get the width of the rectangle.

Returns
Width of the rectangle.