UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FGeometry Struct Reference

#include <Geometry.h>

Public Member Functions

SLATECORE_API FGeometry ()
 
 FGeometry (const FGeometry &RHS)=default
 
SLATECORE_API FGeometryoperator= (const FGeometry &RHS)
 
 FGeometry (const UE::Slate::FDeprecateVector2DParameter &OffsetFromParent, const UE::Slate::FDeprecateVector2DParameter &ParentAbsolutePosition, const UE::Slate::FDeprecateVector2DParameter &InLocalSize, float InScale)
 
bool operator== (const FGeometry &Other) const
 
bool operator!= (const FGeometry &Other) const
 
FGeometry MakeChild (const UE::Slate::FDeprecateVector2DParameter &InLocalSize, const FSlateLayoutTransform &LayoutTransform, const FSlateRenderTransform &RenderTransform, const UE::Slate::FDeprecateVector2DParameter &RenderTransformPivot) const
 
FORCEINLINE_DEBUGGABLE FGeometry MakeChild (const UE::Slate::FDeprecateVector2DParameter &InLocalSize, const FSlateLayoutTransform &LayoutTransform) const
 
FORCEINLINE_DEBUGGABLE FGeometry MakeChild (const FSlateRenderTransform &RenderTransform, const UE::Slate::FDeprecateVector2DParameter &RenderTransformPivot=FVector2f(0.5f, 0.5f)) const
 
FArrangedWidget MakeChild (const TSharedRef< SWidget > &ChildWidget, const FLayoutGeometry &LayoutGeometry) const
 
FArrangedWidget MakeChild (const TSharedRef< SWidget > &ChildWidget, const UE::Slate::FDeprecateVector2DParameter &InLocalSize, const FSlateLayoutTransform &LayoutTransform) const
 
FArrangedWidget MakeChild (const TSharedRef< SWidget > &ChildWidget, const UE::Slate::FDeprecateVector2DParameter &ChildOffset, const UE::Slate::FDeprecateVector2DParameter &InLocalSize, float ChildScale=1.0f) const
 
FORCEINLINE_DEBUGGABLE FPaintGeometry ToPaintGeometry () const
 
FORCEINLINE_DEBUGGABLE FPaintGeometry ToPaintGeometry (const UE::Slate::FDeprecateVector2DParameter &InLocalSize, const FSlateLayoutTransform &InLayoutTransform) const
 
FORCEINLINE_DEBUGGABLE FPaintGeometry ToPaintGeometry (const UE::Slate::FDeprecateVector2DParameter &InLocalSize, const FSlateLayoutTransform &InLayoutTransform, const FSlateRenderTransform &RenderTransform, const UE::Slate::FDeprecateVector2DParameter &RenderTransformPivot=FVector2f(0.5f, 0.5f)) const
 
FORCEINLINE_DEBUGGABLE FPaintGeometry ToPaintGeometry (const FSlateLayoutTransform &LayoutTransform) const
 
FPaintGeometry ToOffsetPaintGeometry (const UE::Slate::FDeprecateVector2DParameter &LocalOffset) const
 
FPaintGeometry ToInflatedPaintGeometry (const UE::Slate::FDeprecateVector2DParameter &InflateAmount) const
 
bool IsUnderLocation (const UE::Slate::FDeprecateVector2DParameter &AbsoluteCoordinate) const
 
FORCEINLINE_DEBUGGABLE UE::Slate::FDeprecateVector2DResult AbsoluteToLocal (UE::Slate::FDeprecateVector2DParameter AbsoluteCoordinate) const
 
UE::Slate::FDeprecateVector2DResult LocalToAbsolute (UE::Slate::FDeprecateVector2DParameter LocalCoordinate) const
 
UE::Slate::FDeprecateVector2DResult LocalToRoundedLocal (UE::Slate::FDeprecateVector2DParameter LocalCoordinate) const
 
FORCEINLINE_DEBUGGABLE FSlateRect GetLayoutBoundingRect () const
 
FORCEINLINE_DEBUGGABLE FSlateRect GetLayoutBoundingRect (const FMargin &LocalSpaceExtendBy) const
 
FORCEINLINE_DEBUGGABLE FSlateRect GetLayoutBoundingRect (const FSlateRect &LocalSpaceRect) const
 
FORCEINLINE_DEBUGGABLE FSlateRect GetRenderBoundingRect () const
 
FORCEINLINE_DEBUGGABLE FSlateRect GetRenderBoundingRect (const FMargin &LocalSpaceExtendBy) const
 
FORCEINLINE_DEBUGGABLE FSlateRect GetRenderBoundingRect (const FSlateRect &LocalSpaceRect) const
 
SLATECORE_API FString ToString () const
 
UE::Slate::FDeprecateVector2DResult GetDrawSize () const
 
UE::Slate::FDeprecateVector2DResult GetLocalSize () const
 
const FSlateRenderTransformGetAccumulatedRenderTransform () const
 
FSlateLayoutTransform GetAccumulatedLayoutTransform () const
 
FORCEINLINE_DEBUGGABLE void AppendTransform (const FSlateLayoutTransform &LayoutTransform)
 
UE::Slate::FDeprecateVector2DResult GetAbsolutePosition () const
 
UE::Slate::FDeprecateVector2DResult GetAbsoluteSize () const
 
UE::Slate::FDeprecateVector2DResult GetAbsolutePositionAtCoordinates (const UE::Slate::FDeprecateVector2DParameter &NormalCoordinates) const
 
UE::Slate::FDeprecateVector2DResult GetLocalPositionAtCoordinates (const UE::Slate::FDeprecateVector2DParameter &NormalCoordinates) const
 
bool HasRenderTransform () const
 

Static Public Member Functions

static FGeometry MakeRoot (const UE::Slate::FDeprecateVector2DParameter &InLocalSize, const FSlateLayoutTransform &LayoutTransform)
 
static FGeometry MakeRoot (const UE::Slate::FDeprecateVector2DParameter &InLocalSize, const FSlateLayoutTransform &LayoutTransform, const FSlateRenderTransform &RenderTransform)
 

Public Attributes

const FDeprecateSlateVector2D Size
 
const float Scale
 
const FVector2f AbsolutePosition = FVector2f::ZeroVector
 
const FVector2f Position = FVector2f::ZeroVector
 

Detailed Description

Represents the position, size, and absolute position of a Widget in Slate. The absolute location of a geometry is usually screen space or window space depending on where the geometry originated. Geometries are usually paired with a SWidget pointer in order to provide information about a specific widget (see FArrangedWidget). A Geometry's parent is generally thought to be the Geometry of the the corresponding parent widget.

Examples
/work/Engine/Source/Runtime/UMG/Public/Components/Widget.h.

Constructor & Destructor Documentation

◆ FGeometry() [1/3]

FGeometry::FGeometry ( )

Default constructor. Creates a geometry with identity transforms.

◆ FGeometry() [2/3]

FGeometry::FGeometry ( const FGeometry RHS)
default

Copy constructor.

◆ FGeometry() [3/3]

FGeometry::FGeometry ( const UE::Slate::FDeprecateVector2DParameter OffsetFromParent,
const UE::Slate::FDeprecateVector2DParameter ParentAbsolutePosition,
const UE::Slate::FDeprecateVector2DParameter InLocalSize,
float  InScale 
)
inline

!!! DEPRECATED FUNCTION !!! Use MakeChild taking a layout transform instead! Construct a new geometry given the following parameters:

Parameters
OffsetFromParentLocal position of this geometry within its parent geometry.
ParentAbsolutePositionThe absolute position of the parent geometry containing this geometry.
InSizeThe size of this geometry.
InScaleThe scale of this geometry with respect to Normal Slate Coordinates.

Member Function Documentation

◆ AbsoluteToLocal()

FORCEINLINE_DEBUGGABLE UE::Slate::FDeprecateVector2DResult FGeometry::AbsoluteToLocal ( UE::Slate::FDeprecateVector2DParameter  AbsoluteCoordinate) const
inline

Absolute coordinates could be either desktop or window space depending on what space the root of the widget hierarchy is in.

Returns
Transforms AbsoluteCoordinate into the local space of this Geometry.

◆ AppendTransform()

FORCEINLINE_DEBUGGABLE void FGeometry::AppendTransform ( const FSlateLayoutTransform LayoutTransform)
inline

Special case method to append a layout transform to a geometry. This is used in cases where the FGeometry was arranged in window space and we need to add the root desktop translation. If you find yourself wanting to use this function, ask someone if there's a better way.

Parameters
LayoutTransformAn additional layout transform to append to this geometry.

◆ GetAbsolutePosition()

UE::Slate::FDeprecateVector2DResult FGeometry::GetAbsolutePosition ( ) const
inline

Get the absolute position in render space.

◆ GetAbsolutePositionAtCoordinates()

UE::Slate::FDeprecateVector2DResult FGeometry::GetAbsolutePositionAtCoordinates ( const UE::Slate::FDeprecateVector2DParameter NormalCoordinates) const
inline

Get the absolute position on the surface of the geometry using normalized coordinates. (0,0) - upper left (1,1) - bottom right

Example: Say you wanted to know the center of the widget in absolute space, GetAbsolutePositionAtCoordinates(FVector2f(0.5f, 0.5f));

◆ GetAbsoluteSize()

UE::Slate::FDeprecateVector2DResult FGeometry::GetAbsoluteSize ( ) const
inline

Get the absolute size of the geometry in render space.

◆ GetAccumulatedLayoutTransform()

FSlateLayoutTransform FGeometry::GetAccumulatedLayoutTransform ( ) const
inline
Returns
the accumulated layout transform. Shouldn't be needed in general.

◆ GetAccumulatedRenderTransform()

const FSlateRenderTransform & FGeometry::GetAccumulatedRenderTransform ( ) const
inline
Returns
the accumulated render transform. Shouldn't be needed in general.

◆ GetDrawSize()

UE::Slate::FDeprecateVector2DResult FGeometry::GetDrawSize ( ) const
inline

!!! DEPRECATED !!! This legacy function does not account for render transforms.

Absolute coordinates could be either desktop or window space depending on what space the root of the widget hierarchy is in.

Returns
the size of the geometry in absolute space

◆ GetLayoutBoundingRect() [1/3]

FORCEINLINE_DEBUGGABLE FSlateRect FGeometry::GetLayoutBoundingRect ( ) const
inline

◆ GetLayoutBoundingRect() [2/3]

FORCEINLINE_DEBUGGABLE FSlateRect FGeometry::GetLayoutBoundingRect ( const FMargin LocalSpaceExtendBy) const
inline

◆ GetLayoutBoundingRect() [3/3]

FORCEINLINE_DEBUGGABLE FSlateRect FGeometry::GetLayoutBoundingRect ( const FSlateRect LocalSpaceRect) const
inline

◆ GetLocalPositionAtCoordinates()

UE::Slate::FDeprecateVector2DResult FGeometry::GetLocalPositionAtCoordinates ( const UE::Slate::FDeprecateVector2DParameter NormalCoordinates) const
inline

Get the local position on the surface of the geometry using normalized coordinates. (0,0) - upper left (1,1) - bottom right

Example: Say you wanted to know the center of the widget in local space, GetLocalPositionAtCoordinates(FVector2f(0.5f, 0.5f));

◆ GetLocalSize()

UE::Slate::FDeprecateVector2DResult FGeometry::GetLocalSize ( ) const
inline
Returns
the size of the geometry in local space.

◆ GetRenderBoundingRect() [1/3]

FORCEINLINE_DEBUGGABLE FSlateRect FGeometry::GetRenderBoundingRect ( ) const
inline

◆ GetRenderBoundingRect() [2/3]

FORCEINLINE_DEBUGGABLE FSlateRect FGeometry::GetRenderBoundingRect ( const FMargin LocalSpaceExtendBy) const
inline

◆ GetRenderBoundingRect() [3/3]

FORCEINLINE_DEBUGGABLE FSlateRect FGeometry::GetRenderBoundingRect ( const FSlateRect LocalSpaceRect) const
inline

◆ HasRenderTransform()

bool FGeometry::HasRenderTransform ( ) const
inline

◆ IsUnderLocation()

bool FGeometry::IsUnderLocation ( const UE::Slate::FDeprecateVector2DParameter AbsoluteCoordinate) const
inline

Absolute coordinates could be either desktop or window space depending on what space the root of the widget hierarchy is in.

Returns
true if the provided location in absolute coordinates is within the bounds of this geometry.

◆ LocalToAbsolute()

UE::Slate::FDeprecateVector2DResult FGeometry::LocalToAbsolute ( UE::Slate::FDeprecateVector2DParameter  LocalCoordinate) const
inline

Translates local coordinates into absolute coordinates

Absolute coordinates could be either desktop or window space depending on what space the root of the widget hierarchy is in.

Returns
Absolute coordinates

◆ LocalToRoundedLocal()

UE::Slate::FDeprecateVector2DResult FGeometry::LocalToRoundedLocal ( UE::Slate::FDeprecateVector2DParameter  LocalCoordinate) const
inline

Translates the local coordinates into local coordinates that after being transformed into absolute space will be rounded to a whole number or approximately a whole number. This is important for cases where you want to show a popup or a tooltip and not have the window start on a half pixel, which can cause the contents to jitter in relation to each other as the tooltip or popup moves around.

◆ MakeChild() [1/6]

FORCEINLINE_DEBUGGABLE FGeometry FGeometry::MakeChild ( const FSlateRenderTransform RenderTransform,
const UE::Slate::FDeprecateVector2DParameter RenderTransformPivot = FVector2f(0.5f, 0.5f) 
) const
inline

◆ MakeChild() [2/6]

FArrangedWidget FGeometry::MakeChild ( const TSharedRef< SWidget > &  ChildWidget,
const FLayoutGeometry LayoutGeometry 
) const
inline

Create a child geometry+widget relative to this one using the given LayoutGeometry.

Parameters
ChildWidgetThe child widget this geometry is being created for.
LayoutGeometryLayout geometry of the child.
Returns
The new child geometry.

◆ MakeChild() [3/6]

FArrangedWidget FGeometry::MakeChild ( const TSharedRef< SWidget > &  ChildWidget,
const UE::Slate::FDeprecateVector2DParameter ChildOffset,
const UE::Slate::FDeprecateVector2DParameter InLocalSize,
float  ChildScale = 1.0f 
) const
inline

!!! DEPRECATED FUNCTION !!! Use MakeChild taking a layout transform instead! Create a child geometry+widget relative to this one with a given local space size and layout transform given by a scale+offset. The Geometry inherits the child widget's render transform.

Parameters
ChildWidgetThe child widget this geometry is being created for.
ChildOffsetOffset of the child relative to the parent. Scale+Offset effectively define the layout transform.
LocalSizeThe size of the child geometry in local space.
ChildScaleScale of the child relative to the parent. Scale+Offset effectively define the layout transform.
Returns
The new child geometry+widget.

◆ MakeChild() [4/6]

FArrangedWidget FGeometry::MakeChild ( const TSharedRef< SWidget > &  ChildWidget,
const UE::Slate::FDeprecateVector2DParameter InLocalSize,
const FSlateLayoutTransform LayoutTransform 
) const
inline

Create a child geometry+widget relative to this one with a given local space size and layout transform. The Geometry inherits the child widget's render transform. For example, a widget with a 5x5 margin will create a geometry for it's child contents having a LayoutTransform of Translate(5,5) and a LocalSize 10 units smaller than it's own.

Parameters
ChildWidgetThe child widget this geometry is being created for.
LocalSizeThe size of the child geometry in local space.
LayoutTransformLayout transform of the new child relative to this Geometry.
Returns
The new child geometry+widget.

◆ MakeChild() [5/6]

FORCEINLINE_DEBUGGABLE FGeometry FGeometry::MakeChild ( const UE::Slate::FDeprecateVector2DParameter InLocalSize,
const FSlateLayoutTransform LayoutTransform 
) const
inline

Create a child geometry relative to this one with a given local space size, layout transform, and identity render transform. For example, a widget with a 5x5 margin will create a geometry for it's child contents having a LayoutTransform of Translate(5,5) and a LocalSize 10 units smaller than it's own.

Parameters
LocalSizeThe size of the child geometry in local space.
LayoutTransformLayout transform of the new child relative to this Geometry. Goes from the child's layout space to the this widget's layout space.
Returns
The new child geometry.

◆ MakeChild() [6/6]

FGeometry FGeometry::MakeChild ( const UE::Slate::FDeprecateVector2DParameter InLocalSize,
const FSlateLayoutTransform LayoutTransform,
const FSlateRenderTransform RenderTransform,
const UE::Slate::FDeprecateVector2DParameter RenderTransformPivot 
) const
inline

Create a child geometry relative to this one with a given local space size, layout transform, and render transform. For example, a widget with a 5x5 margin will create a geometry for it's child contents having a LayoutTransform of Translate(5,5) and a LocalSize 10 units smaller than it's own.

Parameters
LocalSizeThe size of the child geometry in local space.
LayoutTransformLayout transform of the new child relative to this Geometry. Goes from the child's layout space to the this widget's layout space.
RenderTransformRender-only transform of the new child that is applied before the layout transform for rendering purposes only.
RenderTransformPivotPivot in normalized local space of the Render transform.
Returns
The new child geometry.

◆ MakeRoot() [1/2]

static FGeometry FGeometry::MakeRoot ( const UE::Slate::FDeprecateVector2DParameter InLocalSize,
const FSlateLayoutTransform LayoutTransform 
)
inlinestatic

Makes a new geometry that is essentially the root of a hierarchy (has no parent transforms to inherit). For a root Widget, the LayoutTransform is often the window DPI scale + window offset.

Parameters
LocalSizeSize of the geometry in Local Space.
LayoutTransformLayout transform of the geometry.
Returns
The new root geometry

◆ MakeRoot() [2/2]

static FGeometry FGeometry::MakeRoot ( const UE::Slate::FDeprecateVector2DParameter InLocalSize,
const FSlateLayoutTransform LayoutTransform,
const FSlateRenderTransform RenderTransform 
)
inlinestatic

Makes a new geometry that is essentially the root of a hierarchy (has no parent transforms to inherit). For a root Widget, the LayoutTransform is often the window DPI scale + window offset.

Parameters
LocalSizeSize of the geometry in Local Space.
LayoutTransformLayout transform of the geometry.
Returns
The new root geometry

◆ operator!=()

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

Test geometries for strict inequality (i.e. exact float equality negated).

Parameters
OtherA geometry to compare to.
Returns
false if this is equal to other, true otherwise.

◆ operator=()

FGeometry & FGeometry::operator= ( const FGeometry RHS)

!!! HACK!!! We're keeping members of FGeometry const to prevent mutability without making them private, for backward compatibility. But this means the assignment operator no longer works. We implement one ourselves now and force a memcpy.

◆ operator==()

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

Test geometries for strict equality (i.e. exact float equality).

Parameters
OtherA geometry to compare to.
Returns
true if this is equal to other, false otherwise.

◆ ToInflatedPaintGeometry()

FPaintGeometry FGeometry::ToInflatedPaintGeometry ( const UE::Slate::FDeprecateVector2DParameter InflateAmount) const
inline

Create a paint geometry relative to this one that whose local space is "inflated" by the specified amount in each direction. The paint geometry inherits the widget's render transform.

Parameters
InflateAmountAmount by which to "inflate" the geometry in each direction around the center point. Effectively defines a layout transform offset and an inflation of the LocalSize.
Returns
The new paint geometry derived from this one.

◆ ToOffsetPaintGeometry()

FPaintGeometry FGeometry::ToOffsetPaintGeometry ( const UE::Slate::FDeprecateVector2DParameter LocalOffset) const
inline

!!! DEPRECATED FUNCTION !!! Use ToPaintGeometry taking a layout transform instead! Create a paint geometry relative to this one with the same size size and a given local space offset. The paint geometry inherits the widget's render transform.

Parameters
LocalOffsetOffset of the paint geometry relative to the parent. Effectively defines the layout transform.
Returns
The new paint geometry derived from this one.

◆ ToPaintGeometry() [1/4]

FORCEINLINE_DEBUGGABLE FPaintGeometry FGeometry::ToPaintGeometry ( ) const
inline

Create a paint geometry that represents this geometry.

Returns
The new paint geometry.

◆ ToPaintGeometry() [2/4]

FORCEINLINE_DEBUGGABLE FPaintGeometry FGeometry::ToPaintGeometry ( const FSlateLayoutTransform LayoutTransform) const
inline

Create a paint geometry with the same size as this geometry with a given layout transform. The paint geometry inherits the widget's render transform.

Parameters
LayoutTransformLayout transform of the paint geometry relative to this Geometry.
Returns
The new paint geometry derived from this one.

◆ ToPaintGeometry() [3/4]

FORCEINLINE_DEBUGGABLE FPaintGeometry FGeometry::ToPaintGeometry ( const UE::Slate::FDeprecateVector2DParameter InLocalSize,
const FSlateLayoutTransform InLayoutTransform 
) const
inline

Create a paint geometry relative to this one with a given local space size and layout transform. The paint geometry inherits the widget's render transform.

Parameters
LocalSizeThe size of the child geometry in local space.
LayoutTransformLayout transform of the paint geometry relative to this Geometry.
Returns
The new paint geometry derived from this one.

◆ ToPaintGeometry() [4/4]

FORCEINLINE_DEBUGGABLE FPaintGeometry FGeometry::ToPaintGeometry ( const UE::Slate::FDeprecateVector2DParameter InLocalSize,
const FSlateLayoutTransform InLayoutTransform,
const FSlateRenderTransform RenderTransform,
const UE::Slate::FDeprecateVector2DParameter RenderTransformPivot = FVector2f(0.5f, 0.5f) 
) const
inline

Create a paint geometry relative to this one with a given local space size and layout transform. The paint geometry inherits the widget's render transform.

Parameters
LocalSizeThe size of the child geometry in local space.
LayoutTransformLayout transform of the paint geometry relative to this Geometry.
Returns
The new paint geometry derived from this one.

◆ ToString()

FString FGeometry::ToString ( ) const
Returns
A String representation of this Geometry

Member Data Documentation

◆ AbsolutePosition

const FVector2f FGeometry::AbsolutePosition = FVector2f::ZeroVector

!!! DEPRECATED !!! These legacy public members should ideally not be referenced, as they do not account for the render transform. FGeometry manipulation should be done in local space as much as possible so logic can be done in aligned local space, but still support arbitrary render transforms.

This member has been made const to prevent mutation, which would also break render transforms, which are computed during construction. There is no way to easily detect mutation of public members, thus no way to update the render transforms when they are modified.

Position in absolute space. Equivalent to the translation of the accumulated layout transform.

Absolute coordinates could be either desktop or window space depending on what space the root of the widget hierarchy is in.

◆ Position

const FVector2f FGeometry::Position = FVector2f::ZeroVector

!!! DEPRECATED !!!

Position of the geometry with respect to its parent in local space. Equivalent to the translation portion of the Local->Parent layout transform. If you know your children have no additional scale applied to them, you can use this as the Local->Parent layout transform. If your children DO have additional scale applied, there is no way to determine the actual Local->Parent layout transform, since the scale is accumulated.

◆ Scale

const float FGeometry::Scale

!!! DEPRECATED !!! These legacy public members should ideally not be referenced, as they do not account for the render transform. FGeometry manipulation should be done in local space as much as possible so logic can be done in aligned local space, but still support arbitrary render transforms.

This member has been made const to prevent mutation, which would also break render transforms, which are computed during construction. There is no way to easily detect mutation of public members, thus no way to update the render transforms when they are modified.

Scale in absolute space. Equivalent to the scale of the accumulated layout transform.

Absolute coordinates could be either desktop or window space depending on what space the root of the widget hierarchy is in.

◆ Size

const FDeprecateSlateVector2D FGeometry::Size

!!! DEPRECATED !!! Use GetLocalSize() accessor instead of directly accessing public members.

This member has been made const to prevent mutation.
There is no way to easily detect mutation of public members, thus no way to update the render transforms when they are modified.

Size of the geometry in local space.


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