2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2021-04-26 13:14:51 +02:00
<class name= "Texture" inherits= "Resource" version= "3.4" >
2017-09-12 22:42:36 +02:00
<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 [Sprite] or GUI [Control].
2018-07-09 16:31:34 +02:00
Textures are often created by loading them from a file. See [method @GDScript.load].
2020-01-26 06:59:51 +01:00
[Texture] is a base for other resources. It cannot be used directly.
2020-11-17 17:01:08 +01:00
[b]Note:[/b] The maximum texture size is 16384× 16384 pixels due to graphics hardware limitations. Larger textures may fail to import.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "draw" qualifiers= "const" >
2021-07-30 15:28:05 +02: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" />
<argument index= "4" name= "normal_map" type= "Texture" default= "null" />
2017-09-12 22:42:36 +02:00
<description >
2020-01-26 06:59:51 +01:00
Draws the texture using a [CanvasItem] with the [VisualServer] API at the specified [code]position[/code]. Equivalent to [method VisualServer.canvas_item_add_texture_rect] with a rect at [code]position[/code] and the size of this [Texture].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "draw_rect" qualifiers= "const" >
2021-07-30 15:28:05 +02: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" />
<argument index= "5" name= "normal_map" type= "Texture" default= "null" />
2017-09-12 22:42:36 +02:00
<description >
2020-01-26 06:59:51 +01:00
Draws the texture using a [CanvasItem] with the [VisualServer] API. Equivalent to [method VisualServer.canvas_item_add_texture_rect].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "draw_rect_region" qualifiers= "const" >
2021-07-30 15:28:05 +02: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= "normal_map" type= "Texture" default= "null" />
<argument index= "6" name= "clip_uv" type= "bool" default= "true" />
2017-09-12 22:42:36 +02:00
<description >
2020-01-26 06:59:51 +01:00
Draws a part of the texture using a [CanvasItem] with the [VisualServer] API. Equivalent to [method VisualServer.canvas_item_add_texture_rect_region].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_data" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Image" />
2017-09-12 22:42:36 +02:00
<description >
2020-08-31 03:47:28 +02:00
Returns an [Image] that is a copy of data from this [Texture]. [Image]s can be accessed and manipulated directly.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_height" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2019-05-24 04:15:43 +02:00
Returns the texture height.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_size" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Vector2" />
2017-09-12 22:42:36 +02:00
<description >
2019-05-24 04:15:43 +02:00
Returns the texture size.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_width" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2019-05-24 04:15:43 +02:00
Returns the texture width.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "has_alpha" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2017-09-12 22:42:36 +02:00
<description >
2020-01-26 06:59:51 +01:00
Returns [code]true[/code] if this [Texture] has an alpha channel.
2017-09-12 22:42:36 +02:00
</description>
</method>
</methods>
2018-01-11 23:38:35 +01:00
<members >
2019-06-29 12:38:01 +02:00
<member name= "flags" type= "int" setter= "set_flags" getter= "get_flags" default= "4" >
2020-01-26 06:59:51 +01:00
The texture's [enum Flags]. [enum Flags] are used to set various properties of the [Texture].
2018-01-11 23:38:35 +01:00
</member>
</members>
2017-09-12 22:42:36 +02:00
<constants >
2018-01-11 23:38:35 +01:00
<constant name= "FLAGS_DEFAULT" value= "7" enum= "Flags" >
2019-06-29 15:24:23 +02:00
Default flags. [constant FLAG_MIPMAPS], [constant FLAG_REPEAT] and [constant FLAG_FILTER] are enabled.
2018-01-11 23:38:35 +01:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "FLAG_MIPMAPS" value= "1" enum= "Flags" >
2019-06-22 01:04:47 +02:00
Generates mipmaps, which are smaller versions of the same texture to use when zoomed out, keeping the aspect ratio.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "FLAG_REPEAT" value= "2" enum= "Flags" >
2019-06-22 01:04:47 +02:00
Repeats the texture (instead of clamp to edge).
2020-11-02 18:29:27 +01:00
[b]Note:[/b] Ignored when using an [AtlasTexture] as these don't support repetition.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "FLAG_FILTER" value= "4" enum= "Flags" >
2019-06-22 01:04:47 +02:00
Uses a magnifying filter, to enable smooth zooming in of the texture.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "FLAG_ANISOTROPIC_FILTER" value= "8" enum= "Flags" >
2019-06-22 01:04:47 +02:00
Uses anisotropic mipmap filtering. Generates smaller versions of the same texture with different aspect ratios.
This results in better-looking textures when viewed from oblique angles.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "FLAG_CONVERT_TO_LINEAR" value= "16" enum= "Flags" >
2019-06-22 01:04:47 +02:00
Converts the texture to the sRGB color space.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "FLAG_MIRRORED_REPEAT" value= "32" enum= "Flags" >
2019-06-22 01:04:47 +02:00
Repeats the texture with alternate sections mirrored.
2020-11-02 18:29:27 +01:00
[b]Note:[/b] Ignored when using an [AtlasTexture] as these don't support repetition.
2017-09-12 22:42:36 +02:00
</constant>
2018-08-21 00:35:30 +02:00
<constant name= "FLAG_VIDEO_SURFACE" value= "2048" enum= "Flags" >
2017-10-22 12:56:11 +02:00
Texture is a video surface.
</constant>
2017-09-12 22:42:36 +02:00
</constants>
</class>