Texture for 2D and 3D.
A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D [Sprite2D] or GUI [Control].
Textures are often created by loading them from a file. See [method @GDScript.load].
[Texture2D] is a base for other resources. It cannot be used directly.
[b]Note:[/b] The maximum texture size is 16384×16384 pixels due to graphics hardware limitations. Larger textures may fail to import.
Called when the entire [Texture2D] is requested to be drawn over a [CanvasItem], with the top-left offset specified in [param pos]. [param modulate] specifies a multiplier for the colors being drawn, while [param transpose] specifies whether drawing should be performed in column-major order instead of row-major order (resulting in 90-degree clockwise rotation).
[b]Note:[/b] This is only used in 2D rendering, not 3D.
Called when the [Texture2D] is requested to be drawn onto [CanvasItem]'s specified [param rect]. [param modulate] specifies a multiplier for the colors being drawn, while [param transpose] specifies whether drawing should be performed in column-major order instead of row-major order (resulting in 90-degree clockwise rotation).
[b]Note:[/b] This is only used in 2D rendering, not 3D.
Called when a part of the [Texture2D] specified by [param src_rect]'s coordinates is requested to be drawn onto [CanvasItem]'s specified [param rect]. [param modulate] specifies a multiplier for the colors being drawn, while [param transpose] specifies whether drawing should be performed in column-major order instead of row-major order (resulting in 90-degree clockwise rotation).
[b]Note:[/b] This is only used in 2D rendering, not 3D.
Called when the [Texture2D]'s height is queried.
Called when the [Texture2D]'s width is queried.
Called when the presence of an alpha channel in the [Texture2D] is queried.
Called when a pixel's opaque state in the [Texture2D] is queried at the specified [code](x, y)[/code] position.
Creates a placeholder version of this resource ([PlaceholderTexture2D]).
Draws the texture using a [CanvasItem] with the [RenderingServer] API at the specified [param position].
Draws the texture using a [CanvasItem] with the [RenderingServer] API.
Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API.
Returns the texture height in pixels.
Returns an [Image] that is a copy of data from this [Texture2D] (a new [Image] is created each time). [Image]s can be accessed and manipulated directly.
[b]Note:[/b] This will fetch the texture data from the GPU, which might cause performance problems when overused.
Returns the texture size in pixels.
Returns the texture width in pixels.
Returns [code]true[/code] if this [Texture2D] has an alpha channel.