Struct RectangleF

Struct RectangleF

Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)

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

public struct RectangleF

Inherited Members

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

RectangleF(float, float, float, float)

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

public RectangleF(float x, float y, float width, float height)

Parameters

x float

The x-coordinate of the upper-left corner of the rectangle.

y float

The y-coordinate of the upper-left corner of the rectangle.

width float

The width of the rectangle.

height float

The height of the rectangle.

RectangleF(PointF, SizeF)

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

public RectangleF(PointF location, SizeF size)

Parameters

location PointF

A Aspose.Imaging.PointF that represents the upper-left corner of the rectangular region.

size SizeF

A Aspose.Imaging.SizeF that represents the width and height of the rectangular region.

Properties

Bottom

Gets or sets the y-coordinate that is the sum of Aspose.Imaging.RectangleF.Y and Aspose.Imaging.RectangleF.Height of this Aspose.Imaging.RectangleF structure.

public float Bottom { get; set; }

Property Value

float

Empty

Gets a new instance of the Aspose.Imaging.RectangleF structure that has Aspose.Imaging.RectangleF.X, Aspose.Imaging.RectangleF.Y, Aspose.Imaging.RectangleF.Width and Aspose.Imaging.RectangleF.Height values set to zero.

public static RectangleF Empty { get; }

Property Value

RectangleF

Height

Gets or sets the height of this Aspose.Imaging.RectangleF structure.

public float Height { get; set; }

Property Value

float

IsEmpty

Gets a value indicating whether the Aspose.Imaging.RectangleF.Width or Aspose.Imaging.RectangleF.Height property of this Aspose.Imaging.RectangleF has a value of zero.

[JsonIgnore]
public bool IsEmpty { get; }

Property Value

bool

Left

Gets or sets the x-coordinate of the left edge of this Aspose.Imaging.RectangleF structure.

public float Left { get; set; }

Property Value

float

Location

Gets or sets the coordinates of the upper-left corner of this Aspose.Imaging.RectangleF structure.

public PointF Location { get; set; }

Property Value

PointF

Right

Gets or sets the x-coordinate that is the sum of Aspose.Imaging.RectangleF.X and Aspose.Imaging.RectangleF.Width of this Aspose.Imaging.RectangleF structure.

public float Right { get; set; }

Property Value

float

Size

Gets or sets the size of this Aspose.Imaging.RectangleF.

public SizeF Size { get; set; }

Property Value

SizeF

Top

Gets or sets the y-coordinate of the top edge of this Aspose.Imaging.RectangleF structure.

public float Top { get; set; }

Property Value

float

Width

Gets or sets the width of this Aspose.Imaging.RectangleF structure.

public float Width { get; set; }

Property Value

float

X

Gets or sets the x-coordinate of the upper-left corner of this Aspose.Imaging.RectangleF structure.

public float X { get; set; }

Property Value

float

Y

Gets or sets the y-coordinate of the upper-left corner of this Aspose.Imaging.RectangleF structure.

public float Y { get; set; }

Property Value

float

Methods

Contains(float, float)

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

public bool Contains(float x, float y)

Parameters

x float

The x-coordinate of the point to test.

y float

The y-coordinate of the point to test.

Returns

bool

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

Contains(PointF)

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

public bool Contains(PointF point)

Parameters

point PointF

The Aspose.Imaging.PointF to test.

Returns

bool

This method returns true if the point represented by the point parameter is contained within this Aspose.Imaging.RectangleF structure; otherwise false.

Contains(RectangleF)

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

public bool Contains(RectangleF rect)

Parameters

rect RectangleF

The Aspose.Imaging.RectangleF to test.

Returns

bool

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

Equals(object)

Tests whether obj is a Aspose.Imaging.RectangleF with the same location and size of this Aspose.Imaging.RectangleF.

public override bool Equals(object obj)

Parameters

obj object

The System.Object to test.

Returns

bool

This method returns true if obj is a Aspose.Imaging.RectangleF and its X, Y, Width, and Height properties are equal to the corresponding properties of this Aspose.Imaging.RectangleF; otherwise, false.

FromLeftTopRightBottom(float, float, float, float)

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

public static RectangleF FromLeftTopRightBottom(float left, float top, float right, float bottom)

Parameters

left float

The x-coordinate of the upper-left corner of the rectangular region.

top float

The y-coordinate of the upper-left corner of the rectangular region.

right float

The x-coordinate of the lower-right corner of the rectangular region.

bottom float

The y-coordinate of the lower-right corner of the rectangular region.

Returns

RectangleF

The new Aspose.Imaging.RectangleF that this method creates.

FromPoints(PointF, PointF)

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

public static RectangleF FromPoints(PointF point1, PointF point2)

Parameters

point1 PointF

The first Aspose.Imaging.Point for the new rectangle.

point2 PointF

The second Aspose.Imaging.Point for the new rectangle.

Returns

RectangleF

A newly created Aspose.Imaging.Rectangle.

GetHashCode()

Gets the hash code for this Aspose.Imaging.RectangleF structure.

public override int GetHashCode()

Returns

int

The hash code for this Aspose.Imaging.RectangleF.

Inflate(RectangleF, float, float)

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

public static RectangleF Inflate(RectangleF rect, float x, float y)

Parameters

rect RectangleF

The Aspose.Imaging.RectangleF to be copied. This rectangle is not modified.

x float

The amount to inflate the copy of the rectangle horizontally.

y float

The amount to inflate the copy of the rectangle vertically.

Returns

RectangleF

The inflated Aspose.Imaging.RectangleF.

Inflate(float, float)

Inflates this Aspose.Imaging.RectangleF structure by the specified amount.

public void Inflate(float x, float y)

Parameters

x float

The amount to inflate this Aspose.Imaging.RectangleF structure horizontally.

y float

The amount to inflate this Aspose.Imaging.RectangleF structure vertically.

Inflate(SizeF)

Inflates this Aspose.Imaging.RectangleF by the specified amount.

public void Inflate(SizeF size)

Parameters

size SizeF

The amount to inflate this rectangle.

Intersect(RectangleF, RectangleF)

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

public static RectangleF Intersect(RectangleF a, RectangleF b)

Parameters

a RectangleF

A first rectangle to intersect.

b RectangleF

A second rectangle to intersect.

Returns

RectangleF

A third Aspose.Imaging.RectangleF structure the size of which represents the overlapped area of the two specified rectangles.

Intersect(RectangleF)

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

public void Intersect(RectangleF rect)

Parameters

rect RectangleF

The rectangle to intersect.

IntersectsWith(RectangleF)

Determines if this rectangle intersects with rect.

public bool IntersectsWith(RectangleF rect)

Parameters

rect RectangleF

The rectangle to test.

Returns

bool

This method returns true if there is any intersection.

Normalize()

Normalizes the rectangle by making it’s width and height positive, left less than right and top less than bottom.

public void Normalize()

Offset(PointF)

Adjusts the location of this rectangle by the specified amount.

public void Offset(PointF pos)

Parameters

pos PointF

The amount to offset the location.

Offset(float, float)

Adjusts the location of this rectangle by the specified amount.

public void Offset(float x, float y)

Parameters

x float

The amount to offset the location horizontally.

y float

The amount to offset the location vertically.

ToString()

Converts the attributes of this Aspose.Imaging.RectangleF to a human-readable string.

public override string ToString()

Returns

string

A string that contains the position, width, and height of this Aspose.Imaging.RectangleF structure.

Union(RectangleF, RectangleF)

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

public static RectangleF Union(RectangleF a, RectangleF b)

Parameters

a RectangleF

A first rectangle to union.

b RectangleF

A second rectangle to union.

Returns

RectangleF

A third Aspose.Imaging.RectangleF structure that contains both of the two rectangles that form the union.

Operators

operator /(RectangleF, float)

Implements the operator /.

public static RectangleF operator /(RectangleF rectangle, float divider)

Parameters

rectangle RectangleF

The rectangle.

divider float

The divider.

Returns

RectangleF

The result of the operator.

Exceptions

ArgumentOutOfRangeException

divider - Division by zero is not allowed.

operator ==(RectangleF, RectangleF)

Tests whether two Aspose.Imaging.RectangleF structures have equal location and size.

public static bool operator ==(RectangleF left, RectangleF right)

Parameters

left RectangleF

The Aspose.Imaging.RectangleF structure that is to the left of the equality operator.

right RectangleF

The Aspose.Imaging.RectangleF structure that is to the right of the equality operator.

Returns

bool

This operator returns true if the two specified Aspose.Imaging.RectangleF structures have equal Aspose.Imaging.RectangleF.X, Aspose.Imaging.RectangleF.Y, Aspose.Imaging.RectangleF.Width, and Aspose.Imaging.RectangleF.Height properties.

implicit operator RectangleF(Rectangle)

Converts the specified Aspose.Imaging.Rectangle structure to a Aspose.Imaging.RectangleF structure.

public static implicit operator RectangleF(Rectangle rect)

Parameters

rect Rectangle

The Aspose.Imaging.Rectangle structure to convert.

Returns

RectangleF

The Aspose.Imaging.RectangleF structure that is converted from the specified Aspose.Imaging.Rectangle structure.

operator !=(RectangleF, RectangleF)

Tests whether two Aspose.Imaging.RectangleF structures differ in location or size.

public static bool operator !=(RectangleF left, RectangleF right)

Parameters

left RectangleF

The Aspose.Imaging.RectangleF structure that is to the left of the inequality operator.

right RectangleF

The Aspose.Imaging.RectangleF structure that is to the right of the inequality operator.

Returns

bool

This operator returns true if any of the Aspose.Imaging.RectangleF.X , Aspose.Imaging.RectangleF.Y, Aspose.Imaging.RectangleF.Width, or Aspose.Imaging.RectangleF.Height properties of the two Aspose.Imaging.RectangleF structures are unequal; otherwise false.

operator *(RectangleF, float)

Implements the operator *.

public static RectangleF operator *(RectangleF rectangle, float multiplier)

Parameters

rectangle RectangleF

The rectangle.

multiplier float

The multiplier.

Returns

RectangleF

The result of the operator.