Navigation
API > API/Runtime > API/Runtime/Engine
A drawing canvas.
| Name | UCanvas |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/Engine/Canvas.h |
| Include Path | #include "Engine/Canvas.h" |
Syntax
UCLASS (Transient, BlueprintType, MinimalAPI)
class UCanvas : public UObject
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UCanvas
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UCanvas
(
const FObjectInitializer& ObjectInitializer |
Engine/Canvas.h |
Enums
Public
| Name | Remarks |
|---|---|
| ELastCharacterIndexFormat |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bCenterX | uint32 | Engine/Canvas.h | ||
| bCenterY | uint32 | Engine/Canvas.h | ||
| bNoSmooth | uint32 | Engine/Canvas.h | ||
| CachedDisplayHeight | int32 | Engine/Canvas.h | ||
| CachedDisplayWidth | int32 | Engine/Canvas.h | ||
| Canvas | FCanvas * | Engine/Canvas.h | ||
| ClipX | float | Engine/Canvas.h | ||
| ClipY | float | Engine/Canvas.h | ||
| ColorModulate | FPlane | Internal. | Engine/Canvas.h | |
| DefaultTexture | TObjectPtr< class UTexture2D > | Engine/Canvas.h | ||
| DisplayDebugManager | FDisplayDebugManager | Engine/Canvas.h | ||
| DrawColor | FColor | Engine/Canvas.h | ||
| GradientTexture0 | TObjectPtr< class UTexture2D > | Engine/Canvas.h | ||
| HmdOrientation | FQuat | Engine/Canvas.h | ||
| OrgX | float | Modifiable properties. | Engine/Canvas.h | |
| OrgY | float | Engine/Canvas.h | ||
| ReporterGraph | TObjectPtr< class UReporterGraph > | Helper class to render 2d graphs on canvas | Engine/Canvas.h | |
| SafeZonePadEX | int32 | Engine/Canvas.h | ||
| SafeZonePadEY | int32 | Engine/Canvas.h | ||
| SafeZonePadX | int32 | Cached data for safe zone calculation. | Engine/Canvas.h | |
| SafeZonePadY | int32 | Engine/Canvas.h | ||
| SceneView | FSceneView * | Engine/Canvas.h | ||
| SizeX | int32 | Engine/Canvas.h | ||
| SizeY | int32 | Engine/Canvas.h | ||
| UnsafeSizeX | int32 | Engine/Canvas.h | ||
| UnsafeSizeY | int32 | Engine/Canvas.h | ||
| ViewProjectionMatrix | FMatrix | Engine/Canvas.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ApplySafeZoneTransform () |
Applies the current Platform's safe zone to the current Canvas position. | Engine/Canvas.h | |
FFontRenderInfo CreateFontRenderInfo
(
bool bClipText, |
Constructor for FontRenderInfo | Engine/Canvas.h | |
void Deproject
(
FVector2D ScreenPos, |
Transforms 2D screen coordinates into a 3D world-space origin and direction. | Engine/Canvas.h | |
virtual void DrawDebugGraph
(
const FString& Title, |
Draws a graph comparing 2 variables. Useful for visual debugging and tweaking. | Engine/Canvas.h | |
void DrawIcon
(
FCanvasIcon Icon, |
Draw a CanvasIcon at the desired canvas position. | Engine/Canvas.h | |
void DrawItem
(
FCanvasItem& Item, |
Draw a CanvasItem at the given coordinates | Engine/Canvas.h | |
void DrawItem
(
FCanvasItem& Item, |
Draw a CanvasItem at the given coordinates | Engine/Canvas.h | |
void DrawItem
(
FCanvasItem& Item |
Draw a CanvasItem | Engine/Canvas.h | |
void DrawScaledIcon
(
FCanvasIcon Icon, |
Draw a scaled CanvasIcon at the desired canvas position. | Engine/Canvas.h | |
float DrawText
(
const UFont* InFont, |
Engine/Canvas.h | ||
float DrawText
(
const UFont* InFont, |
Draws a string of text to the screen. | Engine/Canvas.h | |
float DrawText
(
const UFont* InFont, |
Engine/Canvas.h | ||
void DrawTile
(
UTexture* Tex, |
Draw arbitrary aligned rectangle. | Engine/Canvas.h | |
void GetCenter
(
float& outX, |
Return X,Y for center of the draw region. | Engine/Canvas.h | |
void GetCenter
(
double& outX, |
Engine/Canvas.h | ||
float GetDPIScale() |
Engine/Canvas.h | ||
TWeakObjectPtr< class UReporterGraph > GetReporterGraph() |
Creates if necessary and returns ReporterGraph instance for 2d graph canvas drawing | Engine/Canvas.h | |
void Init
(
int32 InSizeX, |
Initializes the canvas. | Engine/Canvas.h | |
void K2_Deproject
(
FVector2D ScreenPosition, |
Performs a deprojection of a screen space coordinate using the projection matrix set up for the Canvas. | Engine/Canvas.h |
|
void K2_DrawBorder
(
UTexture* BorderTexture, |
Draws a 3x3 grid border with tiled frame and tiled interior on the Canvas. | Engine/Canvas.h |
|
void K2_DrawBox
(
FVector2D ScreenPosition, |
Draws an unfilled box on the Canvas. | Engine/Canvas.h |
|
void K2_DrawLine
(
FVector2D ScreenPositionA, |
Draws a line on the Canvas. | Engine/Canvas.h |
|
void K2_DrawMaterial
(
UMaterialInterface* RenderMaterial, |
Draws a material on the Canvas. | Engine/Canvas.h |
|
void K2_DrawMaterialTriangle
(
UMaterialInterface* RenderMaterial, |
Draws a set of triangles on the Canvas. | Engine/Canvas.h |
|
void K2_DrawPolygon
(
UTexture* RenderTexture, |
Draws a polygon on the Canvas. | Engine/Canvas.h |
|
void K2_DrawText
(
UFont* RenderFont, |
Draws text on the Canvas. | Engine/Canvas.h |
|
void K2_DrawTexture
(
UTexture* RenderTexture, |
Draws a texture on the Canvas. | Engine/Canvas.h |
|
void K2_DrawTriangle
(
UTexture* RenderTexture, |
Draws a set of triangles on the Canvas. | Engine/Canvas.h |
|
FVector K2_Project
(
FVector WorldLocation |
Performs a projection of a world space coordinates using the projection matrix set up for the Canvas. | Engine/Canvas.h |
|
| Returns the wrapped text size in screen space coordinates. | Engine/Canvas.h |
|
|
| Returns the clipped text size in screen space coordinates. | Engine/Canvas.h | ||
void PopSafeZoneTransform() |
Engine/Canvas.h | ||
FVector Project
(
FVector Location, |
Transforms a 3D world-space vector into 2D screen coordinates. | Engine/Canvas.h | |
virtual void Reset
(
bool bKeepOrigin |
Reset canvas parameters, optionally do not change the origin | Engine/Canvas.h | |
void SetClip
(
float X, |
Sets the position of the lower-left corner of the clipping region of the Canvas | Engine/Canvas.h | |
void SetDrawColor
(
uint8 R, |
Set draw color. (R,G,B,A) | Engine/Canvas.h | |
void SetDrawColor
(
FColor const& C |
Set draw color. (FColor) | Engine/Canvas.h | |
void SetLinearDrawColor
(
FLinearColor InColor, |
Set DrawColor with a FLinearColor and optional opacity override | Engine/Canvas.h | |
void SetView
(
FSceneView* InView |
Changes the view for the canvas. | Engine/Canvas.h | |
| Engine/Canvas.h | |||
| Calculate the length of a string, taking text wrapping into account. | Engine/Canvas.h | ||
| Engine/Canvas.h | |||
| Engine/Canvas.h | |||
| Engine/Canvas.h | |||
| Engine/Canvas.h | |||
| Calculates the horizontal and vertical size of a given string. | Engine/Canvas.h | ||
| Engine/Canvas.h | |||
void Update() |
Updates the canvas. | Engine/Canvas.h | |
void UpdateSafeZoneData() |
Updates cached SafeZone data from the device. Call when main device is resized. | Engine/Canvas.h | |
int32 WrappedPrint
(
bool Draw, |
Compute size and optionally print text with word wrap. | Engine/Canvas.h | |
void WrappedStrLenf
(
const UFont* Font, |
Calculate the size of a string built from a font, word wrapped to a specified region. | Engine/Canvas.h | |
void WrapString
(
FTextSizingParameters& Parameters, |
Engine/Canvas.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginDestroy() |
Engine/Canvas.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void CanvasStringSize
(
FTextSizingParameters& Parameters, |
Calculates the size of the specified string. | Engine/Canvas.h | |
static void ClippedStrLen
(
const UFont* Font, |
Calculate the length of a string. | Engine/Canvas.h | |
static FCanvasIcon MakeIcon
(
UTexture* Texture, |
Fake CanvasIcon constructor. | Engine/Canvas.h | |
static void MeasureStringInternal
(
FTextSizingParameters& Parameters, |
Engine/Canvas.h | ||
static void MeasureStringInternal
(
FTextSizingParameters& Parameters, |
Measures a string, optionally stopped after the specified horizontal offset in pixels is reached. | Engine/Canvas.h | |
| Calculate the length of a string, taking text wrapping into account. | Engine/Canvas.h | ||
| Engine/Canvas.h | |||
| Engine/Canvas.h | |||
| Engine/Canvas.h | |||
static void UpdateAllCanvasSafeZoneData() |
Function to go through all constructed canvas items and update their safe zone data. | Engine/Canvas.h | |
static void WrapString
(
FCanvasWordWrapper& Wrapper, |
Parses a single string into an array of strings that will fit inside the specified bounding region. | Engine/Canvas.h |