Merge pull request #84844 from Calinou/doc-runtime-loading-image

Link to runtime loading/saving tutorial and improve Image documentation
This commit is contained in:
Rémi Verschelde 2023-11-14 12:17:31 +01:00
commit 70ec97aadf
No known key found for this signature in database
GPG key ID: C3336907360768E1
24 changed files with 37 additions and 7 deletions

View file

@ -8,6 +8,7 @@
This class can also be used to store dynamically-generated PCM audio data. See also [AudioStreamGenerator] for procedural audio generation.
</description>
<tutorials>
<link title="Runtime file loading and saving">$DOCS_URL/tutorials/io/runtime_file_loading_and_saving.html</link>
</tutorials>
<methods>
<method name="save_to_wav">

View file

@ -39,6 +39,7 @@
</description>
<tutorials>
<link title="File system">$DOCS_URL/tutorials/scripting/filesystem.html</link>
<link title="Runtime file loading and saving">$DOCS_URL/tutorials/io/runtime_file_loading_and_saving.html</link>
<link title="3D Voxel Demo">https://godotengine.org/asset-library/asset/676</link>
</tutorials>
<methods>

View file

@ -28,6 +28,7 @@
[/codeblocks]
</description>
<tutorials>
<link title="Runtime file loading and saving">$DOCS_URL/tutorials/io/runtime_file_loading_and_saving.html</link>
</tutorials>
<methods>
<method name="clear_cache">

View file

@ -10,6 +10,7 @@
</description>
<tutorials>
<link title="Importing images">$DOCS_URL/tutorials/assets_pipeline/importing_images.html</link>
<link title="Runtime file loading and saving">$DOCS_URL/tutorials/io/runtime_file_loading_and_saving.html</link>
</tutorials>
<methods>
<method name="adjust_bcs">
@ -201,8 +202,8 @@
<return type="int" enum="Error" />
<param index="0" name="renormalize" type="bool" default="false" />
<description>
Generates mipmaps for the image. Mipmaps are precalculated lower-resolution copies of the image that are automatically used if the image needs to be scaled down when rendered. They help improve image quality and performance when rendering. This method returns an error if the image is compressed, in a custom format, or if the image's width/height is [code]0[/code]. Enabling [param renormalize] when generating mipmaps for normal textures will make sure all resulting vector values are normalized.
It is possible to check if the image has mipmaps by calling [method has_mipmaps] or [method get_mipmap_count].
Generates mipmaps for the image. Mipmaps are precalculated lower-resolution copies of the image that are automatically used if the image needs to be scaled down when rendered. They help improve image quality and performance when rendering. This method returns an error if the image is compressed, in a custom format, or if the image's width/height is [code]0[/code]. Enabling [param renormalize] when generating mipmaps for normal map textures will make sure all resulting vector values are normalized.
It is possible to check if the image has mipmaps by calling [method has_mipmaps] or [method get_mipmap_count]. Calling [method generate_mipmaps] on an image that already has mipmaps will replace existing mipmaps in the image.
</description>
</method>
<method name="get_data" qualifiers="const">
@ -317,6 +318,7 @@
<description>
Loads an image from the binary contents of a BMP file.
[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.
[b]Note:[/b] This method is only available in engine builds with the BMP module enabled. By default, the BMP module is enabled, but it can be disabled at build-time using the [code]module_bmp_enabled=no[/code] SCons option.
</description>
</method>
<method name="load_from_file" qualifiers="static">
@ -337,7 +339,9 @@
<return type="int" enum="Error" />
<param index="0" name="buffer" type="PackedByteArray" />
<description>
Loads an image from the binary contents of a KTX file.
Loads an image from the binary contents of a [url=https://github.com/KhronosGroup/KTX-Software]KTX[/url] file. Unlike most image formats, KTX can store VRAM-compressed data and embed mipmaps.
[b]Note:[/b] Godot's libktx implementation only supports 2D images. Cubemaps, texture arrays, and de-padding are not supported.
[b]Note:[/b] This method is only available in engine builds with the KTX module enabled. By default, the KTX module is enabled, but it can be disabled at build-time using the [code]module_ktx_enabled=no[/code] SCons option.
</description>
</method>
<method name="load_png_from_buffer">
@ -371,6 +375,7 @@
<param index="0" name="buffer" type="PackedByteArray" />
<description>
Loads an image from the binary contents of a TGA file.
[b]Note:[/b] This method is only available in engine builds with the TGA module enabled. By default, the TGA module is enabled, but it can be disabled at build-time using the [code]module_tga_enabled=no[/code] SCons option.
</description>
</method>
<method name="load_webp_from_buffer">
@ -389,7 +394,7 @@
<method name="premultiply_alpha">
<return type="void" />
<description>
Multiplies color values with alpha values. Resulting color values for a pixel are [code](color * alpha)/256[/code].
Multiplies color values with alpha values. Resulting color values for a pixel are [code](color * alpha)/256[/code]. See also [member CanvasItemMaterial.blend_mode].
</description>
</method>
<method name="resize">
@ -481,7 +486,8 @@
<param index="1" name="lossy" type="bool" default="false" />
<param index="2" name="quality" type="float" default="0.75" />
<description>
Saves the image as a WebP (Web Picture) file to the file at [param path]. By default it will save lossless. If [param lossy] is true, the image will be saved lossy, using the [param quality] setting between 0.0 and 1.0 (inclusive).
Saves the image as a WebP (Web Picture) file to the file at [param path]. By default it will save lossless. If [param lossy] is true, the image will be saved lossy, using the [param quality] setting between 0.0 and 1.0 (inclusive). Lossless WebP offers more efficient compression than PNG.
[b]Note:[/b] The WebP format is limited to a size of 16383×16383 pixels, while PNG can save larger images.
</description>
</method>
<method name="save_webp_to_buffer" qualifiers="const">
@ -489,7 +495,8 @@
<param index="0" name="lossy" type="bool" default="false" />
<param index="1" name="quality" type="float" default="0.75" />
<description>
Saves the image as a WebP (Web Picture) file to a byte array. By default it will save lossless. If [param lossy] is true, the image will be saved lossy, using the [param quality] setting between 0.0 and 1.0 (inclusive).
Saves the image as a WebP (Web Picture) file to a byte array. By default it will save lossless. If [param lossy] is true, the image will be saved lossy, using the [param quality] setting between 0.0 and 1.0 (inclusive). Lossless WebP offers more efficient compression than PNG.
[b]Note:[/b] The WebP format is limited to a size of 16383×16383 pixels, while PNG can save larger images.
</description>
</method>
<method name="set_data">
@ -559,7 +566,7 @@
<method name="shrink_x2">
<return type="void" />
<description>
Shrinks the image by a factor of 2.
Shrinks the image by a factor of 2 on each axis (this divides the pixel count by 4).
</description>
</method>
<method name="srgb_to_linear">

View file

@ -8,6 +8,7 @@
</description>
<tutorials>
<link title="Playing videos">$DOCS_URL/tutorials/animation/playing_videos.html</link>
<link title="Runtime file loading and saving">$DOCS_URL/tutorials/io/runtime_file_loading_and_saving.html</link>
</tutorials>
<methods>
<method name="_instantiate_playback" qualifiers="virtual">