Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

TextureRect

Inherits: Control < CanvasItem < Node < Object

A control that displays a texture.

Description

A control that displays a texture, for example an icon inside a GUI. The texture's placement can be controlled with the stretch_mode property. It can scale, tile, or stay centered inside its bounding rectangle.

Tutorials

Properties

ExpandMode

expand_mode

0

bool

flip_h

false

bool

flip_v

false

MouseFilter

mouse_filter

1 (overrides Control)

StretchMode

stretch_mode

0

Texture2D

texture


Enumerations

enum ExpandMode:

ExpandMode EXPAND_KEEP_SIZE = 0

The minimum size will be equal to texture size, i.e. TextureRect can't be smaller than the texture.

ExpandMode EXPAND_IGNORE_SIZE = 1

The size of the texture won't be considered for minimum size calculation, so the TextureRect can be shrunk down past the texture size.

ExpandMode EXPAND_FIT_WIDTH = 2

The height of the texture will be ignored. Minimum width will be equal to the current height. Useful for horizontal layouts, e.g. inside HBoxContainer.