UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Image.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"
7#include "Misc/Attribute.h"
9#include "Input/Reply.h"
10#include "Widgets/SWidget.h"
11#include "Components/Widget.h"
15#include "Image.generated.h"
16
17class SImage;
21class UTexture2D;
23
29UCLASS(MinimalAPI)
31{
33
34public:
35
36 UE_DEPRECATED(5.2, "Direct access to Brush is deprecated. Please use the getter or setter.")
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetBrush", FieldNotify, Category=Appearance)
40
42 UPROPERTY()
43 FGetSlateBrush BrushDelegate;
44
45 UE_DEPRECATED(5.2, "Direct access to ColorAndOpacity is deprecated. Please use the getter or setter.")
47 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetColorAndOpacity", Category=Appearance, meta=( sRGB="true") )
48 FLinearColor ColorAndOpacity;
49
51 UPROPERTY()
52 FGetLinearColor ColorAndOpacityDelegate;
53
54 UE_DEPRECATED(5.2, "Direct access to bFlipForRightToLeftFlowDirection is deprecated. Please use the getter or setter.")
56 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter = "ShouldFlipForRightToLeftFlowDirection", Setter = "SetFlipForRightToLeftFlowDirection", Category = "Localization")
57 bool bFlipForRightToLeftFlowDirection;
58
59public:
60
61 UPROPERTY(EditAnywhere, Category=Events, meta=( IsBindableEvent="True" ))
62 FOnPointerEvent OnMouseButtonDownEvent;
63
64public:
65
67 UFUNCTION(BlueprintCallable, Category="Appearance")
68 UMG_API void SetColorAndOpacity(FLinearColor InColorAndOpacity);
69
70 UMG_API const FLinearColor& GetColorAndOpacity() const;
71
73 UFUNCTION(BlueprintCallable, Category="Appearance")
74 UMG_API void SetOpacity(float InOpacity);
75
77 UE_DEPRECATED(5.0, "Deprecated. Use SetDesiredSizeOverride instead.")
78 UMG_API void SetBrushSize(FVector2D DesiredSize);
79
80 UFUNCTION(BlueprintCallable, Category = "Appearance")
81 UMG_API void SetDesiredSizeOverride(FVector2D DesiredSize);
82
84 UFUNCTION(BlueprintCallable, Category = "Appearance")
85 UMG_API void SetBrushTintColor(FSlateColor TintColor);
86
88 UFUNCTION(BlueprintCallable, Category = "Appearance")
89 UMG_API void SetBrushResourceObject(UObject* ResourceObject);
90
92 UFUNCTION(BlueprintCallable, Category="Appearance")
93 UMG_API virtual void SetBrush(const FSlateBrush& InBrush);
94
95 UMG_API const FSlateBrush& GetBrush() const;
96
98 UFUNCTION(BlueprintCallable, Category="Appearance")
99 UMG_API virtual void SetBrushFromAsset(USlateBrushAsset* Asset);
100
107 UFUNCTION(BlueprintCallable, Category="Appearance")
108 UMG_API virtual void SetBrushFromTexture(UTexture2D* Texture, bool bMatchSize = false);
109
116 UFUNCTION(BlueprintCallable, Category="Appearance")
118
125 UFUNCTION(BlueprintCallable, Category = "Appearance")
126 UMG_API virtual void SetBrushFromTextureDynamic(UTexture2DDynamic* Texture, bool bMatchSize = false);
127
129 UFUNCTION(BlueprintCallable, Category="Appearance")
130 UMG_API virtual void SetBrushFromMaterial(UMaterialInterface* Material);
131
138 UFUNCTION(BlueprintCallable, Category="Appearance")
139 UMG_API virtual void SetBrushFromSoftTexture(TSoftObjectPtr<UTexture2D> SoftTexture, bool bMatchSize = false);
140
142 UFUNCTION(BlueprintCallable, Category="Appearance")
143 UMG_API virtual void SetBrushFromSoftMaterial(TSoftObjectPtr<UMaterialInterface> SoftMaterial);
144
146 UFUNCTION(BlueprintCallable, Category="Appearance")
147 UMG_API UMaterialInstanceDynamic* GetDynamicMaterial();
148
149 UMG_API void SetFlipForRightToLeftFlowDirection(bool InbFlipForRightToLeftFlowDirection);
150
151 UMG_API bool ShouldFlipForRightToLeftFlowDirection() const;
152
153 //~ Begin UWidget Interface
154 UMG_API virtual void SynchronizeProperties() override;
155 //~ End UWidget Interface
156
157 //~ Begin UVisual Interface
158 UMG_API virtual void ReleaseSlateResources(bool bReleaseChildren) override;
159 //~ End UVisual Interface
160
161#if WITH_EDITOR
162 //~ Begin UWidget Interface
163 UMG_API virtual const FText GetPaletteCategory() override;
164 //~ End UWidget Interface
165#endif
166
167protected:
168 //~ Begin UWidget Interface
169 UMG_API virtual TSharedRef<SWidget> RebuildWidget() override;
170 //~ End UWidget Interface
171
173 UMG_API const FSlateBrush* ConvertImage(TAttribute<FSlateBrush> InImageAsset) const;
174
175 // Called when we need to stream in content.
176 UMG_API void RequestAsyncLoad(TSoftObjectPtr<UObject> SoftObject, TFunction<void()>&& Callback);
178
179 // Called when we need to abort the texture being streamed in.
180 UMG_API virtual void CancelImageStreaming();
181
182 // Called when the image streaming starts, after the other one was cancelled.
183 UMG_API virtual void OnImageStreamingStarted(TSoftObjectPtr<UObject> SoftObject);
184
185 // Called when the image streaming completes.
186 UMG_API virtual void OnImageStreamingComplete(TSoftObjectPtr<UObject> LoadedSoftObject);
187
188 //
189 UMG_API FReply HandleMouseButtonDown(const FGeometry& Geometry, const FPointerEvent& MouseEvent);
190
191#if WITH_ACCESSIBILITY
192 UMG_API virtual TSharedPtr<SWidget> GetAccessibleWidget() const override;
193#endif
194
195protected:
197
200
201protected:
202
206};
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
Definition UnrealType.h:3087
Definition Reply.h:24
Definition Text.h:385
Definition SlateTextureAtlasInterface.h:64
Definition SImage.h:29
Definition Attribute.h:17
Definition AndroidPlatformMisc.h:14
Definition ScriptInterface.h:139
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition Image.h:31
FSoftObjectPath StreamingObjectPath
Definition Image.h:199
TSharedPtr< FStreamableHandle > StreamingHandle
Definition Image.h:198
PRAGMA_DISABLE_DEPRECATION_WARNINGS PROPERTY_BINDING_IMPLEMENTATION(FSlateColor, ColorAndOpacity)
TSharedPtr< SImage > MyImage
Definition Image.h:196
Definition MaterialInstanceDynamic.h:15
Definition MaterialInterface.h:296
Definition Object.h:95
Definition SlateBrushAsset.h:17
Definition Texture2DDynamic.h:35
Definition Texture2D.h:26
Definition Widget.h:217
@ false
Definition radaudio_common.h:23
Definition Geometry.h:40
Definition Color.h:48
Definition Events.h:695
Definition SlateBrush.h:239
Definition SlateColor.h:42
Definition SoftObjectPath.h:56
Definition StreamableManager.h:191
Definition SoftObjectPtr.h:174