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

DefaultMidpointRounding

Gets or sets default MidpointRounding used in round coordinate operations.

Empty

Initializes a new instance of the RectD class.

MinusOne

Initializes a new instance of the RectD 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).

BottomLineCenter

Gets center point on the bottom border of the rectangle.

BottomRight

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

Center

Gets or sets the center point of this RectD.

HasEmptyHeight

Gets whether height is less or equal 0.

HasEmptyWidth

Gets whether width is less or equal 0.

Height

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

IsAnyNegative

Gets a value indicating whether any property is negative.

IsEmpty

Tests whether this RectD has all properties equal to 0.

IsLocationNegative

Gets a value indicating whether location is negative.

IsLocationNegativeOrSizeEmpty

Gets a value indicating whether location is negative or size is negative or zero.

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).

TopLineCenter

Gets center point on the top border of the rectangle.

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.

Ceiling(RectD)

Converts the specified RectD structure to a RectI structure by rounding the RectD values to the next higher integer values.

CenterIn(RectD, bool, bool)

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

Coerce()

Calls CoerceCoordFunc for the location and size.

Coerce(Func<double, double>)

Calls coerceFunc for the location and size.

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.

GetCenter(bool)

Gets horizontal or vertical coordinate of the center point depending on isVert parameter value.

GetCircleBoundingBox(PointD, double)

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

GetFarLocation(bool)

Gets Right or Bottom depending on vert parameter value.

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.

InflateHorz(double)

Inflates this RectD horizontally by the specified amount.

InflateVert(double, double)

Inflates this RectD vertically by the specified amount.

Inflated()

Creates a RectD that is inflated by 1.

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)

Changes this rectangle to the rectangle that represents the intersection between this rectangle and the rectangle specified in the rect parameter.

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.

LeftBottom()

Returns location of the bottom-left corner of this rectangle.

LeftTop()

Returns location of the upper-left corner of this rectangle.

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 rectangle 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.

RightBottom()

Returns location of the bottom-right corner of this rectangle.

RightTop()

Returns location of the upper-right corner of this rectangle.

Round(RectD, MidpointRounding?)

Converts the specified RectD to a RectI by rounding the RectD values to the nearest integer values.

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.

SetCenter(bool, double)

Sets horizontal or vertical coordinate of the center point depending on isVert parameter value.

SetFarLocation(bool, double)

Sets Right or Bottom depending on vert parameter value.

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.

Truncate(RectD)

Converts the specified RectD to a RectI by truncating the RectD values.

Union(RectD, RectD)

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

WithEmptySize()

Creates a RectD with an empty size and the location of this rectangle.

WithHeight(double)

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

WithLocation(PointD)

Creates a RectD with the specified location.

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(SizeD)

Creates a RectD with the specified size and the location of this rectangle.

WithSize(double, double)

Creates a RectD with the specified size and the location of this rectangle.

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.