Inherits: Control < CanvasItem < Node < Object
A control that displays a texture.
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.
| ||
| ||
| ||
mouse_filter |
| |
| ||
0
The minimum size will be equal to texture size, i.e. TextureRect can't be smaller than the texture.
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.
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.
3
Same as EXPAND_FIT_WIDTH, but keeps texture's aspect ratio.
4
The width of the texture will be ignored. Minimum height will be equal to the current width. Useful for vertical layouts, e.g. inside VBoxContainer.
5
Same as EXPAND_FIT_HEIGHT, but keeps texture's aspect ratio.
0
Scale to fit the node's bounding rectangle.
1
Tile inside the node's bounding rectangle.
2
The texture keeps its original size and stays in the bounding rectangle's top-left corner.
3
The texture keeps its original size and stays centered in the node's bounding rectangle.
4
Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
5
Scale the texture to fit the node's bounding rectangle, center it and maintain its aspect ratio.
6
Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
0
Defines how minimum size is determined based on the texture's size. See ExpandMode for options.
Note: Using EXPAND_FIT_WIDTH, EXPAND_FIT_WIDTH_PROPORTIONAL, EXPAND_FIT_HEIGHT or EXPAND_FIT_HEIGHT_PROPORTIONAL may result in unstable behavior in some containers. This functionality is being re-evaluated and will change in the future.
false
If true, texture is flipped horizontally.
false
If true, texture is flipped vertically.
0
Controls the texture's behavior when resizing the node's bounding rectangle. See StretchMode.
The node's Texture2D resource.
© 2014–present Juan Linietsky, Ariel Manzur and the Godot community
Licensed under the Creative Commons Attribution Unported License v3.0.
https://docs.godotengine.org/en/4.2/classes/class_texturerect.html