[]
        
(Showing Draft Content)

GrapeCity.Documents.DX.RectF

Struct RectF

Namespace
GrapeCity.Documents.DX
Assembly
GcDocs.DX.Windows.dll

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>
Implements
System.IEquatable<T><RectF>
Inherited Members
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()

Constructors

RectF(RectD)

Initializes a new instance of the RectF struct.

public RectF(RectD rc)

Parameters

rc RectD

RectF(RectL)

Initializes a new instance of the RectF struct.

public RectF(RectL rc)

Parameters

rc RectL

RectF(RectangleF)

Initializes a new instance of the RectF struct.

public RectF(RectangleF rc)

Parameters

rc System.Drawing.RectangleF

RectF(float, float, float, float)

Initializes a new instance of the RectF struct.

public RectF(float x, float y, float width, float height)

Parameters

x float
y float
width float
height float

RectF(float, float)

Initializes a new instance of the RectF struct.

public RectF(float width, float height)

Parameters

width float
height float

Fields

Bottom

The y-coordinate of the bottom edge.

public float Bottom

Field Value

float

Empty

An empty rectangle.

public static readonly RectF Empty

Field Value

RectF

Infinite

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

Field Value

RectF

Left

The x-coordinate of the left edge.

public float Left

Field Value

float

Right

The x-coordinate of the right edge.

public float Right

Field Value

float

SizeInBytes

The size of the RectF type, in bytes.

public const int SizeInBytes = 16

Field Value

int

Top

The y-coordinate of the top edge.

public float Top

Field Value

float

Properties

BottomLeft

Get the bottom left point of the rectangle.

public Point2F BottomLeft { get; }

Property Value

Point2F

BottomRight

Get the bottom right point of the rectangle.

public Point2F BottomRight { get; }

Property Value

Point2F

Center

Gets the point with coordinates of the rectangle center.

public Point2F Center { get; }

Property Value

Point2F

HasSpace

Determines if there is some space within the rectangle.

public bool HasSpace { get; }

Property Value

bool

Height

Gets or sets the height of the rectangle.

public float Height { get; set; }

Property Value

float

IsEmpty

Determines if all components of RectF are equal to zero.

public bool IsEmpty { get; }

Property Value

bool

Location

Gets the point with coordinates of the left top corner of the rectangle.

public Point2F Location { get; }

Property Value

Point2F

Size

Gets the size of the rectangle.

public Size2F Size { get; }

Property Value

Size2F

TopLeft

Get the top left point of the rectangle.

public Point2F TopLeft { get; }

Property Value

Point2F

TopRight

Get the top right point of the rectangle.

public Point2F TopRight { get; }

Property Value

Point2F

Width

Gets or sets the width of the rectangle.

public float Width { get; set; }

Property Value

float

X

Gets or sets the X coordinate of the rectangle.

public float X { get; set; }

Property Value

float

Y

Gets or sets the Y coordinate of the rectangle.

public float Y { get; set; }

Property Value

float

Methods

Circumscribe()

Returns a RectL with circumscribed coordinates.

public RectL Circumscribe()

Returns

RectL

Contains(RectF)

Determines if the specified rectangle is fully contained within this rectangle.

public bool Contains(RectF rect)

Parameters

rect RectF

Returns

bool

Contains(float, float)

Determines if the specified point is contained within this rectangle.

public bool Contains(float x, float y)

Parameters

x float
y float

Returns

bool

Equals(RectF)

Indicates whether this instance and a specified object are equal.

public bool Equals(RectF other)

Parameters

other RectF

Returns

bool

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

FromDips(RectF, float, float)

Converts a rectangle from DIPs to pixels.

public static RectF FromDips(RectF rc, float dpiX, float dpiY)

Parameters

rc RectF
dpiX float
dpiY float

Returns

RectF

FromDips(float, float)

Converts a rectangle from DIPs to pixels.

public void FromDips(float dpiX, float dpiY)

Parameters

dpiX float
dpiY float

FromLTRB(float, float, float, float)

Creates a RectF struct from (left, top, right, bottom) coordinates.

public static RectF FromLTRB(float left, float top, float right, float bottom)

Parameters

left float
top float
right float
bottom float

Returns

RectF

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

Inflate(RectF, float, float)

Inflates the rectangle by the specified amount.

public static RectF Inflate(RectF rc, float dx, float dy)

Parameters

rc RectF
dx float
dy float

Returns

RectF

Inflate(float, float)

Inflates the rectangle by the specified amount.

public void Inflate(float dx, float dy)

Parameters

dx float
dy float

Intersect(RectF, RectF)

Returns a rectangle that represents the intersection of two rectangles.

public static RectF Intersect(RectF a, RectF b)

Parameters

a RectF
b RectF

Returns

RectF

IntersectFast(RectF)

Quickly updates a rectangle to represent the intersection with another rectangle.

public void IntersectFast(RectF rect)

Parameters

rect RectF

Remarks

The resulting rectangle may be invalid. Use the HasSpace property to check.

IntersectsWith(RectF)

Determines if this rectangle intersects with rect.

public bool IntersectsWith(RectF rect)

Parameters

rect RectF

Returns

bool

MakeLTRB()

Converts the rectangle from (X, Y, Width, Height) to (Left, Top, Right, Bottom) coordinates.

public void MakeLTRB()

MakeXYWH()

Converts the rectangle from (Left, Top, Right, Bottom) to (X, Y, Width, Height) coordinates.

public void MakeXYWH()

Offset(RectF, Size2F)

Offsets the rectangle by the specified amount.

public static RectF Offset(RectF rc, Size2F sz)

Parameters

rc RectF
sz Size2F

Returns

RectF

Offset(RectF, float, float)

Offsets the rectangle by the specified amount.

public static RectF Offset(RectF rc, float dx, float dy)

Parameters

rc RectF
dx float
dy float

Returns

RectF

Offset(float, float)

Offsets the rectangle by the specified amount.

public void Offset(float dx, float dy)

Parameters

dx float
dy float

PointFromRect(Point2F)

Recalculates the point coordinates from relative units (0..1, 0..1) to absolute (Left..Right, Top..Bottom).

public Point2F PointFromRect(Point2F pt)

Parameters

pt Point2F

The source point in relative coordinates (0..1, 0..1).

Returns

Point2F

The resulting point in absolute coordinates (Left..Right, Top..Bottom).

Round()

Returns a RectL with rounded coordinates.

public RectL Round()

Returns

RectL

Scale(RectF, float, float)

Scales all coordinates of a rectangle by the specified scaleX and scaleY.

public static RectF Scale(RectF rc, float scaleX, float scaleY)

Parameters

rc RectF
scaleX float
scaleY float

Returns

RectF

Scale(RectF, float)

Scales all coordinates of a rectangle by the specified scaleFactor.

public static RectF Scale(RectF rc, float scaleFactor)

Parameters

rc RectF
scaleFactor float

Returns

RectF

Scale(float, float)

Scales all coordinates of a rectangle by the specified scaleX and scaleY.

public void Scale(float scaleX, float scaleY)

Parameters

scaleX float
scaleY float

Scale(float)

Scales all coordinates of a rectangle by the specified scaleFactor.

public void Scale(float scaleFactor)

Parameters

scaleFactor float

ToDips(RectF, float, float)

Converts a rectangle from pixels to DIPs.

public static RectF ToDips(RectF rc, float dpiX, float dpiY)

Parameters

rc RectF
dpiX float
dpiY float

Returns

RectF

ToDips(float, float)

Converts a rectangle from pixels to DIPs.

public void ToDips(float dpiX, float dpiY)

Parameters

dpiX float
dpiY float

ToRectangleF()

Converts RectF to System.Drawing.RectangleF.

public RectangleF ToRectangleF()

Returns

System.Drawing.RectangleF

ToRectD()

Converts RectF to RectD.

public RectD ToRectD()

Returns

RectD

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

Transform(in Matrix3x2)

Transforms a rectangle by the 3x2 matrix.

public void Transform(in Matrix3x2 matrix)

Parameters

matrix Matrix3x2

The matrix to use as a tranformation matrix.

Transform(RectF, in Matrix3x2)

Transforms a rectangle by the 3x2 matrix.

public static RectF Transform(RectF rect, in Matrix3x2 matrix)

Parameters

rect RectF

The original rectangle to apply the transformation.

matrix Matrix3x2

The matrix to use as a tranformation matrix.

Returns

RectF

The result of the transformation for the rectangle point.

Truncate()

Returns a RectL with truncated coordinates.

public RectL Truncate()

Returns

RectL

Union(RectF, RectF)

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)

Parameters

a RectF
b RectF

Returns

RectF

Operators

operator ==(RectF, RectF)

Determines if the specified values are equal.

public static bool operator ==(RectF left, RectF right)

Parameters

left RectF
right RectF

Returns

bool

explicit operator Vector4(RectF)

Performs an explicit conversion from RectF to Vector4.

public static explicit operator Vector4(RectF value)

Parameters

value RectF

Returns

Vector4

explicit operator RectangleF(RectF)

Performs an explicit conversion from RectF to System.Drawing.RectangleF.

public static explicit operator RectangleF(RectF value)

Parameters

value RectF

Returns

System.Drawing.RectangleF

explicit operator RectF(Vector4)

Performs an explicit conversion from Vector4 to RectF.

public static explicit operator RectF(Vector4 v)

Parameters

v Vector4

Returns

RectF

explicit operator RectF(RectangleF)

Performs an explicit conversion from System.Drawing.RectangleF to RectF.

public static explicit operator RectF(RectangleF rc)

Parameters

rc System.Drawing.RectangleF

Returns

RectF

operator !=(RectF, RectF)

Determines if the specified values are not equal.

public static bool operator !=(RectF left, RectF right)

Parameters

left RectF
right RectF

Returns

bool