Table of Contents

Struct RectD

Namespace
Alternet.Drawing
Assembly
Alternet.UI.Common.dll

Stores the location and size of a rectangular region.

[Serializable]
public struct RectD : IEquatable<RectD>
Implements
Extension Methods

Constructors

RectD(PointD, SizeD)

Initializes a new instance of the RectD class with the specified location and size.

RectD(double, double, double, double)

Initializes a new instance of the RectD class with the specified location and size.

RectD(Vector4)

Initializes a new instance of the RectD struct from the specified Vector4.

Fields

Empty

Initializes a new instance of the RectD class.

MinusOne

Initializes a new instance of the RectD class with -1 in all bounds.

NaN

Initializes a new instance of the RectD class with NaN in all bounds.

Properties

Bottom

Gets the y-coordinate of the lower-right corner of the rectangular region defined by this RectD.

BottomLeft

Gets the point which is at (X, Y + Height).

BottomRight

Gets the point which is at (X + Width, Y + Height).

Center

Gets the center point of this RectD.

Height

Gets or sets the height of the rectangular region defined by this RectD.

IsEmpty

Tests whether this RectD has all properties equal to 0.

IsZero

Tests whether this RectD has all properties equal to 0.

Left

Gets or sets the x-coordinate of the upper-left corner of the rectangular region defined by this RectD.

Location

Gets or sets the coordinates of the upper-left corner of the rectangular region represented by this RectD.

MaxWidthHeight

Gets maximum of Width and Height.

MinWidthHeight

Gets minimum of Width and Height.

Right

Gets the x-coordinate of the lower-right corner of the rectangular region defined by this RectD.

Size

Gets or sets the size of this RectD.

SizeIsEmpty

Tests whether this RectD has a Width or a Height less than or equal to 0.

Top

Gets or sets the y-coordinate of the upper-left corner of the rectangular region defined by this RectD.

TopLeft

This is a read-only alias for the point which is at (X, Y).

TopRight

Gets the point which is at (X + Width, Y).

Width

Gets or sets the width of the rectangular region defined by this RectD.

X

Gets or sets the x-coordinate of the upper-left corner of the rectangular region defined by this RectD.

Y

Gets or sets the y-coordinate of the upper-left corner of the rectangular region defined by this RectD.

Methods

ApplyMargin(Thickness)

Applies margins to this rectangle. X is incremented with Left, Y is incremented with Top, Width is decremented with horizontal margins (Horizontal) and Height is decremented with vertical margins (Vertical).

Ceiling()

Returns new RectD value with ceiling of location and size. Uses Ceiling(double) on values.

CenterIn(RectD, bool, bool)

Centers this rectangle in the given (usually, but not necessarily, larger) one.

Contains(PointD)

Determines if the specified point is contained within the rectangular region defined by this RectD .

Contains(RectD)

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

Contains(double, double)

Determines if the specified point is contained within the rectangular region defined by this RectD .

ConvertToString(string, IFormatProvider)

Creates a string representation of this object based on the format string and IFormatProvider passed in. If the provider is null, the CurrentCulture is used. See the documentation for IFormattable for more information.

CoordToFloat(double)

Converts double coordinate to the float value.

CoordToInt(double)

Converts double coordinate to the integer value.

Create(double, double)

Creates new rectangle with the specified width and height.

Deflate()

Deflates this RectD by 1. X and Y are incremented by 1, Width and Height are decremented by 2.

DeflatedWithPadding(Thickness)

Returns this rectangle deflated by the specified padding.

Equals(RectD)

Indicates whether the current object is equal to another object of the same type.

Equals(object?)

Tests whether obj is a RectD with the same location and size of this RectD.

FromCenter(PointD, SizeD)

Creates a new RectD from a centerpoint and size.

FromLTRB(PointD, PointD)

Creates a new RectD specified by two points.

FromLTRB(double, double, double, double)

Creates a new RectD using (left, top) and (right, bottom) points.

GetCircleBoundingBox(PointD, double)

Creates bounding rectangle for the circle specified using radius and its center location.

GetHashCode()

Gets the hash code for this RectD.

GetLocation(bool)

Gets X or Y depending on vert parameter value.

GetSize(bool)

Gets Width or Height depending on vert parameter value.

Inflate()

Inflates this RectD by 1. X and Y are decremented by 1, Width and Height are incremented by 2.

Inflate(RectD, double, double)

Creates a RectD that is inflated by the specified amount.

Inflate(SizeD)

Inflates this RectD by the specified amount.

Inflate(double, double)

Inflates this RectD by the specified amount.

InflatedBy(double, double)

Creates a RectD that is inflated by the specified amount.

InflatedWithPadding(Thickness)

Returns this rectangle inflated by the specified padding.

Intersect(RectD)

Creates a Rectangle that represents the intersection between this Rectangle and rect.

Intersect(RectD, RectD)

Creates a rectangle that represents the intersection between a and b. If there is no intersection, an empty rectangle is returned.

IntersectsWith(RectD)

Determines if this rectangle intersects with rect.

NotEmptyAndContains(PointD)

Gets whether rectangle is not empty and contains the specified point.

NotEmptyAndContains(double, double)

Gets whether rectangle is not empty and contains the specified point.

Offset(PointD)

Adjusts the location of this rectangle by the specified amount.

Offset(double, double)

Adjusts the location of this rectangle by the specified amount.

OffsetBy(double, double)

Creates a RectD that is offset by the specified amount.

Parse(string)

Returns an instance converted from the provided string using the culture "en-US"

string with Rect data.
PercentOfHeight(double)

Gets percentage of Height.

PercentOfMinSize(double)

Gets percentage of minimal size. Chooses minimum of Width and Height) and calculates percent of this value.

PercentOfWidth(double)

Gets percentage of Width.

PixelFromDip(double?)

Gets pixel rectangle from this object using specified scaling factor.

Scale(double)

Scales rectangle (multiplies all fields) using the specified scale factor.

ScaleLocation(double)

Scales X and Y (multiplies them) using the specified scale factor.

SetLocation(bool, double)

Sets X or Y depending on vert parameter value.

SetSize(bool, double)

Sets Width or Height depending on vert parameter value.

ToRect()

Converts a RectD structure to a RectI structure.

ToString()

Converts the Location and Size of this RectD to a human-readable string.

ToVector4()

Creates a new Vector4 from this RectD.

Union(RectD, RectD)

Creates a rectangle that represents the union between a and b.

WithHeight(double)

Returns new rectangle with location and width of this rectangle and the specified height.

WithLocation(double, double)

Creates a RectD with the specified location.

WithMargin(Thickness)

Gets this rectangle with applied margin. Uses ApplyMargin(Thickness), see it for details.

WithSize(double, double)

Creates a RectD with the specified size.

WithWidth(double)

Returns new rectangle with location and height of this rectangle and the specified width.

WithX(double)

Returns new rectangle with size and y-coordinate of this rectangle and the specified x-coordinate.

WithY(double)

Returns new rectangle with size and x-coordinate of this rectangle and the specified y-coordinate.

Operators

operator ==(RectD, RectD)

Tests whether two RectD objects have equal location and size.

explicit operator Vector4(RectD)

Converts the specified RectD to a Vector4.

explicit operator RectD(Vector4)

Converts the specified Vector2 to a RectD.

implicit operator SKRect(RectD)

Implicit operator convertion from RectD to SKRect.

implicit operator Rectangle(RectD)

Creates a Rectangle with the properties of the specified RectD

implicit operator RectangleF(RectD)

Creates a RectangleF with the properties of the specified RectD

implicit operator RectD(RectI)

Converts the specified RectI to a RectD.

implicit operator RectD(SKRect)

Implicit operator convertion from SKRect to RectD.

implicit operator RectD(Rectangle)

Creates a RectD with the properties of the specified Rectangle

implicit operator RectD((PointD, SizeD))

Implicit operator convertion from tuple (PointD, Size) to RectD.

implicit operator RectD((double, double, double, double))

Implicit operator convertion from tuple with four values to RectD.

operator !=(RectD, RectD)

Tests whether two RectD objects differ in location or size.