2020-02-12 08:59:06 +00:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2022-02-14 13:18:53 +00:00
|
|
|
|
<class name="Texture2D" inherits="Texture" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
2020-02-12 08:59:06 +00:00
|
|
|
|
<brief_description>
|
|
|
|
|
Texture for 2D and 3D.
|
|
|
|
|
</brief_description>
|
|
|
|
|
<description>
|
2020-03-30 16:22:57 +00:00
|
|
|
|
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].
|
2020-02-12 08:59:06 +00:00
|
|
|
|
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.
|
2020-09-29 14:27:13 +00:00
|
|
|
|
[b]Note:[/b] The maximum texture size is 16384×16384 pixels due to graphics hardware limitations. Larger textures may fail to import.
|
2020-02-12 08:59:06 +00:00
|
|
|
|
</description>
|
|
|
|
|
<tutorials>
|
|
|
|
|
</tutorials>
|
|
|
|
|
<methods>
|
|
|
|
|
<method name="draw" qualifiers="const">
|
2021-07-30 13:28:05 +00:00
|
|
|
|
<return type="void" />
|
|
|
|
|
<argument index="0" name="canvas_item" type="RID" />
|
|
|
|
|
<argument index="1" name="position" type="Vector2" />
|
|
|
|
|
<argument index="2" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
|
|
|
|
|
<argument index="3" name="transpose" type="bool" default="false" />
|
2020-02-12 08:59:06 +00:00
|
|
|
|
<description>
|
2020-03-30 16:22:57 +00:00
|
|
|
|
Draws the texture using a [CanvasItem] with the [RenderingServer] API at the specified [code]position[/code].
|
2020-02-12 08:59:06 +00:00
|
|
|
|
</description>
|
|
|
|
|
</method>
|
|
|
|
|
<method name="draw_rect" qualifiers="const">
|
2021-07-30 13:28:05 +00:00
|
|
|
|
<return type="void" />
|
|
|
|
|
<argument index="0" name="canvas_item" type="RID" />
|
|
|
|
|
<argument index="1" name="rect" type="Rect2" />
|
|
|
|
|
<argument index="2" name="tile" type="bool" />
|
|
|
|
|
<argument index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
|
|
|
|
|
<argument index="4" name="transpose" type="bool" default="false" />
|
2020-02-12 08:59:06 +00:00
|
|
|
|
<description>
|
2020-03-30 16:22:57 +00:00
|
|
|
|
Draws the texture using a [CanvasItem] with the [RenderingServer] API.
|
2020-02-12 08:59:06 +00:00
|
|
|
|
</description>
|
|
|
|
|
</method>
|
|
|
|
|
<method name="draw_rect_region" qualifiers="const">
|
2021-07-30 13:28:05 +00:00
|
|
|
|
<return type="void" />
|
|
|
|
|
<argument index="0" name="canvas_item" type="RID" />
|
|
|
|
|
<argument index="1" name="rect" type="Rect2" />
|
|
|
|
|
<argument index="2" name="src_rect" type="Rect2" />
|
|
|
|
|
<argument index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
|
|
|
|
|
<argument index="4" name="transpose" type="bool" default="false" />
|
|
|
|
|
<argument index="5" name="clip_uv" type="bool" default="true" />
|
2020-02-12 08:59:06 +00:00
|
|
|
|
<description>
|
2020-03-30 16:22:57 +00:00
|
|
|
|
Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API.
|
2020-02-12 08:59:06 +00:00
|
|
|
|
</description>
|
|
|
|
|
</method>
|
2021-04-04 20:25:40 +00:00
|
|
|
|
<method name="get_height" qualifiers="const">
|
2021-07-30 13:28:05 +00:00
|
|
|
|
<return type="int" />
|
2020-02-12 08:59:06 +00:00
|
|
|
|
<description>
|
2021-04-04 20:25:40 +00:00
|
|
|
|
Returns the texture height.
|
2020-02-12 08:59:06 +00:00
|
|
|
|
</description>
|
|
|
|
|
</method>
|
2021-04-04 20:25:40 +00:00
|
|
|
|
<method name="get_image" qualifiers="const">
|
2021-07-30 13:28:05 +00:00
|
|
|
|
<return type="Image" />
|
2020-02-12 08:59:06 +00:00
|
|
|
|
<description>
|
2021-04-04 20:25:40 +00:00
|
|
|
|
Returns an [Image] that is a copy of data from this [Texture2D]. [Image]s can be accessed and manipulated directly.
|
2020-02-12 08:59:06 +00:00
|
|
|
|
</description>
|
|
|
|
|
</method>
|
|
|
|
|
<method name="get_size" qualifiers="const">
|
2021-07-30 13:28:05 +00:00
|
|
|
|
<return type="Vector2" />
|
2020-02-12 08:59:06 +00:00
|
|
|
|
<description>
|
|
|
|
|
Returns the texture size.
|
|
|
|
|
</description>
|
|
|
|
|
</method>
|
|
|
|
|
<method name="get_width" qualifiers="const">
|
2021-07-30 13:28:05 +00:00
|
|
|
|
<return type="int" />
|
2020-02-12 08:59:06 +00:00
|
|
|
|
<description>
|
|
|
|
|
Returns the texture width.
|
|
|
|
|
</description>
|
|
|
|
|
</method>
|
|
|
|
|
<method name="has_alpha" qualifiers="const">
|
2021-07-30 13:28:05 +00:00
|
|
|
|
<return type="bool" />
|
2020-02-12 08:59:06 +00:00
|
|
|
|
<description>
|
|
|
|
|
Returns [code]true[/code] if this [Texture2D] has an alpha channel.
|
|
|
|
|
</description>
|
|
|
|
|
</method>
|
|
|
|
|
</methods>
|
|
|
|
|
</class>
|