godot/doc/classes/Texture2D.xml

133 lines
5.1 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
<class name="Texture2D" inherits="Texture" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Texture for 2D and 3D.
</brief_description>
<description>
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.
</description>
<tutorials>
</tutorials>
<methods>
<method name="_draw" qualifiers="virtual const">
<return type="void" />
<argument index="0" name="to_canvas_item" type="RID" />
<argument index="1" name="pos" type="Vector2" />
<argument index="2" name="modulate" type="Color" />
<argument index="3" name="transpose" type="bool" />
<description>
</description>
</method>
<method name="_draw_rect" qualifiers="virtual const">
<return type="void" />
<argument index="0" name="to_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" />
<argument index="4" name="transpose" type="bool" />
<description>
</description>
</method>
<method name="_draw_rect_region" qualifiers="virtual const">
<return type="void" />
<argument index="0" name="tp_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" />
<argument index="4" name="transpose" type="bool" />
<argument index="5" name="clip_uv" type="bool" />
<description>
</description>
</method>
<method name="_get_height" qualifiers="virtual const">
<return type="int" />
<description>
</description>
</method>
<method name="_get_width" qualifiers="virtual const">
<return type="int" />
<description>
</description>
</method>
<method name="_has_alpha" qualifiers="virtual const">
<return type="bool" />
<description>
</description>
</method>
<method name="_is_pixel_opaque" qualifiers="virtual const">
<return type="bool" />
<argument index="0" name="x" type="int" />
<argument index="1" name="y" type="int" />
<description>
</description>
</method>
<method name="draw" qualifiers="const">
<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" />
<description>
Draws the texture using a [CanvasItem] with the [RenderingServer] API at the specified [code]position[/code].
</description>
</method>
<method name="draw_rect" qualifiers="const">
<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" />
<description>
Draws the texture using a [CanvasItem] with the [RenderingServer] API.
</description>
</method>
<method name="draw_rect_region" qualifiers="const">
<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" />
<description>
Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API.
</description>
</method>
<method name="get_height" qualifiers="const">
<return type="int" />
<description>
Returns the texture height.
</description>
</method>
<method name="get_image" qualifiers="const">
<return type="Image" />
<description>
2022-05-22 15:44:19 +00:00
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.
</description>
</method>
<method name="get_size" qualifiers="const">
<return type="Vector2" />
<description>
Returns the texture size.
</description>
</method>
<method name="get_width" qualifiers="const">
<return type="int" />
<description>
Returns the texture width.
</description>
</method>
<method name="has_alpha" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if this [Texture2D] has an alpha channel.
</description>
</method>
</methods>
</class>