RectangleF Class

Summary: Stores a set of four floating-point numbers that represent the location and size of a rectangle.

Module: aspose.imaging

Full Name: aspose.imaging.RectangleF

Constructors

NameDescription
RectangleF()Initializes a new instance of the RectangleF class
RectangleF(location, size)Initializes a new instance of the RectangleF structure with the specified location and size.
RectangleF(x, y, width, height)Initializes a new instance of the RectangleF structure with the specified location and size.

Properties

NameTypeAccessDescription
bottomfloatr/wGets or sets the y-coordinate that is the sum of RectangleF.y and RectangleF.height of this RectangleF structure.
empty [static]RectangleFrGets a new instance of the RectangleF structure that has RectangleF.x, RectangleF.y, RectangleF.width and RectangleF.height values set to zero.
heightfloatr/wGets or sets the height of this RectangleF structure.
is_emptyboolrGets a value indicating whether the RectangleF.width or RectangleF.height property of this RectangleF has a value of zero.
leftfloatr/wGets or sets the x-coordinate of the left edge of this RectangleF structure.
locationPointFr/wGets or sets the coordinates of the upper-left corner of this RectangleF structure.
rightfloatr/wGets or sets the x-coordinate that is the sum of RectangleF.x and RectangleF.width of this RectangleF structure.
sizeSizeFr/wGets or sets the size of this RectangleF.
topfloatr/wGets or sets the y-coordinate of the top edge of this RectangleF structure.
widthfloatr/wGets or sets the width of this RectangleF structure.
xfloatr/wGets or sets the x-coordinate of the upper-left corner of this RectangleF structure.
yfloatr/wGets or sets the y-coordinate of the upper-left corner of this RectangleF structure.

Methods

NameDescription
contains(point)Determines if the specified point is contained within this RectangleF structure.
contains(rect)Determines if the rectangular region represented by rect is entirely contained within this RectangleF structure.
contains(x, y)Determines if the specified point is contained within this RectangleF structure.
contains_point_f(point)Determines if the specified point is contained within this RectangleF structure.
contains_rect_f(rect)Determines if the rectangular region represented by rect is entirely contained within this RectangleF structure.
from_left_top_right_bottom(left, top, right, bottom)Creates a RectangleF structure with upper-left corner and lower-right corner at the specified locations.
from_points(point1, point2)Creates a new Rectangle from two points specified. Two verticles of the created Rectangle will be equal to the passed point1 and point2. These would be typically the opposite vertices.
inflate(rect, x, y)Creates and returns an inflated copy of the specified RectangleF structure. The copy is inflated by the specified amount. The original rectangle remains unmodified.
inflate(size)Inflates this RectangleF by the specified amount.
inflate(x, y)Inflates this RectangleF structure by the specified amount.
inflate_rect(rect, x, y)Creates and returns an inflated copy of the specified RectangleF structure. The copy is inflated by the specified amount. The original rectangle remains unmodified.
intersect(a, b)Returns a RectangleF structure that represents the intersection of two rectangles. If there is no intersection, and empty RectangleF is returned.
intersect(rect)Replaces this RectangleF structure with the intersection of itself and the specified RectangleF structure.
intersect_rects(a, b)Returns a RectangleF structure that represents the intersection of two rectangles. If there is no intersection, and empty RectangleF is returned.
intersects_with(rect)Determines if this rectangle intersects with rect.
normalize()Normalizes the rectangle by making it’s width and height positive, left less than right and top less than bottom.
offset(pos)Adjusts the location of this rectangle by the specified amount.
offset(x, y)Adjusts the location of this rectangle by the specified amount.
union(a, b)Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.

Constructor: RectangleF()

 RectangleF() 

Initializes a new instance of the RectangleF class

Constructor: RectangleF(location, size)

 RectangleF(location, size) 

Initializes a new instance of the RectangleF structure with the specified location and size.

Parameters:

ParameterTypeDescription
locationPointFA PointF that represents the upper-left corner of the rectangular region.
sizeSizeFA SizeF that represents the width and height of the rectangular region.

Constructor: RectangleF(x, y, width, height)

 RectangleF(x, y, width, height) 

Initializes a new instance of the RectangleF structure with the specified location and size.

Parameters:

ParameterTypeDescription
xfloatThe x-coordinate of the upper-left corner of the rectangle.
yfloatThe y-coordinate of the upper-left corner of the rectangle.
widthfloatThe width of the rectangle.
heightfloatThe height of the rectangle.

Method: contains(point)

 contains(point) 

Determines if the specified point is contained within this RectangleF structure.

Parameters:

ParameterTypeDescription
pointPointFThe PointF to test.

Returns

TypeDescription
boolThis method returns true if the point represented by the point parameter is contained within this RectangleF structure; otherwise false.

Method: contains(rect)

 contains(rect) 

Determines if the rectangular region represented by rect is entirely contained within this RectangleF structure.

Parameters:

ParameterTypeDescription
rectRectangleFThe RectangleF to test.

Returns

TypeDescription
boolThis method returns true if the rectangular region represented by rect is entirely contained within the rectangular region represented by this RectangleF; otherwise false.

Method: contains(x, y)

 contains(x, y) 

Determines if the specified point is contained within this RectangleF structure.

Parameters:

ParameterTypeDescription
xfloatThe x-coordinate of the point to test.
yfloatThe y-coordinate of the point to test.

Returns

TypeDescription
boolThis method returns true if the point defined by x and y is contained within this RectangleF structure; otherwise false.

Method: contains_point_f(point)

 contains_point_f(point) 

Determines if the specified point is contained within this RectangleF structure.

Parameters:

ParameterTypeDescription
pointPointFThe PointF to test.

Returns

TypeDescription
boolThis method returns true if the point represented by the point parameter is contained within this RectangleF structure; otherwise false.

Method: contains_rect_f(rect)

 contains_rect_f(rect) 

Determines if the rectangular region represented by rect is entirely contained within this RectangleF structure.

Parameters:

ParameterTypeDescription
rectRectangleFThe RectangleF to test.

Returns

TypeDescription
boolThis method returns true if the rectangular region represented by rect is entirely contained within the rectangular region represented by this RectangleF; otherwise false.

Method: from_left_top_right_bottom(left, top, right, bottom) [static]

 from_left_top_right_bottom(left, top, right, bottom) 

Creates a RectangleF structure with upper-left corner and lower-right corner at the specified locations.

Parameters:

ParameterTypeDescription
leftfloatThe x-coordinate of the upper-left corner of the rectangular region.
topfloatThe y-coordinate of the upper-left corner of the rectangular region.
rightfloatThe x-coordinate of the lower-right corner of the rectangular region.
bottomfloatThe y-coordinate of the lower-right corner of the rectangular region.

Returns

TypeDescription
RectangleFThe new RectangleF that this method creates.

Method: from_points(point1, point2) [static]

 from_points(point1, point2) 

Creates a new Rectangle from two points specified. Two verticles of the created Rectangle will be equal to the passed point1 and point2. These would be typically the opposite vertices.

Parameters:

ParameterTypeDescription
point1PointFThe first Point for the new rectangle.
point2PointFThe second Point for the new rectangle.

Returns

TypeDescription
RectangleFA newly created Rectangle.

Method: inflate(rect, x, y) [static]

 inflate(rect, x, y) 

Creates and returns an inflated copy of the specified RectangleF structure. The copy is inflated by the specified amount. The original rectangle remains unmodified.

Parameters:

ParameterTypeDescription
rectRectangleFThe RectangleF to be copied. This rectangle is not modified.
xfloatThe amount to inflate the copy of the rectangle horizontally.
yfloatThe amount to inflate the copy of the rectangle vertically.

Returns

TypeDescription
RectangleFThe inflated RectangleF.

Method: inflate(size)

 inflate(size) 

Inflates this RectangleF by the specified amount.

Parameters:

ParameterTypeDescription
sizeSizeFThe amount to inflate this rectangle.

Method: inflate(x, y)

 inflate(x, y) 

Inflates this RectangleF structure by the specified amount.

Parameters:

ParameterTypeDescription
xfloatThe amount to inflate this RectangleF structure horizontally.
yfloatThe amount to inflate this RectangleF structure vertically.

Method: inflate_rect(rect, x, y) [static]

 inflate_rect(rect, x, y) 

Creates and returns an inflated copy of the specified RectangleF structure. The copy is inflated by the specified amount. The original rectangle remains unmodified.

Parameters:

ParameterTypeDescription
rectRectangleFThe RectangleF to be copied. This rectangle is not modified.
xfloatThe amount to inflate the copy of the rectangle horizontally.
yfloatThe amount to inflate the copy of the rectangle vertically.

Returns

TypeDescription
RectangleFThe inflated RectangleF.

Method: intersect(a, b) [static]

 intersect(a, b) 

Returns a RectangleF structure that represents the intersection of two rectangles. If there is no intersection, and empty RectangleF is returned.

Parameters:

ParameterTypeDescription
aRectangleFA first rectangle to intersect.
bRectangleFA second rectangle to intersect.

Returns

TypeDescription
RectangleFA third RectangleF structure the size of which represents the overlapped area of the two specified rectangles.

Method: intersect(rect)

 intersect(rect) 

Replaces this RectangleF structure with the intersection of itself and the specified RectangleF structure.

Parameters:

ParameterTypeDescription
rectRectangleFThe rectangle to intersect.

Method: intersect_rects(a, b) [static]

 intersect_rects(a, b) 

Returns a RectangleF structure that represents the intersection of two rectangles. If there is no intersection, and empty RectangleF is returned.

Parameters:

ParameterTypeDescription
aRectangleFA first rectangle to intersect.
bRectangleFA second rectangle to intersect.

Returns

TypeDescription
RectangleFA third RectangleF structure the size of which represents the overlapped area of the two specified rectangles.

Method: intersects_with(rect)

 intersects_with(rect) 

Determines if this rectangle intersects with rect.

Parameters:

ParameterTypeDescription
rectRectangleFThe rectangle to test.

Returns

TypeDescription
boolThis method returns true if there is any intersection.

Method: offset(pos)

 offset(pos) 

Adjusts the location of this rectangle by the specified amount.

Parameters:

ParameterTypeDescription
posPointFThe amount to offset the location.

Method: offset(x, y)

 offset(x, y) 

Adjusts the location of this rectangle by the specified amount.

Parameters:

ParameterTypeDescription
xfloatThe amount to offset the location horizontally.
yfloatThe amount to offset the location vertically.

Method: union(a, b) [static]

 union(a, b) 

Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.

Parameters:

ParameterTypeDescription
aRectangleFA first rectangle to union.
bRectangleFA second rectangle to union.

Returns

TypeDescription
RectangleFA third RectangleF structure that contains both of the two rectangles that form the union.