diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-07-08 16:50:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-08 16:50:47 +0200 |
commit | d26442e709f6361af9ac755ec9291bb43f2cd69b (patch) | |
tree | f84384f85f9f4a329ffd892b4a6a238e932f161e /doc | |
parent | 697805af54f3d25195617a513e18ec3a4f9fe0c6 (diff) | |
parent | d2900429e81175a9f48240b180f1d8e3ab52865c (diff) |
Merge pull request #60739 from KoBeWi/add_static_methods_everywhere!!
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/HTTPRequest.xml | 3 | ||||
-rw-r--r-- | doc/classes/Image.xml | 7 | ||||
-rw-r--r-- | doc/classes/ImageTexture.xml | 12 |
3 files changed, 13 insertions, 9 deletions
diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index 166923314f..f138b9087b 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -106,8 +106,7 @@ if error != OK: push_error("Couldn't load the image.") - var texture = ImageTexture.new() - texture.create_from_image(image) + var texture = ImageTexture.create_from_image(image) # Display the image in a TextureRect node. var texture_rect = TextureRect.new() diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 43b03ce65e..31bd938c40 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -308,6 +308,13 @@ [b]Note:[/b] Godot's BMP module doesn't support 16-bit per pixel images. Only 1-bit, 4-bit, 8-bit, 24-bit, and 32-bit per pixel images are supported. </description> </method> + <method name="load_from_file" qualifiers="static"> + <return type="Image" /> + <argument index="0" name="path" type="String" /> + <description> + Creates a new [Image] and loads data from the specified file. + </description> + </method> <method name="load_jpg_from_buffer"> <return type="int" enum="Error" /> <argument index="0" name="buffer" type="PackedByteArray" /> diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml index aecb4fc4b6..e668e2e7fd 100644 --- a/doc/classes/ImageTexture.xml +++ b/doc/classes/ImageTexture.xml @@ -6,10 +6,8 @@ <description> A [Texture2D] based on an [Image]. For an image to be displayed, an [ImageTexture] has to be created from it using the [method create_from_image] method: [codeblock] - var texture = ImageTexture.new() - var image = Image.new() - image.load("res://icon.png") - texture.create_from_image(image) + var image = Image.load_from_file("res://icon.png") + var texture = ImageTexture.create_from_image(image) $Sprite2D.texture = texture [/codeblock] This way, textures can be created at run-time by loading images both from within the editor and externally. @@ -31,11 +29,11 @@ <link title="Importing images">$DOCS_URL/tutorials/assets_pipeline/importing_images.html</link> </tutorials> <methods> - <method name="create_from_image"> - <return type="void" /> + <method name="create_from_image" qualifiers="static"> + <return type="ImageTexture" /> <argument index="0" name="image" type="Image" /> <description> - Initializes the texture by allocating and setting the data from an [Image]. + Creates a new [ImageTexture] and initializes it by allocating and setting the data from an [Image]. </description> </method> <method name="get_format" qualifiers="const"> |