Struct RectD
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.
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).
- HasEmptyHeight
Gets whether height is less or equal 0.
- HasEmptyWidth
Gets whether width is less or equal 0.
- IsAnyNegative
Gets a value indicating whether any property is negative.
- IsLocationNegative
Gets a value indicating whether location is negative.
- IsLocationNegativeOrSizeEmpty
Gets a value indicating whether location is negative or size is negative or zero.
- 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.
- Right
Gets the x-coordinate of the lower-right corner of the rectangular region defined by 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).
- 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.
- 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.
- GetHashCode()
Gets the hash code for this RectD.
- 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.
- ToString()
Converts the Location and Size of this RectD to a human-readable string.
- 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.
- 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(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.