Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- BaseButton (3)
- ColorRect
- Container (13)
- GraphEdit
- ItemList
- Label
- LineEdit
- MenuBar
- NinePatchRect
- Panel
- Range (6)
- ReferenceRect
- RichTextLabel
- Separator (2)
- TabBar
- TextEdit (1)
- TextureRect
- Tree
- VideoStreamPlayer
Table of contents
-
var expand_mode = EXPAND_KEEP_SIZE -
var flip_h: bool = false -
var flip_v: bool = false -
var mouse_filter = MOUSE_FILTER_PASS -
var stretch_mode = STRETCH_SCALE -
var texture: Texture2D -
const EXPAND_KEEP_SIZE = 0 enum ExpandMode -
const EXPAND_IGNORE_SIZE = 1 enum ExpandMode -
const EXPAND_FIT_WIDTH = 2 enum ExpandMode -
const EXPAND_FIT_WIDTH_PROPORTIONAL = 3 enum ExpandMode -
const EXPAND_FIT_HEIGHT = 4 enum ExpandMode -
const EXPAND_FIT_HEIGHT_PROPORTIONAL = 5 enum ExpandMode -
const STRETCH_SCALE = 0 enum StretchMode -
const STRETCH_TILE = 1 enum StretchMode -
const STRETCH_KEEP = 2 enum StretchMode -
const STRETCH_KEEP_CENTERED = 3 enum StretchMode -
const STRETCH_KEEP_ASPECT = 4 enum StretchMode -
const STRETCH_KEEP_ASPECT_CENTERED = 5 enum StretchMode -
const STRETCH_KEEP_ASPECT_COVERED = 6 enum StretchMode -
enum ExpandMode -
enum StretchMode
TextureRect #
is_instantiable, Node, core, not_builtin_classes
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.
Members #
var expand_mode = EXPAND_KEEP_SIZE#
Defines how minimum size is determined based on the texture's size. See ExpandMode for options.
var flip_h: bool = false#
If true, texture is flipped horizontally.
var flip_v: bool = false#
If true, texture is flipped vertically.
var mouse_filter = MOUSE_FILTER_PASS#
var stretch_mode = STRETCH_SCALE#
Controls the texture's behavior when resizing the node's bounding rectangle. See StretchMode.
var texture: Texture2D#
The node's Texture2D resource.
Methods #
Annotations #
Constants #
const EXPAND_KEEP_SIZE = 0 enum ExpandMode#
The minimum size will be equal to texture size, i.e. TextureRect can't be smaller than the texture.
const EXPAND_IGNORE_SIZE = 1 enum ExpandMode#
The size of the texture won't be considered for minimum size calculation, so the TextureRect can be shrunk down past the texture size.
const EXPAND_FIT_WIDTH = 2 enum ExpandMode#
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.
const EXPAND_FIT_WIDTH_PROPORTIONAL = 3 enum ExpandMode#
Same as EXPAND_FIT_WIDTH, but keeps texture's aspect ratio.
const EXPAND_FIT_HEIGHT = 4 enum ExpandMode#
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.
const EXPAND_FIT_HEIGHT_PROPORTIONAL = 5 enum ExpandMode#
Same as EXPAND_FIT_HEIGHT, but keeps texture's aspect ratio.
const STRETCH_SCALE = 0 enum StretchMode#
Scale to fit the node's bounding rectangle.
const STRETCH_TILE = 1 enum StretchMode#
Tile inside the node's bounding rectangle.
const STRETCH_KEEP = 2 enum StretchMode#
The texture keeps its original size and stays in the bounding rectangle's top-left corner.
const STRETCH_KEEP_CENTERED = 3 enum StretchMode#
The texture keeps its original size and stays centered in the node's bounding rectangle.
const STRETCH_KEEP_ASPECT = 4 enum StretchMode#
Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
const STRETCH_KEEP_ASPECT_CENTERED = 5 enum StretchMode#
Scale the texture to fit the node's bounding rectangle, center it and maintain its aspect ratio.
const STRETCH_KEEP_ASPECT_COVERED = 6 enum StretchMode#
Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
Constructors #
Enums #
ExpandMode#
enum ExpandMode {
EXPAND_KEEP_SIZE = 0,
EXPAND_IGNORE_SIZE = 1,
EXPAND_FIT_WIDTH = 2,
EXPAND_FIT_WIDTH_PROPORTIONAL = 3,
EXPAND_FIT_HEIGHT = 4,
EXPAND_FIT_HEIGHT_PROPORTIONAL = 5,
}StretchMode#
enum StretchMode {
STRETCH_SCALE = 0,
STRETCH_TILE = 1,
STRETCH_KEEP = 2,
STRETCH_KEEP_CENTERED = 3,
STRETCH_KEEP_ASPECT = 4,
STRETCH_KEEP_ASPECT_CENTERED = 5,
STRETCH_KEEP_ASPECT_COVERED = 6,
}