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(PointI, SizeI)

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

RectD(RectI)

Initializes a new instance of the RectD structure using the specified RectI instance.

RectD(Vector4)

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

RectD(float, float, float, float)

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

Fields

DefaultMidpointRounding

Gets or sets default MidpointRounding used in round coordinate operations.

Empty

Initializes a new instance of the RectD class.

InflateDelta

Represents a predefined vector used to adjust the dimensions of a rectangle or bounding box.

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

AsVector

Gets or sets the rectangle as Vector4: (X, Y, Width, Height).

Bottom

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

BottomHalf

Gets the bottom half of the current rectangle.

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.

CenterHorz

Gets or sets the horizontal center coordinate of the rectangle.

CenterVert

Gets or sets the vertical center coordinate of the rectangle.

CircleDiameter

Gets the diameter of the largest circle that can fit within the current dimensions.

CircleRadius

Gets the radius of the circle, calculated as half the smaller dimension of the bounding area.

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.

LeftHalf

Gets the left half of the current rectangle.

LeftLineCenter

Gets center point on the left border of the rectangle.

Location

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

LocationAsVector

Gets or sets the location (X,Y) as a Vector2 sharing memory with scalar fields.

MaxWidthHeight

Gets maximum of Width and Height.

MinWidthHeight

Gets minimum of Width and Height.

NotEmpty

Gets a value indicating whether the rectangle is not empty.

Right

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

RightHalf

Gets the right half of the current rectangle.

Size

Gets or sets the size of this RectD.

SizeAsVector

Gets or sets the size (Width, Height) as a Vector2 sharing memory with scalar fields.

SizeIsEmpty

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

SizeIsInfinity

Gets a value indicating whether the size has a width or height that is positive or negative infinity.

SizeIsNegativeInfinity

Gets a value indicating whether the size has a width or height that is negative infinity.

SizeIsPositiveInfinity

Gets a value indicating whether the size has a width or height that is positive infinity.

SkiaLocation

Gets the SkiaSharp location (SKPoint) of this rectangle.

SkiaSize

Gets the SkiaSharp size (SKSize) of this rectangle.

Top

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

TopHalf

Gets the top half of the current rectangle.

TopLeft

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

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(float) 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<float, float>)

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(float, float)

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.

CoordToInt(float)

Converts float coordinate to the integer value.

Create(float, float)

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.

Deflated()

Creates a RectD that is deflated by 1.

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 center point and size.

FromLTRB(PointD, PointD)

Creates a new RectD specified by two points.

FromLTRB(float, float, float, float)

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, float)

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, float, float)

Creates a RectD that is inflated by the specified amount.

Inflate(SizeD)

Inflates this RectD by the specified amount.

Inflate(float, float)

Inflates this RectD by the specified amount.

InflateHorz(float)

Inflates this RectD horizontally by the specified amount.

InflateVert(float, float)

Inflates this RectD vertically by the specified amount.

Inflated()

Creates a RectD that is inflated by 1.

Inflated(SizeD)

Returns a new rectangle that is inflated by the specified size.

InflatedBy(float, float)

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(float, float)

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

Offset(PointD)

Adjusts the location of this rectangle by the specified amount.

Offset(float, float)

Adjusts the location of this rectangle by the specified amount.

OffsetBy(float, float)

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

Gets percentage of Height.

PercentOfMinSize(float)

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

PercentOfWidth(float)

Gets percentage of Width.

PixelFromDip(float?)

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

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

ScaleLocation(float)

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

SetCenter(bool, float)

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

SetFarLocation(bool, float)

Sets Right or Bottom depending on vert parameter value.

SetLocation(bool, float)

Sets X or Y depending on vert parameter value.

SetSize(bool, float)

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

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

WithLocation(PointD)

Creates a RectD with the specified location.

WithLocation(float, float)

Creates a RectD with the specified location.

WithMargin(Thickness)

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

WithOffset(SizeD)

Offsets the location of given rectangle by the specified offset.

WithOffset(float, float)

Offsets the location of given rectangle by the specified offset.

WithSize(SizeD)

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

WithSize(float, float)

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

WithWidth(float)

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

WithX(float)

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

WithY(float)

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 conversion 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 conversion from SKRect to RectD.

implicit operator RectD(Rectangle)

Creates a RectD with the properties of the specified Rectangle

implicit operator RectD((PointD Location, SizeD Size))

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

implicit operator RectD((float X, float Y, float Width, float Height))

Implicit operator conversion from tuple with four values to RectD.

operator !=(RectD, RectD)

Tests whether two RectD objects differ in location or size.