UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FSlateRect Class Reference

#include <SlateRect.h>

Public Member Functions

 FSlateRect (float InLeft=-1, float InTop=-1, float InRight=-1, float InBottom=-1)
 
 FSlateRect (const UE::Slate::FDeprecateVector2DParameter &InStartPos, const UE::Slate::FDeprecateVector2DParameter &InEndPos)
 
bool IsValid () const
 
bool IsEmpty () const
 
UE::Slate::FDeprecateVector2DResult GetSize () const
 
FVector2f GetSize2f () const
 
float GetArea () const
 
UE::Slate::FDeprecateVector2DResult GetCenter () const
 
FVector2f GetCenter2f () const
 
UE::Slate::FDeprecateVector2DResult GetTopLeft () const
 
FVector2f GetTopLeft2f () const
 
UE::Slate::FDeprecateVector2DResult GetTopRight () const
 
FVector2f GetTopRight2f () const
 
UE::Slate::FDeprecateVector2DResult GetBottomRight () const
 
FVector2f GetBottomRight2f () const
 
UE::Slate::FDeprecateVector2DResult GetBottomLeft () const
 
FVector2f GetBottomLeft2f () const
 
FSlateRect InsetBy (const struct FMargin &InsetAmount) const
 
FSlateRect ExtendBy (const FMargin &ExtendAmount) const
 
FSlateRect OffsetBy (const UE::Slate::FDeprecateVector2DParameter &OffsetAmount) const
 
FSlateRect ScaleBy (float ScaleBy) const
 
FSlateRect Expand (const FSlateRect &Other) const
 
FSlateRect Round () const
 
FSlateRect IntersectionWith (const FSlateRect &Other) const
 
FSlateRect IntersectionWith (const FSlateRect &Other, bool &OutOverlapping) const
 
bool ContainsPoint (const UE::Slate::FDeprecateVector2DParameter &Point) const
 
bool operator== (const FSlateRect &Other) const
 
bool operator!= (const FSlateRect &Other) const
 
SLATECORE_API FString ToString () const
 
SLATECORE_API bool InitFromString (const FString &InSourceString)
 

Static Public Member Functions

static FSlateRect FromPointAndExtent (const UE::Slate::FDeprecateVector2DParameter &TopLeft, const UE::Slate::FDeprecateVector2DParameter &Size)
 
static bool DoRectanglesIntersect (const FSlateRect &A, const FSlateRect &B)
 
static bool IsRectangleContained (const FSlateRect &A, const FSlateRect &B)
 

Public Attributes

float Left
 
float Top
 
float Right
 
float Bottom
 

Friends

FSlateRect operator+ (const FSlateRect &A, const FSlateRect &B)
 
FSlateRect operator- (const FSlateRect &A, const FSlateRect &B)
 
FSlateRect operator* (float Scalar, const FSlateRect &Rect)
 
uint32 GetTypeHash (const FSlateRect &Key)
 

Detailed Description

A rectangle defined by upper-left and lower-right corners.

Assumes a "screen-like" coordinate system where the origin is in the top-left, with the Y-axis going down. Functions like "contains" etc will not work with other conventions.

 +---------> X
 |
 |    (Left,Top)  
 |            o----o 
 |            |    |
 |            o----o 
 |                (Right, Bottom)
 \/
 Y

Constructor & Destructor Documentation

◆ FSlateRect() [1/2]

FSlateRect::FSlateRect ( float  InLeft = -1,
float  InTop = -1,
float  InRight = -1,
float  InBottom = -1 
)
inlineexplicit

◆ FSlateRect() [2/2]

FSlateRect::FSlateRect ( const UE::Slate::FDeprecateVector2DParameter InStartPos,
const UE::Slate::FDeprecateVector2DParameter InEndPos 
)
inline

Member Function Documentation

◆ ContainsPoint()

bool FSlateRect::ContainsPoint ( const UE::Slate::FDeprecateVector2DParameter Point) const
inline

Returns whether or not a point is inside the rectangle

Parameters
PointThe point to check
Returns
True if the point is inside the rectangle

◆ DoRectanglesIntersect()

static bool FSlateRect::DoRectanglesIntersect ( const FSlateRect A,
const FSlateRect B 
)
inlinestatic

Do rectangles A and B intersect?

◆ Expand()

FSlateRect FSlateRect::Expand ( const FSlateRect Other) const
inline

Returns the rect that encompasses both rectangles

Parameters
OtherThe other rectangle
Returns
Rectangle that is big enough to fit both rectangles

◆ ExtendBy()

FSlateRect FSlateRect::ExtendBy ( const FMargin ExtendAmount) const
inline

Return a rectangle that is extended on each side by the amount specified in each margin.

Parameters
ExtendAmountThe amount to extend the geometry.
Returns
An extended rectangle.

◆ FromPointAndExtent()

static FSlateRect FSlateRect::FromPointAndExtent ( const UE::Slate::FDeprecateVector2DParameter TopLeft,
const UE::Slate::FDeprecateVector2DParameter Size 
)
inlinestatic

Creates a rect from a top left point and extent. Provided as a factory function to not conflict with the TopLeft + BottomRight ctor.

◆ GetArea()

float FSlateRect::GetArea ( ) const
inline
Returns
the area of the rectangle

◆ GetBottomLeft()

UE::Slate::FDeprecateVector2DResult FSlateRect::GetBottomLeft ( ) const
inline

Returns the bottom-left position of the rectangle

Returns
The bottom-left position.

◆ GetBottomLeft2f()

FVector2f FSlateRect::GetBottomLeft2f ( ) const
inline

◆ GetBottomRight()

UE::Slate::FDeprecateVector2DResult FSlateRect::GetBottomRight ( ) const
inline

Returns the bottom-right position of the rectangle

Returns
The bottom-right position.

◆ GetBottomRight2f()

FVector2f FSlateRect::GetBottomRight2f ( ) const
inline

◆ GetCenter()

UE::Slate::FDeprecateVector2DResult FSlateRect::GetCenter ( ) const
inline

Returns the center of the rectangle

Returns
The center point.

◆ GetCenter2f()

FVector2f FSlateRect::GetCenter2f ( ) const
inline

◆ GetSize()

UE::Slate::FDeprecateVector2DResult FSlateRect::GetSize ( ) const
inline

Returns the size of the rectangle in each dimension.

Returns
The size as a vector.

◆ GetSize2f()

FVector2f FSlateRect::GetSize2f ( ) const
inline

◆ GetTopLeft()

UE::Slate::FDeprecateVector2DResult FSlateRect::GetTopLeft ( ) const
inline

Returns the top-left position of the rectangle

Returns
The top-left position.

◆ GetTopLeft2f()

FVector2f FSlateRect::GetTopLeft2f ( ) const
inline

◆ GetTopRight()

UE::Slate::FDeprecateVector2DResult FSlateRect::GetTopRight ( ) const
inline

Returns the top-right position of the rectangle

Returns
The top-right position.

◆ GetTopRight2f()

FVector2f FSlateRect::GetTopRight2f ( ) const
inline

◆ InitFromString()

bool FSlateRect::InitFromString ( const FString &  InSourceString)

Returns a string of containing the coordinates of the rect

Parameters
InSourceStringA string containing the values to initialize this rect in format Left=Value Top=Value...
Returns
True if initialized successfully

◆ InsetBy()

FSlateRect FSlateRect::InsetBy ( const struct FMargin InsetAmount) const
inline

Return a rectangle that is contracted on each side by the amount specified in each margin.

Parameters
InsetAmountThe amount to contract the geometry.
Returns
An inset rectangle.

◆ IntersectionWith() [1/2]

FSlateRect FSlateRect::IntersectionWith ( const FSlateRect Other) const
inline

Returns the rectangle that is the intersection of this rectangle and Other.

Parameters
OtherThe other rectangle
Returns
Rectangle over intersection.

◆ IntersectionWith() [2/2]

FSlateRect FSlateRect::IntersectionWith ( const FSlateRect Other,
bool OutOverlapping 
) const
inline

Returns the rectangle that is the intersection of this rectangle and Other, as well as if they were overlapping at all.

Parameters
OtherThe other rectangle
OutOverlapping[Out] Was there any overlap with the other rectangle.
Returns
Rectangle over intersection.

◆ IsEmpty()

bool FSlateRect::IsEmpty ( ) const
inline
Returns
true, if the rectangle has an effective size of 0.

◆ IsRectangleContained()

static bool FSlateRect::IsRectangleContained ( const FSlateRect A,
const FSlateRect B 
)
inlinestatic

Is rectangle B contained within rectangle A?

◆ IsValid()

bool FSlateRect::IsValid ( ) const
inline

Determines if the rectangle has positive dimensions.

◆ OffsetBy()

FSlateRect FSlateRect::OffsetBy ( const UE::Slate::FDeprecateVector2DParameter OffsetAmount) const
inline

Return a rectangle that is offset by the amount specified .

Parameters
OffsetAmountThe amount to contract the geometry.
Returns
An offset rectangle.

◆ operator!=()

bool FSlateRect::operator!= ( const FSlateRect Other) const
inline

◆ operator==()

bool FSlateRect::operator== ( const FSlateRect Other) const
inline

◆ Round()

FSlateRect FSlateRect::Round ( ) const
inline

Rounds the Left, Top, Right and Bottom fields and returns a new FSlateRect with rounded components.

◆ ScaleBy()

FSlateRect FSlateRect::ScaleBy ( float  ScaleBy) const
inline

Return a rectangle that is scaled by the amount specified.

Parameters
ScaleByThe amount to scale the geometry.
Returns
An scaled rectangle.

◆ ToString()

FString FSlateRect::ToString ( ) const

Returns a string of containing the coordinates of the rect

Returns
A string of the rect coordinates

Friends And Related Symbol Documentation

◆ GetTypeHash

uint32 GetTypeHash ( const FSlateRect Key)
friend

◆ operator*

FSlateRect operator* ( float  Scalar,
const FSlateRect Rect 
)
friend

◆ operator+

FSlateRect operator+ ( const FSlateRect A,
const FSlateRect B 
)
friend

◆ operator-

FSlateRect operator- ( const FSlateRect A,
const FSlateRect B 
)
friend

Member Data Documentation

◆ Bottom

float FSlateRect::Bottom

◆ Left

float FSlateRect::Left

◆ Right

float FSlateRect::Right

◆ Top

float FSlateRect::Top

The documentation for this class was generated from the following files: