iText 8.0.5 API
iText.Kernel.Geom.Rectangle Class Reference

Class that represent rectangle object. More...

Inheritance diagram for iText.Kernel.Geom.Rectangle:
iText.Kernel.Geom.PageSize iText.Svg.Utils.TextRectangle

Public Member Functions

  Rectangle (float x, float y, float width, float height)
  Creates new instance. More...
 
  Rectangle (float width, float height)
  Creates new instance of rectangle with (0, 0) as the lower left point. More...
 
  Rectangle (iText.Kernel.Geom.Rectangle rect)
  Creates the copy of given Rectangle More...
 
virtual Point[]  ToPointsArray ()
  Convert rectangle to an array of points More...
 
virtual iText.Kernel.Geom.Rectangle  GetIntersection (iText.Kernel.Geom.Rectangle rect)
  Get the rectangle representation of the intersection between this rectangle and the passed rectangle More...
 
virtual bool  Contains (iText.Kernel.Geom.Rectangle rect)
  Check if this rectangle contains the passed rectangle. More...
 
virtual bool  Overlaps (iText.Kernel.Geom.Rectangle rect)
  Check if this rectangle and the passed rectangle overlap More...
 
virtual bool  Overlaps (iText.Kernel.Geom.Rectangle rect, float epsilon)
  Check if this rectangle and the passed rectangle overlap More...
 
virtual iText.Kernel.Geom.Rectangle  SetBbox (float llx, float lly, float urx, float ury)
  Sets the rectangle by the coordinates, specifying its lower left and upper right points. More...
 
virtual float  GetX ()
  Gets the X coordinate of lower left point. More...
 
virtual iText.Kernel.Geom.Rectangle  SetX (float x)
  Sets the X coordinate of lower left point. More...
 
virtual float  GetY ()
  Gets the Y coordinate of lower left point. More...
 
virtual iText.Kernel.Geom.Rectangle  SetY (float y)
  Sets the Y coordinate of lower left point. More...
 
virtual float  GetWidth ()
  Gets the width of rectangle. More...
 
virtual iText.Kernel.Geom.Rectangle  SetWidth (float width)
  Sets the width of rectangle. More...
 
virtual float  GetHeight ()
  Gets the height of rectangle. More...
 
virtual iText.Kernel.Geom.Rectangle  SetHeight (float height)
  Sets the height of rectangle. More...
 
virtual iText.Kernel.Geom.Rectangle  IncreaseHeight (float extra)
  Increases the height of rectangle by the given value. More...
 
virtual iText.Kernel.Geom.Rectangle  DecreaseHeight (float extra)
  Decreases the height of rectangle by the given value. More...
 
virtual iText.Kernel.Geom.Rectangle  IncreaseWidth (float extra)
  Increases the width of rectangle by the given value. More...
 
virtual iText.Kernel.Geom.Rectangle  DecreaseWidth (float extra)
  Decreases the width of rectangle by the given value. More...
 
virtual float  GetLeft ()
  Gets the X coordinate of the left edge of the rectangle. More...
 
virtual float  GetRight ()
  Gets the X coordinate of the right edge of the rectangle. More...
 
virtual float  GetTop ()
  Gets the Y coordinate of the upper edge of the rectangle. More...
 
virtual float  GetBottom ()
  Gets the Y coordinate of the lower edge of the rectangle. More...
 
virtual iText.Kernel.Geom.Rectangle  MoveDown (float move)
  Decreases the y coordinate. More...
 
virtual iText.Kernel.Geom.Rectangle  MoveUp (float move)
  Increases the y coordinate. More...
 
virtual iText.Kernel.Geom.Rectangle  MoveRight (float move)
  Increases the x coordinate. More...
 
virtual iText.Kernel.Geom.Rectangle  MoveLeft (float move)
  Decreases the x coordinate. More...
 
virtual iText.Kernel.Geom.Rectangle  ApplyMargins (float topIndent, float rightIndent, float bottomIndent, float leftIndent, bool reverse)
  Change the rectangle according the specified margins. More...
 
virtual bool  IntersectsLine (float x1, float y1, float x2, float y2)
  Checks if rectangle have common points with line, specified by two points. More...
 
override String  ToString ()
  Gets the string representation of rectangle. More...
 
virtual iText.Kernel.Geom.Rectangle  Clone ()
  Creates a "deep copy" of this rectangle, meaning the object returned by this method will be independent of the object being cloned. More...
 
virtual bool  EqualsWithEpsilon (iText.Kernel.Geom.Rectangle that)
  Compares instance of this rectangle with given deviation equals to 0.0001 More...
 
virtual bool  EqualsWithEpsilon (iText.Kernel.Geom.Rectangle that, float eps)
  Compares instance of this rectangle with given deviation. More...
 

Static Public Member Functions

static iText.Kernel.Geom.Rectangle  GetCommonRectangle (params iText.Kernel.Geom.Rectangle[] rectangles)
  Calculates the common rectangle which includes all the input rectangles. More...
 
static iText.Kernel.Geom.Rectangle  GetRectangleOnRotatedPage (iText.Kernel.Geom.Rectangle rect, PdfPage page)
  Gets the rectangle as it looks on the rotated page and returns the rectangle in coordinates relevant to the true page origin. More...
 
static iText.Kernel.Geom.Rectangle  CalculateBBox (IList< Point > points)
  Calculates the bounding box of passed points. More...
 
static IList< iText.Kernel.Geom.Rectangle CreateBoundingRectanglesFromQuadPoint (PdfArray quadPoints)
  Create a list of bounding rectangles from an 8 x n array of Quadpoints. More...
 
static iText.Kernel.Geom.Rectangle  CreateBoundingRectangleFromQuadPoint (PdfArray quadPoints)
  Create the bounding rectangle for the given array of quadpoints. More...
 

Package Attributes

float  x
 
float  y
 
float  width
 
float  height
 

Detailed Description

Class that represent rectangle object.

Constructor & Destructor Documentation

◆ Rectangle() [1/3]

iText.Kernel.Geom.Rectangle.Rectangle ( float  x,
float  y,
float  width,
float  height 
)
inline

Creates new instance.

Parameters
x the x coordinate of lower left point
y the y coordinate of lower left point
width the width value
height the height value

◆ Rectangle() [2/3]

iText.Kernel.Geom.Rectangle.Rectangle ( float  width,
float  height 
)
inline

Creates new instance of rectangle with (0, 0) as the lower left point.

Parameters
width the width value
height the height value

◆ Rectangle() [3/3]

iText.Kernel.Geom.Rectangle.Rectangle ( iText.Kernel.Geom.Rectangle  rect )
inline

Creates the copy of given Rectangle

Parameters
rect the copied Rectangle

Member Function Documentation

◆ ApplyMargins()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.ApplyMargins ( float  topIndent,
float  rightIndent,
float  bottomIndent,
float  leftIndent,
bool  reverse 
)
inlinevirtual

Change the rectangle according the specified margins.

Parameters
topIndent the value on which the top y coordinate will change.
rightIndent the value on which the right x coordinate will change.
bottomIndent the value on which the bottom y coordinate will change.
leftIndent the value on which the left x coordinate will change.
reverse if true the rectangle will expand, otherwise it will shrink
Returns
the rectangle with applied margins

◆ CalculateBBox()

static iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.CalculateBBox ( IList< Point points )
inlinestatic

Calculates the bounding box of passed points.

Parameters
points the points which appear inside the area
Returns
the bounding box of passed points.

◆ Clone()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.Clone ( )
inlinevirtual

Creates a "deep copy" of this rectangle, meaning the object returned by this method will be independent of the object being cloned.

Returns
the copied rectangle.

Reimplemented in iText.Kernel.Geom.PageSize.

◆ Contains()

virtual bool iText.Kernel.Geom.Rectangle.Contains ( iText.Kernel.Geom.Rectangle  rect )
inlinevirtual

Check if this rectangle contains the passed rectangle.

Check if this rectangle contains the passed rectangle. A rectangle will envelop itself, meaning that for any rectangle rect the expression rect.contains(rect) always returns true.

Parameters
rect a rectangle which is to be checked if it is fully contained inside this rectangle.
Returns
true if this rectangle contains the passed rectangle, false otherwise.

◆ CreateBoundingRectangleFromQuadPoint()

static iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.CreateBoundingRectangleFromQuadPoint ( PdfArray  quadPoints )
inlinestatic

Create the bounding rectangle for the given array of quadpoints.

Parameters
quadPoints an array containing 8 numbers that correspond to 4 points.
Returns
The smallest orthogonal rectangle containing the quadpoints.

◆ CreateBoundingRectanglesFromQuadPoint()

static IList<iText.Kernel.Geom.Rectangle> iText.Kernel.Geom.Rectangle.CreateBoundingRectanglesFromQuadPoint ( PdfArray  quadPoints )
inlinestatic

Create a list of bounding rectangles from an 8 x n array of Quadpoints.

Parameters
quadPoints 8xn array of numbers representing 4 points
Returns
a list of bounding rectangles for the passed quadpoints

◆ DecreaseHeight()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.DecreaseHeight ( float  extra )
inlinevirtual

Decreases the height of rectangle by the given value.

Decreases the height of rectangle by the given value. May be used in chain.

Parameters
extra the value of the extra height to be subtracted.
Returns
this Rectangle instance.

◆ DecreaseWidth()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.DecreaseWidth ( float  extra )
inlinevirtual

Decreases the width of rectangle by the given value.

Decreases the width of rectangle by the given value. May be used in chain.

Parameters
extra the value of the extra width to be subtracted.
Returns
this Rectangle instance.

◆ EqualsWithEpsilon() [1/2]

virtual bool iText.Kernel.Geom.Rectangle.EqualsWithEpsilon ( iText.Kernel.Geom.Rectangle  that )
inlinevirtual

Compares instance of this rectangle with given deviation equals to 0.0001

Parameters
that the Rectangle to compare with.
Returns

true if the difference between corresponding rectangle values is less than deviation and false otherwise.

◆ EqualsWithEpsilon() [2/2]

virtual bool iText.Kernel.Geom.Rectangle.EqualsWithEpsilon ( iText.Kernel.Geom.Rectangle  that,
float  eps 
)
inlinevirtual

Compares instance of this rectangle with given deviation.

Parameters
that the Rectangle to compare with.
eps the deviation value.
Returns

true if the difference between corresponding rectangle values is less than deviation and false otherwise.

◆ GetBottom()

virtual float iText.Kernel.Geom.Rectangle.GetBottom ( )
inlinevirtual

Gets the Y coordinate of the lower edge of the rectangle.

Gets the Y coordinate of the lower edge of the rectangle. Same as: getY().

Returns
the Y coordinate of the lower edge of the rectangle.

◆ GetCommonRectangle()

static iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.GetCommonRectangle ( params iText.Kernel.Geom.Rectangle[]  rectangles )
inlinestatic

Calculates the common rectangle which includes all the input rectangles.

Parameters
rectangles list of input rectangles.
Returns
common rectangle.

◆ GetHeight()

virtual float iText.Kernel.Geom.Rectangle.GetHeight ( )
inlinevirtual

Gets the height of rectangle.

Returns
the height of rectangle.

◆ GetIntersection()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.GetIntersection ( iText.Kernel.Geom.Rectangle  rect )
inlinevirtual

Get the rectangle representation of the intersection between this rectangle and the passed rectangle

Parameters
rect the rectangle to find the intersection with
Returns
the intersection rectangle if the passed rectangles intersects with this rectangle, a rectangle representing a line if the intersection is along an edge or a rectangle representing a point if the intersection is a single point, null otherwise

◆ GetLeft()

virtual float iText.Kernel.Geom.Rectangle.GetLeft ( )
inlinevirtual

Gets the X coordinate of the left edge of the rectangle.

Gets the X coordinate of the left edge of the rectangle. Same as: getX().

Returns
the X coordinate of the left edge of the rectangle.

◆ GetRectangleOnRotatedPage()

static iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.GetRectangleOnRotatedPage ( iText.Kernel.Geom.Rectangle  rect,
PdfPage  page 
)
inlinestatic

Gets the rectangle as it looks on the rotated page and returns the rectangle in coordinates relevant to the true page origin.

Gets the rectangle as it looks on the rotated page and returns the rectangle in coordinates relevant to the true page origin. This rectangle can be used to add annotations, fields, and other objects to the rotated page.

Parameters
rect the rectangle as it looks on the rotated page.
page the page on which one want to process the rectangle.
Returns
the newly created rectangle with translated coordinates.

◆ GetRight()

virtual float iText.Kernel.Geom.Rectangle.GetRight ( )
inlinevirtual

Gets the X coordinate of the right edge of the rectangle.

Gets the X coordinate of the right edge of the rectangle. Same as: getX() + getWidth().

Returns
the X coordinate of the right edge of the rectangle.

◆ GetTop()

virtual float iText.Kernel.Geom.Rectangle.GetTop ( )
inlinevirtual

Gets the Y coordinate of the upper edge of the rectangle.

Gets the Y coordinate of the upper edge of the rectangle. Same as: getY() + getHeight().

Returns
the Y coordinate of the upper edge of the rectangle.

◆ GetWidth()

virtual float iText.Kernel.Geom.Rectangle.GetWidth ( )
inlinevirtual

Gets the width of rectangle.

Returns
the width of rectangle.

◆ GetX()

virtual float iText.Kernel.Geom.Rectangle.GetX ( )
inlinevirtual

Gets the X coordinate of lower left point.

Returns
the X coordinate of lower left point.

◆ GetY()

virtual float iText.Kernel.Geom.Rectangle.GetY ( )
inlinevirtual

Gets the Y coordinate of lower left point.

Returns
the Y coordinate of lower left point.

◆ IncreaseHeight()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.IncreaseHeight ( float  extra )
inlinevirtual

Increases the height of rectangle by the given value.

Increases the height of rectangle by the given value. May be used in chain.

Parameters
extra the value of the extra height to be added.
Returns
this Rectangle instance.

◆ IncreaseWidth()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.IncreaseWidth ( float  extra )
inlinevirtual

Increases the width of rectangle by the given value.

Increases the width of rectangle by the given value. May be used in chain.

Parameters
extra the value of the extra wudth to be added.
Returns
this Rectangle instance.

◆ IntersectsLine()

virtual bool iText.Kernel.Geom.Rectangle.IntersectsLine ( float  x1,
float  y1,
float  x2,
float  y2 
)
inlinevirtual

Checks if rectangle have common points with line, specified by two points.

Parameters
x1 the x coordinate of first line's point.
y1 the y coordinate of first line's point.
x2 the x coordinate of second line's point.
y2 the y coordinate of second line's point.
Returns

true if rectangle have common points with line and false otherwise.

◆ MoveDown()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.MoveDown ( float  move )
inlinevirtual

Decreases the y coordinate.

Parameters
move the value on which the position will be changed.
Returns
this Rectangle instance.

◆ MoveLeft()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.MoveLeft ( float  move )
inlinevirtual

Decreases the x coordinate.

Parameters
move the value on which the position will be changed.
Returns
this Rectangle instance.

◆ MoveRight()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.MoveRight ( float  move )
inlinevirtual

Increases the x coordinate.

Parameters
move the value on which the position will be changed.
Returns
this Rectangle instance.

◆ MoveUp()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.MoveUp ( float  move )
inlinevirtual

Increases the y coordinate.

Parameters
move the value on which the position will be changed.
Returns
this Rectangle instance.

◆ Overlaps() [1/2]

virtual bool iText.Kernel.Geom.Rectangle.Overlaps ( iText.Kernel.Geom.Rectangle  rect )
inlinevirtual

Check if this rectangle and the passed rectangle overlap

Parameters
rect a rectangle which is to be checked if it overlaps the passed rectangle
Returns
true if there is overlap of some kind

◆ Overlaps() [2/2]

virtual bool iText.Kernel.Geom.Rectangle.Overlaps ( iText.Kernel.Geom.Rectangle  rect,
float  epsilon 
)
inlinevirtual

Check if this rectangle and the passed rectangle overlap

Parameters
rect a rectangle which is to be checked if it overlaps the passed rectangle
epsilon if greater than zero, then this is the maximum distance that one rectangle can go to another, but they will not overlap, if less than zero, then this is the minimum required distance between the rectangles so that they do not overlap
Returns
true if there is overlap of some kind

◆ SetBbox()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.SetBbox ( float  llx,
float  lly,
float  urx,
float  ury 
)
inlinevirtual

Sets the rectangle by the coordinates, specifying its lower left and upper right points.

Sets the rectangle by the coordinates, specifying its lower left and upper right points. May be used in chain.

Note: this method will normalize coordinates, so the rectangle will have non negative width and height, and its x and y coordinates specified lower left point.

Parameters
llx the X coordinate of lower left point
lly the Y coordinate of lower left point
urx the X coordinate of upper right point
ury the Y coordinate of upper right point
Returns
this Rectangle instance.

◆ SetHeight()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.SetHeight ( float  height )
inlinevirtual

Sets the height of rectangle.

Sets the height of rectangle. May be used in chain.

Parameters
height the the width of rectangle to be set.
Returns
this Rectangle instance.

◆ SetWidth()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.SetWidth ( float  width )
inlinevirtual

Sets the width of rectangle.

Sets the width of rectangle. May be used in chain.

Parameters
width the the width of rectangle to be set.
Returns
this Rectangle instance.

◆ SetX()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.SetX ( float  x )
inlinevirtual

Sets the X coordinate of lower left point.

Sets the X coordinate of lower left point. May be used in chain.

Parameters
x the X coordinate of lower left point to be set.
Returns
this Rectangle instance.

◆ SetY()

virtual iText.Kernel.Geom.Rectangle iText.Kernel.Geom.Rectangle.SetY ( float  y )
inlinevirtual

Sets the Y coordinate of lower left point.

Sets the Y coordinate of lower left point. May be used in chain.

Parameters
y the Y coordinate of lower left point to be set.
Returns
this Rectangle instance.

◆ ToPointsArray()

virtual Point [] iText.Kernel.Geom.Rectangle.ToPointsArray ( )
inlinevirtual

Convert rectangle to an array of points

Returns
array of four extreme points of rectangle

◆ ToString()

override String iText.Kernel.Geom.Rectangle.ToString ( )
inline

Gets the string representation of rectangle.

Returns
the string representation of rectangle.