[]
Defines a RectF. This structure is slightly different from System.Drawing.RectangleF as
it is internally storing Left, Top, Right, Bottom instead of Left, Top, Width, Height.
public struct RectF : IEquatable<RectF>
Initializes a new instance of the RectF struct.
public RectF(RectD rc)
rc
RectDInitializes a new instance of the RectF struct.
public RectF(RectL rc)
rc
RectLInitializes a new instance of the RectF struct.
public RectF(RectangleF rc)
rc
System.Drawing.RectangleFInitializes a new instance of the RectF struct.
public RectF(float x, float y, float width, float height)
x
floaty
floatwidth
floatheight
floatInitializes a new instance of the RectF struct.
public RectF(float width, float height)
width
floatheight
floatThe y-coordinate of the bottom edge.
public float Bottom
An empty rectangle.
public static readonly RectF Empty
A rectangle that has its upper-left corner set to (negative infinity, negative infinity) and its lower-right corner set to (infinity, infinity).
public static readonly RectF Infinite
The x-coordinate of the left edge.
public float Left
The x-coordinate of the right edge.
public float Right
The size of the RectF type, in bytes.
public const int SizeInBytes = 16
The y-coordinate of the top edge.
public float Top
Get the bottom left point of the rectangle.
public Point2F BottomLeft { get; }
Get the bottom right point of the rectangle.
public Point2F BottomRight { get; }
Gets the point with coordinates of the rectangle center.
public Point2F Center { get; }
Determines if there is some space within the rectangle.
public bool HasSpace { get; }
Gets or sets the height of the rectangle.
public float Height { get; set; }
Determines if all components of RectF are equal to zero.
public bool IsEmpty { get; }
Gets the point with coordinates of the left top corner of the rectangle.
public Point2F Location { get; }
Gets the size of the rectangle.
public Size2F Size { get; }
Get the top left point of the rectangle.
public Point2F TopLeft { get; }
Get the top right point of the rectangle.
public Point2F TopRight { get; }
Gets or sets the width of the rectangle.
public float Width { get; set; }
Gets or sets the X coordinate of the rectangle.
public float X { get; set; }
Gets or sets the Y coordinate of the rectangle.
public float Y { get; set; }
Returns a RectL with circumscribed coordinates.
public RectL Circumscribe()
Determines if the specified rectangle is fully contained within this rectangle.
public bool Contains(RectF rect)
rect
RectFDetermines if the specified point is contained within this rectangle.
public bool Contains(float x, float y)
x
floaty
floatIndicates whether this instance and a specified object are equal.
public bool Equals(RectF other)
other
RectFIndicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
obj
objectConverts a rectangle from DIPs to pixels.
public static RectF FromDips(RectF rc, float dpiX, float dpiY)
rc
RectFdpiX
floatdpiY
floatConverts a rectangle from DIPs to pixels.
public void FromDips(float dpiX, float dpiY)
dpiX
floatdpiY
floatCreates a RectF struct from (left, top, right, bottom) coordinates.
public static RectF FromLTRB(float left, float top, float right, float bottom)
left
floattop
floatright
floatbottom
floatReturns a hash code for this instance.
public override int GetHashCode()
Inflates the rectangle by the specified amount.
public static RectF Inflate(RectF rc, float dx, float dy)
rc
RectFdx
floatdy
floatInflates the rectangle by the specified amount.
public void Inflate(float dx, float dy)
dx
floatdy
floatReturns a rectangle that represents the intersection of two rectangles.
public static RectF Intersect(RectF a, RectF b)
Quickly updates a rectangle to represent the intersection with another rectangle.
public void IntersectFast(RectF rect)
rect
RectFThe resulting rectangle may be invalid. Use the HasSpace property to check.
Determines if this rectangle intersects with rect.
public bool IntersectsWith(RectF rect)
rect
RectFConverts the rectangle from (X, Y, Width, Height) to (Left, Top, Right, Bottom) coordinates.
public void MakeLTRB()
Converts the rectangle from (Left, Top, Right, Bottom) to (X, Y, Width, Height) coordinates.
public void MakeXYWH()
Offsets the rectangle by the specified amount.
public static RectF Offset(RectF rc, Size2F sz)
Offsets the rectangle by the specified amount.
public static RectF Offset(RectF rc, float dx, float dy)
rc
RectFdx
floatdy
floatOffsets the rectangle by the specified amount.
public void Offset(float dx, float dy)
dx
floatdy
floatRecalculates the point coordinates from relative units (0..1, 0..1) to absolute (Left..Right, Top..Bottom).
public Point2F PointFromRect(Point2F pt)
pt
Point2FThe source point in relative coordinates (0..1, 0..1).
The resulting point in absolute coordinates (Left..Right, Top..Bottom).
Returns a RectL with rounded coordinates.
public RectL Round()
Scales all coordinates of a rectangle by the specified scaleX and scaleY.
public static RectF Scale(RectF rc, float scaleX, float scaleY)
rc
RectFscaleX
floatscaleY
floatScales all coordinates of a rectangle by the specified scaleFactor.
public static RectF Scale(RectF rc, float scaleFactor)
rc
RectFscaleFactor
floatScales all coordinates of a rectangle by the specified scaleX and scaleY.
public void Scale(float scaleX, float scaleY)
scaleX
floatscaleY
floatScales all coordinates of a rectangle by the specified scaleFactor.
public void Scale(float scaleFactor)
scaleFactor
floatConverts a rectangle from pixels to DIPs.
public static RectF ToDips(RectF rc, float dpiX, float dpiY)
rc
RectFdpiX
floatdpiY
floatConverts a rectangle from pixels to DIPs.
public void ToDips(float dpiX, float dpiY)
dpiX
floatdpiY
floatConverts RectF to System.Drawing.RectangleF.
public RectangleF ToRectangleF()
public RectD ToRectD()
Returns a string that represents the current object.
public override string ToString()
Transforms a rectangle by the 3x2 matrix.
public void Transform(in Matrix3x2 matrix)
matrix
Matrix3x2The matrix to use as a tranformation matrix.
Transforms a rectangle by the 3x2 matrix.
public static RectF Transform(RectF rect, in Matrix3x2 matrix)
rect
RectFThe original rectangle to apply the transformation.
matrix
Matrix3x2The matrix to use as a tranformation matrix.
The result of the transformation for the rectangle point.
Returns a RectL with truncated coordinates.
public RectL Truncate()
Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.
public static RectF Union(RectF a, RectF b)
Determines if the specified values are equal.
public static bool operator ==(RectF left, RectF right)
public static explicit operator Vector4(RectF value)
value
RectFPerforms an explicit conversion from RectF to System.Drawing.RectangleF.
public static explicit operator RectangleF(RectF value)
value
RectFpublic static explicit operator RectF(Vector4 v)
v
Vector4Performs an explicit conversion from System.Drawing.RectangleF to RectF.
public static explicit operator RectF(RectangleF rc)
rc
System.Drawing.RectangleFDetermines if the specified values are not equal.
public static bool operator !=(RectF left, RectF right)