UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SlateDynamicImageBrush.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Layout/Margin.h"
9
14 : public FSlateBrush, public TSharedFromThis<FSlateDynamicImageBrush>
15{
38
61
81
91 const FName InTextureName,
94 const FLinearColor& InTint = FLinearColor(1.0f, 1.0f, 1.0f, 1.0f),
97
102
105
106private:
107 SLATECORE_API void ReleaseResourceInternal();
108
109 void InitFromTextureObject(FName InTextureName)
110 {
112 // if we have a texture, make a unique name
113 if (Object != nullptr)
114 {
115 // @todo Slate - Hack: This is to address an issue where the brush created and a GC occurs before the brush resource object becomes referenced
116 // by the Slate resource manager. Don't add objects that are already in root set (and mark them as such) to avoid incorrect removing objects
117 // from root set in destructor.
118 if (!Object->IsRooted())
119 {
120 ensureMsgf(false, TEXT("This hack usually results in a crash during loading screens in slate. Please change any code that arrives here to not use FSlateDynamicImageBrush. In the case of loading screens, you can use FDeferredCleanupSlateBrush. Which correctly accounts for both GC lifetime, and the lifetime of the object through the slate rendering pipeline which may be several frames after you stop using it."));
121
122 Object->AddToRoot();
123 bRemoveResourceFromRootSet = true;
124 }
125
127 }
128 }
129
130private:
132 bool bRemoveResourceFromRootSet : 1;
133
135 bool bIsInitalized : 1;
136};
#define FORCENOINLINE
Definition AndroidPlatform.h:142
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
Definition NameTypes.h:617
Definition Array.h:670
Definition SharedPointer.h:1640
Definition SharedPointer.h:692
Definition Object.h:95
Definition Texture2DDynamic.h:35
Definition Texture2D.h:26
Definition SlateBrush.h:19
Type
Definition SlateBrush.h:93
@ FullColor
Definition SlateBrush.h:98
Type
Definition SlateBrush.h:47
@ NoTile
Definition SlateBrush.h:49
@ false
Definition radaudio_common.h:23
Definition Color.h:48
Definition Margin.h:17
Definition SlateBrush.h:239
FName ResourceName
Definition SlateBrush.h:508
class UObject * GetResourceObject() const
Definition SlateBrush.h:323
uint8 bIsDynamicallyLoaded
Definition SlateBrush.h:491
Definition SlateDynamicImageBrush.h:15
virtual SLATECORE_API ~FSlateDynamicImageBrush()
Definition SlateDynamicImageBrush.cpp:64
static SLATECORE_API TSharedPtr< FSlateDynamicImageBrush > CreateWithImageData(const FName InTextureName, const UE::Slate::FDeprecateVector2DParameter &InImageSize, const TArray< uint8 > &InImageData, const FLinearColor &InTint=FLinearColor(1.0f, 1.0f, 1.0f, 1.0f), ESlateBrushTileType::Type InTiling=ESlateBrushTileType::NoTile, ESlateBrushImageType::Type InImageType=ESlateBrushImageType::FullColor)
Definition SlateDynamicImageBrush.cpp:11
SLATECORE_API void ReleaseResource()
Definition SlateDynamicImageBrush.cpp:34
FORCENOINLINE FSlateDynamicImageBrush(class UTexture2D *InTexture, const UE::Slate::FDeprecateVector2DParameter &InImageSize, const FName InTextureName, const FLinearColor &InTint=FLinearColor(1.0f, 1.0f, 1.0f, 1.0f), ESlateBrushTileType::Type InTiling=ESlateBrushTileType::NoTile, ESlateBrushImageType::Type InImageType=ESlateBrushImageType::FullColor)
Definition SlateDynamicImageBrush.h:23
FORCENOINLINE FSlateDynamicImageBrush(class UTexture2DDynamic *InTexture, const UE::Slate::FDeprecateVector2DParameter &InImageSize, const FName InTextureName, const FLinearColor &InTint=FLinearColor(1.0f, 1.0f, 1.0f, 1.0f), ESlateBrushTileType::Type InTiling=ESlateBrushTileType::NoTile, ESlateBrushImageType::Type InImageType=ESlateBrushImageType::FullColor)
Definition SlateDynamicImageBrush.h:46
FORCENOINLINE FSlateDynamicImageBrush(const FName InTextureName, const UE::Slate::FDeprecateVector2DParameter &InImageSize, const FLinearColor &InTint=FLinearColor(1.0f, 1.0f, 1.0f, 1.0f), ESlateBrushTileType::Type InTiling=ESlateBrushTileType::NoTile, ESlateBrushImageType::Type InImageType=ESlateBrushImageType::FullColor)
Definition SlateDynamicImageBrush.h:69
Definition SlateVector2.h:485