summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorMarcel Admiraal <madmiraal@users.noreply.github.com>2021-03-28 12:32:17 +0100
committerMarcel Admiraal <madmiraal@users.noreply.github.com>2021-03-28 13:00:46 +0100
commitfd30c36985c6a5de09daf897800c36acb8c2c49a (patch)
tree31119051e0aa93211ea6cb81e6192a2e4afd41ea /doc/classes
parentf8442b97bf7f2b445b0aca9c02629277c11064d6 (diff)
Rename Texture.get_data() to get_image()
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/ImageTexture.xml6
-rw-r--r--doc/classes/Texture2D.xml2
-rw-r--r--doc/classes/Viewport.xml4
3 files changed, 6 insertions, 6 deletions
diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml
index 2bea482bc1..5fef56e354 100644
--- a/doc/classes/ImageTexture.xml
+++ b/doc/classes/ImageTexture.xml
@@ -18,11 +18,11 @@
var texture = load("res://icon.png")
$Sprite2D.texture = texture
[/codeblock]
- This is because images have to be imported as [StreamTexture2D] first to be loaded with [method @GDScript.load]. If you'd still like to load an image file just like any other [Resource], import it as an [Image] resource instead, and then load it normally using the [method @GDScript.load] method.
- But do note that the image data can still be retrieved from an imported texture as well using the [method Texture2D.get_data] method, which returns a copy of the data:
+ This is because images have to be imported as a [StreamTexture2D] first to be loaded with [method @GDScript.load]. If you'd still like to load an image file just like any other [Resource], import it as an [Image] resource instead, and then load it normally using the [method @GDScript.load] method.
+ [b]Note:[/b] The image can be retrieved from an imported texture using the [method Texture2D.get_image] method, which returns a copy of the image:
[codeblock]
var texture = load("res://icon.png")
- var image : Image = texture.get_data()
+ var image : Image = texture.get_image()
[/codeblock]
An [ImageTexture] is not meant to be operated from within the editor interface directly, and is mostly useful for rendering images on screen dynamically via code. If you need to generate images procedurally from within the editor, consider saving and importing images as custom texture resources implementing a new [EditorImportPlugin].
[b]Note:[/b] The maximum texture size is 16384×16384 pixels due to graphics hardware limitations.
diff --git a/doc/classes/Texture2D.xml b/doc/classes/Texture2D.xml
index 2270b95c63..b648098a94 100644
--- a/doc/classes/Texture2D.xml
+++ b/doc/classes/Texture2D.xml
@@ -63,7 +63,7 @@
Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API.
</description>
</method>
- <method name="get_data" qualifiers="const">
+ <method name="get_image" qualifiers="const">
<return type="Image">
</return>
<description>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 8120ae539e..471d21374d 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -80,9 +80,9 @@
</return>
<description>
Returns the viewport's texture.
- [b]Note:[/b] Due to the way OpenGL works, the resulting [ViewportTexture] is flipped vertically. You can use [method Image.flip_y] on the result of [method Texture2D.get_data] to flip it back, for example:
+ [b]Note:[/b] Due to the way OpenGL works, the resulting [ViewportTexture] is flipped vertically. You can use [method Image.flip_y] on the result of [method Texture2D.get_image] to flip it back, for example:
[codeblock]
- var img = get_viewport().get_texture().get_data()
+ var img = get_viewport().get_texture().get_image()
img.flip_y()
[/codeblock]
</description>