mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
1999 lines
121 KiB
ReStructuredText
1999 lines
121 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_Image:
|
||
|
||
Image
|
||
=====
|
||
|
||
**Eredita:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||
|
||
Tipo di dati d'immagine.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Descrizione
|
||
----------------------
|
||
|
||
Native image datatype. Contains image data which can be converted to an :ref:`ImageTexture<class_ImageTexture>` and provides commonly used *image processing* methods. The maximum width and height for an **Image** are :ref:`MAX_WIDTH<class_Image_constant_MAX_WIDTH>` and :ref:`MAX_HEIGHT<class_Image_constant_MAX_HEIGHT>`.
|
||
|
||
An **Image** cannot be assigned to a texture property of an object directly (such as :ref:`Sprite2D.texture<class_Sprite2D_property_texture>`), and has to be converted manually to an :ref:`ImageTexture<class_ImageTexture>` first.
|
||
|
||
\ **Note:** Methods that modify the image data cannot be used on VRAM-compressed images. Use :ref:`decompress()<class_Image_method_decompress>` to convert the image to an uncompressed format first.
|
||
|
||
\ **Note:** The maximum image size is 16384×16384 pixels due to graphics hardware limitations. Larger images may fail to import.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Tutorial
|
||
----------------
|
||
|
||
- :doc:`Importare immagini <../tutorials/assets_pipeline/importing_images>`
|
||
|
||
- :doc:`Caricamento e salvataggio di file a tempo di esecuzione <../tutorials/io/runtime_file_loading_and_saving>`
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Proprietà
|
||
------------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-------------------------------------+----------------------------------------+------------------------------------------------------------------------------------------------+
|
||
| :ref:`Dictionary<class_Dictionary>` | :ref:`data<class_Image_property_data>` | ``{ "data": PackedByteArray(), "format": "Lum8", "height": 0, "mipmaps": false, "width": 0 }`` |
|
||
+-------------------------------------+----------------------------------------+------------------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Metodi
|
||
------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`adjust_bcs<class_Image_method_adjust_bcs>`\ (\ brightness\: :ref:`float<class_float>`, contrast\: :ref:`float<class_float>`, saturation\: :ref:`float<class_float>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`blend_rect<class_Image_method_blend_rect>`\ (\ src\: :ref:`Image<class_Image>`, src_rect\: :ref:`Rect2i<class_Rect2i>`, dst\: :ref:`Vector2i<class_Vector2i>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`blend_rect_mask<class_Image_method_blend_rect_mask>`\ (\ src\: :ref:`Image<class_Image>`, mask\: :ref:`Image<class_Image>`, src_rect\: :ref:`Rect2i<class_Rect2i>`, dst\: :ref:`Vector2i<class_Vector2i>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`blit_rect<class_Image_method_blit_rect>`\ (\ src\: :ref:`Image<class_Image>`, src_rect\: :ref:`Rect2i<class_Rect2i>`, dst\: :ref:`Vector2i<class_Vector2i>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`blit_rect_mask<class_Image_method_blit_rect_mask>`\ (\ src\: :ref:`Image<class_Image>`, mask\: :ref:`Image<class_Image>`, src_rect\: :ref:`Rect2i<class_Rect2i>`, dst\: :ref:`Vector2i<class_Vector2i>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`bump_map_to_normal_map<class_Image_method_bump_map_to_normal_map>`\ (\ bump_scale\: :ref:`float<class_float>` = 1.0\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`clear_mipmaps<class_Image_method_clear_mipmaps>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`compress<class_Image_method_compress>`\ (\ mode\: :ref:`CompressMode<enum_Image_CompressMode>`, source\: :ref:`CompressSource<enum_Image_CompressSource>` = 0, astc_format\: :ref:`ASTCFormat<enum_Image_ASTCFormat>` = 0\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`compress_from_channels<class_Image_method_compress_from_channels>`\ (\ mode\: :ref:`CompressMode<enum_Image_CompressMode>`, channels\: :ref:`UsedChannels<enum_Image_UsedChannels>`, astc_format\: :ref:`ASTCFormat<enum_Image_ASTCFormat>` = 0\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Dictionary<class_Dictionary>` | :ref:`compute_image_metrics<class_Image_method_compute_image_metrics>`\ (\ compared_image\: :ref:`Image<class_Image>`, use_luma\: :ref:`bool<class_bool>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`convert<class_Image_method_convert>`\ (\ format\: :ref:`Format<enum_Image_Format>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`copy_from<class_Image_method_copy_from>`\ (\ src\: :ref:`Image<class_Image>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Image<class_Image>` | :ref:`create<class_Image_method_create>`\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, use_mipmaps\: :ref:`bool<class_bool>`, format\: :ref:`Format<enum_Image_Format>`\ ) |static| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Image<class_Image>` | :ref:`create_empty<class_Image_method_create_empty>`\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, use_mipmaps\: :ref:`bool<class_bool>`, format\: :ref:`Format<enum_Image_Format>`\ ) |static| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Image<class_Image>` | :ref:`create_from_data<class_Image_method_create_from_data>`\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, use_mipmaps\: :ref:`bool<class_bool>`, format\: :ref:`Format<enum_Image_Format>`, data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`crop<class_Image_method_crop>`\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`decompress<class_Image_method_decompress>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`AlphaMode<enum_Image_AlphaMode>` | :ref:`detect_alpha<class_Image_method_detect_alpha>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`UsedChannels<enum_Image_UsedChannels>` | :ref:`detect_used_channels<class_Image_method_detect_used_channels>`\ (\ source\: :ref:`CompressSource<enum_Image_CompressSource>` = 0\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`fill<class_Image_method_fill>`\ (\ color\: :ref:`Color<class_Color>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`fill_rect<class_Image_method_fill_rect>`\ (\ rect\: :ref:`Rect2i<class_Rect2i>`, color\: :ref:`Color<class_Color>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`fix_alpha_edges<class_Image_method_fix_alpha_edges>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`flip_x<class_Image_method_flip_x>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`flip_y<class_Image_method_flip_y>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`generate_mipmaps<class_Image_method_generate_mipmaps>`\ (\ renormalize\: :ref:`bool<class_bool>` = false\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`get_data<class_Image_method_get_data>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_data_size<class_Image_method_get_data_size>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Format<enum_Image_Format>` | :ref:`get_format<class_Image_method_get_format>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_height<class_Image_method_get_height>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_mipmap_count<class_Image_method_get_mipmap_count>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_mipmap_offset<class_Image_method_get_mipmap_offset>`\ (\ mipmap\: :ref:`int<class_int>`\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`get_pixel<class_Image_method_get_pixel>`\ (\ x\: :ref:`int<class_int>`, y\: :ref:`int<class_int>`\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`get_pixelv<class_Image_method_get_pixelv>`\ (\ point\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Image<class_Image>` | :ref:`get_region<class_Image_method_get_region>`\ (\ region\: :ref:`Rect2i<class_Rect2i>`\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector2i<class_Vector2i>` | :ref:`get_size<class_Image_method_get_size>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Rect2i<class_Rect2i>` | :ref:`get_used_rect<class_Image_method_get_used_rect>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_width<class_Image_method_get_width>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`has_mipmaps<class_Image_method_has_mipmaps>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_compressed<class_Image_method_is_compressed>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_empty<class_Image_method_is_empty>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_invisible<class_Image_method_is_invisible>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`linear_to_srgb<class_Image_method_linear_to_srgb>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load<class_Image_method_load>`\ (\ path\: :ref:`String<class_String>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_bmp_from_buffer<class_Image_method_load_bmp_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_dds_from_buffer<class_Image_method_load_dds_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_exr_from_buffer<class_Image_method_load_exr_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Image<class_Image>` | :ref:`load_from_file<class_Image_method_load_from_file>`\ (\ path\: :ref:`String<class_String>`\ ) |static| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_jpg_from_buffer<class_Image_method_load_jpg_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_ktx_from_buffer<class_Image_method_load_ktx_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_png_from_buffer<class_Image_method_load_png_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_svg_from_buffer<class_Image_method_load_svg_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`, scale\: :ref:`float<class_float>` = 1.0\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_svg_from_string<class_Image_method_load_svg_from_string>`\ (\ svg_str\: :ref:`String<class_String>`, scale\: :ref:`float<class_float>` = 1.0\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_tga_from_buffer<class_Image_method_load_tga_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load_webp_from_buffer<class_Image_method_load_webp_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`normal_map_to_xy<class_Image_method_normal_map_to_xy>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`premultiply_alpha<class_Image_method_premultiply_alpha>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`resize<class_Image_method_resize>`\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, interpolation\: :ref:`Interpolation<enum_Image_Interpolation>` = 1\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`resize_to_po2<class_Image_method_resize_to_po2>`\ (\ square\: :ref:`bool<class_bool>` = false, interpolation\: :ref:`Interpolation<enum_Image_Interpolation>` = 1\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Image<class_Image>` | :ref:`rgbe_to_srgb<class_Image_method_rgbe_to_srgb>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`rotate_90<class_Image_method_rotate_90>`\ (\ direction\: :ref:`ClockDirection<enum_@GlobalScope_ClockDirection>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`rotate_180<class_Image_method_rotate_180>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`save_dds<class_Image_method_save_dds>`\ (\ path\: :ref:`String<class_String>`\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`save_dds_to_buffer<class_Image_method_save_dds_to_buffer>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`save_exr<class_Image_method_save_exr>`\ (\ path\: :ref:`String<class_String>`, grayscale\: :ref:`bool<class_bool>` = false\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`save_exr_to_buffer<class_Image_method_save_exr_to_buffer>`\ (\ grayscale\: :ref:`bool<class_bool>` = false\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`save_jpg<class_Image_method_save_jpg>`\ (\ path\: :ref:`String<class_String>`, quality\: :ref:`float<class_float>` = 0.75\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`save_jpg_to_buffer<class_Image_method_save_jpg_to_buffer>`\ (\ quality\: :ref:`float<class_float>` = 0.75\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`save_png<class_Image_method_save_png>`\ (\ path\: :ref:`String<class_String>`\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`save_png_to_buffer<class_Image_method_save_png_to_buffer>`\ (\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`save_webp<class_Image_method_save_webp>`\ (\ path\: :ref:`String<class_String>`, lossy\: :ref:`bool<class_bool>` = false, quality\: :ref:`float<class_float>` = 0.75\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`save_webp_to_buffer<class_Image_method_save_webp_to_buffer>`\ (\ lossy\: :ref:`bool<class_bool>` = false, quality\: :ref:`float<class_float>` = 0.75\ ) |const| |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_data<class_Image_method_set_data>`\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, use_mipmaps\: :ref:`bool<class_bool>`, format\: :ref:`Format<enum_Image_Format>`, data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_pixel<class_Image_method_set_pixel>`\ (\ x\: :ref:`int<class_int>`, y\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_pixelv<class_Image_method_set_pixelv>`\ (\ point\: :ref:`Vector2i<class_Vector2i>`, color\: :ref:`Color<class_Color>`\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`shrink_x2<class_Image_method_shrink_x2>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`srgb_to_linear<class_Image_method_srgb_to_linear>`\ (\ ) |
|
||
+-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Enumerazioni
|
||
------------------------
|
||
|
||
.. _enum_Image_Format:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **Format**: :ref:`🔗<enum_Image_Format>`
|
||
|
||
.. _class_Image_constant_FORMAT_L8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_L8** = ``0``
|
||
|
||
Formato di texture con una singola profondità di 8 bit che rappresenta la luminanza.
|
||
|
||
.. _class_Image_constant_FORMAT_LA8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_LA8** = ``1``
|
||
|
||
Formato di texture OpenGL con due valori, luminanza e alfa, ciascuno memorizzato con 8 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_R8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_R8** = ``2``
|
||
|
||
Formato di texture OpenGL ``RED`` con un singolo componente di 8 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RG8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RG8** = ``3``
|
||
|
||
Formato di texture OpenGL ``RG`` con due componenti, ciascuno di 8 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RGB8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGB8** = ``4``
|
||
|
||
OpenGL texture format ``RGB`` with three components, each with a bitdepth of 8.
|
||
|
||
\ **Note:** When creating an :ref:`ImageTexture<class_ImageTexture>`, a nonlinear sRGB to linear encoding conversion is performed.
|
||
|
||
.. _class_Image_constant_FORMAT_RGBA8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGBA8** = ``5``
|
||
|
||
OpenGL texture format ``RGBA`` with four components, each with a bitdepth of 8.
|
||
|
||
\ **Note:** When creating an :ref:`ImageTexture<class_ImageTexture>`, a nonlinear sRGB to linear encoding conversion is performed.
|
||
|
||
.. _class_Image_constant_FORMAT_RGBA4444:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGBA4444** = ``6``
|
||
|
||
Formato di texture OpenGL ``RGBA`` con quattro componenti, ciascuno di 8 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RGB565:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGB565** = ``7``
|
||
|
||
Formato di texture OpenGL ``RGB`` con tre componenti. Il rosso e il blu sono di 5 bit, e il verde è di 6 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RF:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RF** = ``8``
|
||
|
||
Formato di texture OpenGL ``GL_R32F`` in cui è presente un solo componente, un valore in virgola mobile di 32 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RGF:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGF** = ``9``
|
||
|
||
Formato di texture OpenGL ``GL_RG32F`` in cui sono presenti due componenti, ciascuno un valore in virgola mobile di 32 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RGBF:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGBF** = ``10``
|
||
|
||
Formato di texture OpenGL ``GL_RGB32F`` in cui sono presenti tre componenti, ciascuno un valore in virgola mobile di 32 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RGBAF:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGBAF** = ``11``
|
||
|
||
Formato di texture OpenGL ``GL_RGBA32F`` in cui sono presenti quattro componenti, ciascuno un valore in virgola mobile di 32 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RH:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RH** = ``12``
|
||
|
||
Formato di texture OpenGL ``GL_R16F`` in cui è presente un solo componente, un valore in virgola mobile "a mezza precisione" di 16 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RGH:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGH** = ``13``
|
||
|
||
Formato di texture OpenGL ``GL_RG16F`` in cui sono presenti due componenti, ciascuno un valore in virgola mobile "a mezza precisione" di 16 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RGBH:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGBH** = ``14``
|
||
|
||
Formato di texture OpenGL ``GL_RGB16F`` in cui sono presenti tre componenti, ciascuno un valore in virgola mobile "a mezza precisione" di 16 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RGBAH:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGBAH** = ``15``
|
||
|
||
Formato di texture OpenGL ``GL_RGBA16F`` in cui sono presenti quattro componenti, ciascuno un valore in virgola mobile "a mezza precisione" di 16 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_RGBE9995:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGBE9995** = ``16``
|
||
|
||
Uno formato speciale di texture OpenGL in cui i tre componenti di colore hanno 9 bit di precisione e tutti e tre condividono un singolo esponente a 5 bit.
|
||
|
||
.. _class_Image_constant_FORMAT_DXT1:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_DXT1** = ``17``
|
||
|
||
The `S3TC <https://en.wikipedia.org/wiki/S3_Texture_Compression>`__ texture format that uses Block Compression 1, and is the smallest variation of S3TC, only providing 1 bit of alpha and color data being premultiplied with alpha.
|
||
|
||
\ **Note:** When creating an :ref:`ImageTexture<class_ImageTexture>`, a nonlinear sRGB to linear encoding conversion is performed.
|
||
|
||
.. _class_Image_constant_FORMAT_DXT3:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_DXT3** = ``18``
|
||
|
||
The `S3TC <https://en.wikipedia.org/wiki/S3_Texture_Compression>`__ texture format that uses Block Compression 2, and color data is interpreted as not having been premultiplied by alpha. Well suited for images with sharp alpha transitions between translucent and opaque areas.
|
||
|
||
\ **Note:** When creating an :ref:`ImageTexture<class_ImageTexture>`, a nonlinear sRGB to linear encoding conversion is performed.
|
||
|
||
.. _class_Image_constant_FORMAT_DXT5:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_DXT5** = ``19``
|
||
|
||
The `S3TC <https://en.wikipedia.org/wiki/S3_Texture_Compression>`__ texture format also known as Block Compression 3 or BC3 that contains 64 bits of alpha channel data followed by 64 bits of DXT1-encoded color data. Color data is not premultiplied by alpha, same as DXT3. DXT5 generally produces superior results for transparent gradients compared to DXT3.
|
||
|
||
\ **Note:** When creating an :ref:`ImageTexture<class_ImageTexture>`, a nonlinear sRGB to linear encoding conversion is performed.
|
||
|
||
.. _class_Image_constant_FORMAT_RGTC_R:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGTC_R** = ``20``
|
||
|
||
Formato di texture che utilizza la `Compressione di texture rosso-verde <https://www.khronos.org/opengl/wiki/Red_Green_Texture_Compression>`__, normalizzando i dati del canale rosso attraverso lo stesso algoritmo di compressione che DXT5 utilizza per il canale alfa.
|
||
|
||
.. _class_Image_constant_FORMAT_RGTC_RG:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGTC_RG** = ``21``
|
||
|
||
Formato di texture che utilizza la `Compressione di texture rosso-verde <https://www.khronos.org/opengl/wiki/Red_Green_Texture_Compression>`__, normalizzando i dati del canale rosso e verde attraverso lo stesso algoritmo di compressione che DXT5 utilizza per il canale alfa.
|
||
|
||
.. _class_Image_constant_FORMAT_BPTC_RGBA:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_BPTC_RGBA** = ``22``
|
||
|
||
Texture format that uses `BPTC <https://www.khronos.org/opengl/wiki/BPTC_Texture_Compression>`__ compression with unsigned normalized RGBA components.
|
||
|
||
\ **Note:** When creating an :ref:`ImageTexture<class_ImageTexture>`, a nonlinear sRGB to linear encoding conversion is performed.
|
||
|
||
.. _class_Image_constant_FORMAT_BPTC_RGBF:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_BPTC_RGBF** = ``23``
|
||
|
||
Formato di texture che utilizza la compressione `BPTC <https://www.khronos.org/opengl/wiki/BPTC_Texture_Compression>`__ con valori in virgola mobile con segno per i componenti RGB.
|
||
|
||
.. _class_Image_constant_FORMAT_BPTC_RGBFU:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_BPTC_RGBFU** = ``24``
|
||
|
||
Formato di texture che utilizza la compressione `BPTC <https://www.khronos.org/opengl/wiki/BPTC_Texture_Compression>`__ con valori in virgola mobile senza segno per i componenti RGB.
|
||
|
||
.. _class_Image_constant_FORMAT_ETC:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ETC** = ``25``
|
||
|
||
`Formato di compressione di texture Ericsson 1 <https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC1>`__, noto anche come "ETC1", e fa parte dello standard grafico OpenGL ES. Questo formato non può memorizzare un canale alfa.
|
||
|
||
.. _class_Image_constant_FORMAT_ETC2_R11:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ETC2_R11** = ``26``
|
||
|
||
`Formato di compressione di texture Ericsson 2 <https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC>`__ (variante ``R11_EAC``), che fornisce un solo canale di dati senza segno.
|
||
|
||
.. _class_Image_constant_FORMAT_ETC2_R11S:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ETC2_R11S** = ``27``
|
||
|
||
`Formato di compressione di texture Ericsson 2 <https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC>`__ (variante ``SIGNED_R11_EAC``), che fornisce un solo canale di dati con segno.
|
||
|
||
.. _class_Image_constant_FORMAT_ETC2_RG11:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ETC2_RG11** = ``28``
|
||
|
||
`Formato di compressione di texture Ericsson 2 <https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC>`__ (variante ``RG11_EAC``), che fornisce un due canali di dati senza segno.
|
||
|
||
.. _class_Image_constant_FORMAT_ETC2_RG11S:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ETC2_RG11S** = ``29``
|
||
|
||
`Formato di compressione di texture Ericsson 2 <https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC>`__ (variante ``SIGNED_RG11_EAC``), che fornisce un due canali di dati con segno.
|
||
|
||
.. _class_Image_constant_FORMAT_ETC2_RGB8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ETC2_RGB8** = ``30``
|
||
|
||
`Ericsson Texture Compression format 2 <https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC>`__ (``RGB8`` variant), which is a follow-up of ETC1 and compresses RGB888 data.
|
||
|
||
\ **Note:** When creating an :ref:`ImageTexture<class_ImageTexture>`, a nonlinear sRGB to linear encoding conversion is performed.
|
||
|
||
.. _class_Image_constant_FORMAT_ETC2_RGBA8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ETC2_RGBA8** = ``31``
|
||
|
||
`Ericsson Texture Compression format 2 <https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC>`__ (``RGBA8``\ variant), which compresses RGBA8888 data with full alpha support.
|
||
|
||
\ **Note:** When creating an :ref:`ImageTexture<class_ImageTexture>`, a nonlinear sRGB to linear encoding conversion is performed.
|
||
|
||
.. _class_Image_constant_FORMAT_ETC2_RGB8A1:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ETC2_RGB8A1** = ``32``
|
||
|
||
`Ericsson Texture Compression format 2 <https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC>`__ (``RGB8_PUNCHTHROUGH_ALPHA1`` variant), which compresses RGBA data to make alpha either fully transparent or fully opaque.
|
||
|
||
\ **Note:** When creating an :ref:`ImageTexture<class_ImageTexture>`, a nonlinear sRGB to linear encoding conversion is performed.
|
||
|
||
.. _class_Image_constant_FORMAT_ETC2_RA_AS_RG:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ETC2_RA_AS_RG** = ``33``
|
||
|
||
`Formato di compressione di texture Ericsson 2 <https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC2_and_EAC>`__ (variante ``RGBA8``), che comprime i dati RA e li interpreta come due canali (rosso e verde). Vedi anche :ref:`FORMAT_ETC2_RGBA8<class_Image_constant_FORMAT_ETC2_RGBA8>`.
|
||
|
||
.. _class_Image_constant_FORMAT_DXT5_RA_AS_RG:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_DXT5_RA_AS_RG** = ``34``
|
||
|
||
Il formato di texture `S3TC <https://en.wikipedia.org/wiki/S3_Texture_Compression>`__, noto anche come Block Compression 3 o BC3, che comprime i dati RA e li interpreta come due canali (rosso e verde). Vedi anche :ref:`FORMAT_DXT5<class_Image_constant_FORMAT_DXT5>`.
|
||
|
||
.. _class_Image_constant_FORMAT_ASTC_4x4:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ASTC_4x4** = ``35``
|
||
|
||
`Compressione adattiva scalabile di texture <https://en.wikipedia.org/wiki/Adaptive_scalable_texture_compression>`__. Ciò implementa la modalità 4×4 (alta qualità).
|
||
|
||
.. _class_Image_constant_FORMAT_ASTC_4x4_HDR:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ASTC_4x4_HDR** = ``36``
|
||
|
||
Stesso formato di :ref:`FORMAT_ASTC_4x4<class_Image_constant_FORMAT_ASTC_4x4>`, ma fa sapere alla GPU che viene utilizzato per l'HDR.
|
||
|
||
.. _class_Image_constant_FORMAT_ASTC_8x8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ASTC_8x8** = ``37``
|
||
|
||
`Adaptive Scalable Texture Compression <https://en.wikipedia.org/wiki/Adaptive_scalable_texture_compression>`__. Ciò implementa la modalità 8×8 (bassa qualità).
|
||
|
||
.. _class_Image_constant_FORMAT_ASTC_8x8_HDR:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_ASTC_8x8_HDR** = ``38``
|
||
|
||
Stesso formato di :ref:`FORMAT_ASTC_8x8<class_Image_constant_FORMAT_ASTC_8x8>`, ma fa sapere alla GPU che viene utilizzato per l'HDR.
|
||
|
||
.. _class_Image_constant_FORMAT_R16:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_R16** = ``39``
|
||
|
||
OpenGL texture format ``GL_R16`` where there's one component, a 16-bit unsigned normalized integer value. Since the value is normalized, each component is clamped between ``0.0`` and ``1.0`` (inclusive).
|
||
|
||
\ **Note:** Due to limited hardware support, it is mainly recommended to be used on desktop or console devices. It may be unsupported on mobile or web, and will consequently be converted to :ref:`FORMAT_RF<class_Image_constant_FORMAT_RF>`.
|
||
|
||
.. _class_Image_constant_FORMAT_RG16:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RG16** = ``40``
|
||
|
||
OpenGL texture format ``GL_RG16`` where there are two components, each a 16-bit unsigned normalized integer value. Since the value is normalized, each component is clamped between ``0.0`` and ``1.0`` (inclusive).
|
||
|
||
\ **Note:** Due to limited hardware support, it is mainly recommended to be used on desktop or console devices. It may be unsupported on mobile or web, and will consequently be converted to :ref:`FORMAT_RGF<class_Image_constant_FORMAT_RGF>`.
|
||
|
||
.. _class_Image_constant_FORMAT_RGB16:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGB16** = ``41``
|
||
|
||
OpenGL texture format ``GL_RGB16`` where there are three components, each a 16-bit unsigned normalized integer value. Since the value is normalized, each component is clamped between ``0.0`` and ``1.0`` (inclusive).
|
||
|
||
\ **Note:** Due to limited hardware support, it is mainly recommended to be used on desktop or console devices. It may be unsupported on mobile or web, and will consequently be converted to :ref:`FORMAT_RGBF<class_Image_constant_FORMAT_RGBF>`.
|
||
|
||
.. _class_Image_constant_FORMAT_RGBA16:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGBA16** = ``42``
|
||
|
||
OpenGL texture format ``GL_RGBA16`` where there are four components, each a 16-bit unsigned normalized integer value. Since the value is normalized, each component is clamped between ``0.0`` and ``1.0`` (inclusive).
|
||
|
||
\ **Note:** Due to limited hardware support, it is mainly recommended to be used on desktop or console devices. It may be unsupported on mobile or web, and will consequently be converted to :ref:`FORMAT_RGBAF<class_Image_constant_FORMAT_RGBAF>`.
|
||
|
||
.. _class_Image_constant_FORMAT_R16I:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_R16I** = ``43``
|
||
|
||
OpenGL texture format ``GL_R16UI`` where there's one component, a 16-bit unsigned integer value. Each component is clamped between ``0`` and ``65535`` (inclusive).
|
||
|
||
\ **Note:** When used in a shader, the texture requires usage of ``usampler`` samplers. Additionally, it only supports nearest-neighbor filtering under the Compatibility renderer.
|
||
|
||
\ **Note:** When sampling using :ref:`get_pixel()<class_Image_method_get_pixel>`, returned :ref:`Color<class_Color>`\ s have to be divided by ``65535`` to get the correct color value.
|
||
|
||
.. _class_Image_constant_FORMAT_RG16I:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RG16I** = ``44``
|
||
|
||
OpenGL texture format ``GL_RG16UI`` where there are two components, each a 16-bit unsigned integer value. Each component is clamped between ``0`` and ``65535`` (inclusive).
|
||
|
||
\ **Note:** When used in a shader, the texture requires usage of ``usampler`` samplers. Additionally, it only supports nearest-neighbor filtering under the Compatibility renderer.
|
||
|
||
\ **Note:** When sampling using :ref:`get_pixel()<class_Image_method_get_pixel>`, returned :ref:`Color<class_Color>`\ s have to be divided by ``65535`` to get the correct color value.
|
||
|
||
.. _class_Image_constant_FORMAT_RGB16I:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGB16I** = ``45``
|
||
|
||
OpenGL texture format ``GL_RGB16UI`` where there are three components, each a 16-bit unsigned integer value. Each component is clamped between ``0`` and ``65535`` (inclusive).
|
||
|
||
\ **Note:** When used in a shader, the texture requires usage of ``usampler`` samplers. Additionally, it only supports nearest-neighbor filtering under the Compatibility renderer.
|
||
|
||
\ **Note:** When sampling using :ref:`get_pixel()<class_Image_method_get_pixel>`, returned :ref:`Color<class_Color>`\ s have to be divided by ``65535`` to get the correct color value.
|
||
|
||
.. _class_Image_constant_FORMAT_RGBA16I:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_RGBA16I** = ``46``
|
||
|
||
OpenGL texture format ``GL_RGBA16UI`` where there are four components, each a 16-bit unsigned integer value. Each component is clamped between ``0`` and ``65535`` (inclusive).
|
||
|
||
\ **Note:** When used in a shader, the texture requires usage of ``usampler`` samplers. Additionally, it only supports nearest-neighbor filtering under the Compatibility renderer.
|
||
|
||
\ **Note:** When sampling using :ref:`get_pixel()<class_Image_method_get_pixel>`, returned :ref:`Color<class_Color>`\ s have to be divided by ``65535`` to get the correct color value.
|
||
|
||
.. _class_Image_constant_FORMAT_MAX:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Format<enum_Image_Format>` **FORMAT_MAX** = ``47``
|
||
|
||
Rappresenta la dimensione dell'enumerazione :ref:`Format<enum_Image_Format>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_Image_Interpolation:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **Interpolation**: :ref:`🔗<enum_Image_Interpolation>`
|
||
|
||
.. _class_Image_constant_INTERPOLATE_NEAREST:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Interpolation<enum_Image_Interpolation>` **INTERPOLATE_NEAREST** = ``0``
|
||
|
||
Effettua l'interpolazione più vicino. Se l'immagine è ridimensionata, sarà pixelata.
|
||
|
||
.. _class_Image_constant_INTERPOLATE_BILINEAR:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Interpolation<enum_Image_Interpolation>` **INTERPOLATE_BILINEAR** = ``1``
|
||
|
||
Effettua l'interpolazione bilineare. Se l'immagine è ridimensionata, sarà sfocata. Questa modalità è più veloce di :ref:`INTERPOLATE_CUBIC<class_Image_constant_INTERPOLATE_CUBIC>`, ma produce risultati inferiori.
|
||
|
||
.. _class_Image_constant_INTERPOLATE_CUBIC:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Interpolation<enum_Image_Interpolation>` **INTERPOLATE_CUBIC** = ``2``
|
||
|
||
Effettua l'interpolazione cubica. Se l'immagine è ridimensionata, sarà sfocata. Questa modalità spesso produce risultati migliori rispetto a :ref:`INTERPOLATE_BILINEAR<class_Image_constant_INTERPOLATE_BILINEAR>`, ma è più lenta.
|
||
|
||
.. _class_Image_constant_INTERPOLATE_TRILINEAR:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Interpolation<enum_Image_Interpolation>` **INTERPOLATE_TRILINEAR** = ``3``
|
||
|
||
Effettua separatamente l'interpolazione bilineare sui due livelli mipmap più adatti, quindi interpola linearmente tra di essi.
|
||
|
||
È più lento di :ref:`INTERPOLATE_BILINEAR<class_Image_constant_INTERPOLATE_BILINEAR>`, ma produce risultati di qualità superiore con molti meno artefatti di aliasing.
|
||
|
||
Se l'immagine non ha mipmap, queste saranno generate e utilizzate internamente, ma nessuna mipmap sarà generata sull'immagine risultante.
|
||
|
||
\ **Nota:** Se si intende ridimensionare più copie dell'immagine originale, è meglio chiamare in anticipo :ref:`generate_mipmaps()<class_Image_method_generate_mipmaps>`] su di essa, per evitare di sprecare tempo di elaborazione generandole più volte.
|
||
|
||
D'altra parte, se l'immagine ha già delle mipmap, queste saranno riutilizzate e sarà generato un nuovo set per l'immagine risultante.
|
||
|
||
.. _class_Image_constant_INTERPOLATE_LANCZOS:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Interpolation<enum_Image_Interpolation>` **INTERPOLATE_LANCZOS** = ``4``
|
||
|
||
Esegue l'interpolazione di Lanczos. Questa è la modalità di ridimensionamento delle immagini più lenta, ma in genere produce i risultati migliori, specialmente quando si rimpiccioliscono le immagini.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_Image_AlphaMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **AlphaMode**: :ref:`🔗<enum_Image_AlphaMode>`
|
||
|
||
.. _class_Image_constant_ALPHA_NONE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`AlphaMode<enum_Image_AlphaMode>` **ALPHA_NONE** = ``0``
|
||
|
||
Image is fully opaque. It does not store alpha data.
|
||
|
||
.. _class_Image_constant_ALPHA_BIT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`AlphaMode<enum_Image_AlphaMode>` **ALPHA_BIT** = ``1``
|
||
|
||
Image stores either fully opaque or fully transparent pixels. Also known as punchthrough alpha.
|
||
|
||
.. _class_Image_constant_ALPHA_BLEND:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`AlphaMode<enum_Image_AlphaMode>` **ALPHA_BLEND** = ``2``
|
||
|
||
Image stores alpha data with values varying between ``0.0`` and ``1.0``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_Image_CompressMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **CompressMode**: :ref:`🔗<enum_Image_CompressMode>`
|
||
|
||
.. _class_Image_constant_COMPRESS_S3TC:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CompressMode<enum_Image_CompressMode>` **COMPRESS_S3TC** = ``0``
|
||
|
||
Utilizza la compressione S3TC.
|
||
|
||
.. _class_Image_constant_COMPRESS_ETC:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CompressMode<enum_Image_CompressMode>` **COMPRESS_ETC** = ``1``
|
||
|
||
Utilizza la compressione ETC.
|
||
|
||
.. _class_Image_constant_COMPRESS_ETC2:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CompressMode<enum_Image_CompressMode>` **COMPRESS_ETC2** = ``2``
|
||
|
||
Utilizza la compressione ETC2.
|
||
|
||
.. _class_Image_constant_COMPRESS_BPTC:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CompressMode<enum_Image_CompressMode>` **COMPRESS_BPTC** = ``3``
|
||
|
||
Utilizza la compressione BPTC.
|
||
|
||
.. _class_Image_constant_COMPRESS_ASTC:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CompressMode<enum_Image_CompressMode>` **COMPRESS_ASTC** = ``4``
|
||
|
||
Utilizza la compressione ASTC.
|
||
|
||
.. _class_Image_constant_COMPRESS_MAX:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CompressMode<enum_Image_CompressMode>` **COMPRESS_MAX** = ``5``
|
||
|
||
Rappresenta la dimensione dell'enumerazione :ref:`CompressMode<enum_Image_CompressMode>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_Image_UsedChannels:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **UsedChannels**: :ref:`🔗<enum_Image_UsedChannels>`
|
||
|
||
.. _class_Image_constant_USED_CHANNELS_L:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`UsedChannels<enum_Image_UsedChannels>` **USED_CHANNELS_L** = ``0``
|
||
|
||
L'immagine utilizza un solo canale per la luminanza (scala di grigi).
|
||
|
||
.. _class_Image_constant_USED_CHANNELS_LA:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`UsedChannels<enum_Image_UsedChannels>` **USED_CHANNELS_LA** = ``1``
|
||
|
||
L'immagine utilizza due canali rispettivamente per la luminanza e per l'alfa.
|
||
|
||
.. _class_Image_constant_USED_CHANNELS_R:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`UsedChannels<enum_Image_UsedChannels>` **USED_CHANNELS_R** = ``2``
|
||
|
||
L'immagine utilizza solo il canale rosso.
|
||
|
||
.. _class_Image_constant_USED_CHANNELS_RG:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`UsedChannels<enum_Image_UsedChannels>` **USED_CHANNELS_RG** = ``3``
|
||
|
||
L'immagine utilizza due canali per il rosso e il verde.
|
||
|
||
.. _class_Image_constant_USED_CHANNELS_RGB:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`UsedChannels<enum_Image_UsedChannels>` **USED_CHANNELS_RGB** = ``4``
|
||
|
||
L'immagine utilizza tre canali per il rosso, il verde e il blu.
|
||
|
||
.. _class_Image_constant_USED_CHANNELS_RGBA:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`UsedChannels<enum_Image_UsedChannels>` **USED_CHANNELS_RGBA** = ``5``
|
||
|
||
L'immagine utilizza quattro canali per il rosso, il verde, il blu e l'alfa.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_Image_CompressSource:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **CompressSource**: :ref:`🔗<enum_Image_CompressSource>`
|
||
|
||
.. _class_Image_constant_COMPRESS_SOURCE_GENERIC:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CompressSource<enum_Image_CompressSource>` **COMPRESS_SOURCE_GENERIC** = ``0``
|
||
|
||
La texture d'origine (prima della compressione) è una texture regolare. Predefinito per tutte le texture.
|
||
|
||
.. _class_Image_constant_COMPRESS_SOURCE_SRGB:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CompressSource<enum_Image_CompressSource>` **COMPRESS_SOURCE_SRGB** = ``1``
|
||
|
||
Source texture (before compression) uses nonlinear sRGB encoding.
|
||
|
||
.. _class_Image_constant_COMPRESS_SOURCE_NORMAL:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`CompressSource<enum_Image_CompressSource>` **COMPRESS_SOURCE_NORMAL** = ``2``
|
||
|
||
La texture d'origine (prima della compressione) è una texture normale (ad esempio può essere compressa in due canali).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_Image_ASTCFormat:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **ASTCFormat**: :ref:`🔗<enum_Image_ASTCFormat>`
|
||
|
||
.. _class_Image_constant_ASTC_FORMAT_4x4:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ASTCFormat<enum_Image_ASTCFormat>` **ASTC_FORMAT_4x4** = ``0``
|
||
|
||
Suggerimento per indicare che è necessario utilizzare il formato di compressione ASTC 4×4 ad alta qualità.
|
||
|
||
.. _class_Image_constant_ASTC_FORMAT_8x8:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ASTCFormat<enum_Image_ASTCFormat>` **ASTC_FORMAT_8x8** = ``1``
|
||
|
||
Suggerimento per indicare che è necessario utilizzare il formato di compressione ASTC 8×8 a bassa qualità.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Costanti
|
||
----------------
|
||
|
||
.. _class_Image_constant_MAX_WIDTH:
|
||
|
||
.. rst-class:: classref-constant
|
||
|
||
**MAX_WIDTH** = ``16777216`` :ref:`🔗<class_Image_constant_MAX_WIDTH>`
|
||
|
||
La larghezza massima consentita per le risorse **Image**.
|
||
|
||
.. _class_Image_constant_MAX_HEIGHT:
|
||
|
||
.. rst-class:: classref-constant
|
||
|
||
**MAX_HEIGHT** = ``16777216`` :ref:`🔗<class_Image_constant_MAX_HEIGHT>`
|
||
|
||
L'altezza massima consentita per le risorse **Image**.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Descrizioni delle proprietà
|
||
------------------------------------------------------
|
||
|
||
.. _class_Image_property_data:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Dictionary<class_Dictionary>` **data** = ``{ "data": PackedByteArray(), "format": "Lum8", "height": 0, "mipmaps": false, "width": 0 }`` :ref:`🔗<class_Image_property_data>`
|
||
|
||
Contiene tutti i dati di colore dell'immagine in un formato specificato. Vedi le costanti di :ref:`Format<enum_Image_Format>`.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Descrizioni dei metodi
|
||
--------------------------------------------
|
||
|
||
.. _class_Image_method_adjust_bcs:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **adjust_bcs**\ (\ brightness\: :ref:`float<class_float>`, contrast\: :ref:`float<class_float>`, saturation\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Image_method_adjust_bcs>`
|
||
|
||
Regola i parametri di luminosità (``brightness``), contrasto (``contrast``) e saturazione (``saturation``) di questa immagine in base ai valori specificati. Non funziona se l'immagine è compressa (vedi :ref:`is_compressed()<class_Image_method_is_compressed>`).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_blend_rect:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **blend_rect**\ (\ src\: :ref:`Image<class_Image>`, src_rect\: :ref:`Rect2i<class_Rect2i>`, dst\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_Image_method_blend_rect>`
|
||
|
||
Fonde (con alpha) la regione ``src_rect`` dell'immagine ``src`` a questa immagine alle coordinate ``dst``, ritagliata adeguatamente a entrambi i limiti dell'immagine. Questa immagine e l'immagine ``src`` **devono** avere lo stesso formato. ``src_rect`` con dimensioni non positive è trattata come vuota.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_blend_rect_mask:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **blend_rect_mask**\ (\ src\: :ref:`Image<class_Image>`, mask\: :ref:`Image<class_Image>`, src_rect\: :ref:`Rect2i<class_Rect2i>`, dst\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_Image_method_blend_rect_mask>`
|
||
|
||
Fonde con alfa la regione ``src_rect`` dall'immagine ``src`` a questa immagine usando la immagine maschera ``mask`` alle coordinate ``dst``, ritagliate in base a entrambi i limiti delle immagini. I canali alfa sono necessari sia per ``src`` sia per ``mask``. I pixel di ``dst`` e ``src`` si fonderanno se il valore alfa del pixel della maschera corrispondente non è 0. Questa immagine e l'immagine ``src`` **devono** avere lo stesso formato. L'immagine ``src`` e l'immagine maschera ``mask`` **devono** avere le stesse dimensioni (larghezza e altezza) ma possono avere formati diversi. ``src_rect`` con dimensioni non positive viene trattato come vuoto.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_blit_rect:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **blit_rect**\ (\ src\: :ref:`Image<class_Image>`, src_rect\: :ref:`Rect2i<class_Rect2i>`, dst\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_Image_method_blit_rect>`
|
||
|
||
Copia la regione ``src_rect`` dall'immagine ``src`` a questa immagine alle coordinate ``dst``, ritagliata in base a entrambi i limiti delle immagini. Questa immagine e l'immagine ``src`` **devono** avere lo stesso formato. ``src_rect`` con dimensioni non positive viene trattato come vuoto.
|
||
|
||
\ **Nota:** I dati del canale alfa in ``src`` sovrascriveranno i dati corrispondenti in questa immagine nella posizione di destinazione. Per fondere i canali alfa, usa invece :ref:`blend_rect()<class_Image_method_blend_rect>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_blit_rect_mask:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **blit_rect_mask**\ (\ src\: :ref:`Image<class_Image>`, mask\: :ref:`Image<class_Image>`, src_rect\: :ref:`Rect2i<class_Rect2i>`, dst\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_Image_method_blit_rect_mask>`
|
||
|
||
Blits la regione ``src_rect`` dall'immagine ``src`` a questa immagine alle coordinate fornite da ``dst``, ritagliata in base a entrambi i limiti dell'immagine. Il pixel ``src`` viene copiato su ``dst`` se il valore alfa del pixel nella maschera ``mask`` corrispondente non è 0. Questa immagine e l'immagine ``src`` **devono** avere lo stesso formato. L'immagine ``src`` e l'immagine maschera ``mask`` **devono** avere le stesse dimensioni (larghezza e altezza) ma possono avere formati diversi. ``src_rect`` con dimensioni non positive viene trattato come vuoto.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_bump_map_to_normal_map:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **bump_map_to_normal_map**\ (\ bump_scale\: :ref:`float<class_float>` = 1.0\ ) :ref:`🔗<class_Image_method_bump_map_to_normal_map>`
|
||
|
||
Converte una mappa di rilievo in una mappa normale. Una mappa di rilievo fornisce un offset di altezza per pixel, mentre una mappa normale fornisce una direzione normale per pixel.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_clear_mipmaps:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **clear_mipmaps**\ (\ ) :ref:`🔗<class_Image_method_clear_mipmaps>`
|
||
|
||
Rimuove i mipmap dell'immagine.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_compress:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **compress**\ (\ mode\: :ref:`CompressMode<enum_Image_CompressMode>`, source\: :ref:`CompressSource<enum_Image_CompressSource>` = 0, astc_format\: :ref:`ASTCFormat<enum_Image_ASTCFormat>` = 0\ ) :ref:`🔗<class_Image_method_compress>`
|
||
|
||
Compresses the image with a VRAM-compressed format to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available.
|
||
|
||
The ``source`` parameter helps to pick the best compression method for DXT and ETC2 formats. It is ignored for ASTC compression.
|
||
|
||
The ``astc_format`` parameter is only taken into account when using ASTC compression; it is ignored for all other formats.
|
||
|
||
\ **Note:** :ref:`compress()<class_Image_method_compress>` is only supported in editor builds. When run in an exported project, this method always returns :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVAILABLE>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_compress_from_channels:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **compress_from_channels**\ (\ mode\: :ref:`CompressMode<enum_Image_CompressMode>`, channels\: :ref:`UsedChannels<enum_Image_UsedChannels>`, astc_format\: :ref:`ASTCFormat<enum_Image_ASTCFormat>` = 0\ ) :ref:`🔗<class_Image_method_compress_from_channels>`
|
||
|
||
Compresses the image with a VRAM-compressed format to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available.
|
||
|
||
This is an alternative to :ref:`compress()<class_Image_method_compress>` that lets the user supply the channels used in order for the compressor to pick the best DXT and ETC2 formats. For other formats (non DXT or ETC2), this argument is ignored.
|
||
|
||
The ``astc_format`` parameter is only taken into account when using ASTC compression; it is ignored for all other formats.
|
||
|
||
\ **Note:** :ref:`compress_from_channels()<class_Image_method_compress_from_channels>` is only supported in editor builds. When run in an exported project, this method always returns :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVAILABLE>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_compute_image_metrics:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Dictionary<class_Dictionary>` **compute_image_metrics**\ (\ compared_image\: :ref:`Image<class_Image>`, use_luma\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_Image_method_compute_image_metrics>`
|
||
|
||
Compute image metrics on the current image and the compared image. This can be used to calculate the similarity between two images.
|
||
|
||
The dictionary contains ``max``, ``mean``, ``mean_squared``, ``root_mean_squared`` and ``peak_snr``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_convert:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **convert**\ (\ format\: :ref:`Format<enum_Image_Format>`\ ) :ref:`🔗<class_Image_method_convert>`
|
||
|
||
Converte il formato di questa immagine al formato ``format``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_copy_from:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **copy_from**\ (\ src\: :ref:`Image<class_Image>`\ ) :ref:`🔗<class_Image_method_copy_from>`
|
||
|
||
Copia l'immagine ``src`` in questa immagine.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_create:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Image<class_Image>` **create**\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, use_mipmaps\: :ref:`bool<class_bool>`, format\: :ref:`Format<enum_Image_Format>`\ ) |static| :ref:`🔗<class_Image_method_create>`
|
||
|
||
**Deprecato:** Use :ref:`create_empty()<class_Image_method_create_empty>`.
|
||
|
||
Creates an empty image of the given size and format. If ``use_mipmaps`` is ``true``, generates mipmaps for this image (see :ref:`generate_mipmaps()<class_Image_method_generate_mipmaps>`).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_create_empty:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Image<class_Image>` **create_empty**\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, use_mipmaps\: :ref:`bool<class_bool>`, format\: :ref:`Format<enum_Image_Format>`\ ) |static| :ref:`🔗<class_Image_method_create_empty>`
|
||
|
||
Creates an empty image of the given size and format. If ``use_mipmaps`` is ``true``, generates mipmaps for this image (see :ref:`generate_mipmaps()<class_Image_method_generate_mipmaps>`).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_create_from_data:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Image<class_Image>` **create_from_data**\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, use_mipmaps\: :ref:`bool<class_bool>`, format\: :ref:`Format<enum_Image_Format>`, data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| :ref:`🔗<class_Image_method_create_from_data>`
|
||
|
||
Crea una nuova immagine di dimensioni e formato specificati. Riempie l'immagine con i dati grezzi specificati. Se ``use_mipmaps`` è ``true``, genera i mipmap per questa immagine da ``data``. Vedi :ref:`generate_mipmaps()<class_Image_method_generate_mipmaps>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_crop:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **crop**\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Image_method_crop>`
|
||
|
||
Ritaglia l'immagine in base ai parametri ``width`` e ``height``. Se le dimensioni specificate sono maggiori delle dimensioni attuali, l'area aggiuntiva viene riempita con pixel neri.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_decompress:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **decompress**\ (\ ) :ref:`🔗<class_Image_method_decompress>`
|
||
|
||
Decompresses the image if it is VRAM-compressed in a supported format. This increases memory utilization, but allows modifying the image. Returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` if the format is supported, otherwise :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVAILABLE>`. All VRAM-compressed formats supported by Godot can be decompressed with this method, except :ref:`FORMAT_ETC2_R11S<class_Image_constant_FORMAT_ETC2_R11S>`, :ref:`FORMAT_ETC2_RG11S<class_Image_constant_FORMAT_ETC2_RG11S>`, and :ref:`FORMAT_ETC2_RGB8A1<class_Image_constant_FORMAT_ETC2_RGB8A1>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_detect_alpha:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`AlphaMode<enum_Image_AlphaMode>` **detect_alpha**\ (\ ) |const| :ref:`🔗<class_Image_method_detect_alpha>`
|
||
|
||
Restituisce :ref:`ALPHA_BLEND<class_Image_constant_ALPHA_BLEND>` se l'immagine ha dati per i valori alfa. Restituisce :ref:`ALPHA_BIT<class_Image_constant_ALPHA_BIT>` se tutti i valori alfa sono memorizzati in un singolo bit. Restituisce :ref:`ALPHA_NONE<class_Image_constant_ALPHA_NONE>` se non sono trovati dati per i valori alfa.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_detect_used_channels:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`UsedChannels<enum_Image_UsedChannels>` **detect_used_channels**\ (\ source\: :ref:`CompressSource<enum_Image_CompressSource>` = 0\ ) |const| :ref:`🔗<class_Image_method_detect_used_channels>`
|
||
|
||
Restituisce i canali colore utilizzati da questa immagine. Se l'immagine è compressa, la sorgente originale (``source``) deve essere specificata.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_fill:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **fill**\ (\ color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Image_method_fill>`
|
||
|
||
Riempie l'immagine con il colore ``color``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_fill_rect:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **fill_rect**\ (\ rect\: :ref:`Rect2i<class_Rect2i>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Image_method_fill_rect>`
|
||
|
||
Riempe il rettangolo ``rect`` con il colore ``color``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_fix_alpha_edges:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **fix_alpha_edges**\ (\ ) :ref:`🔗<class_Image_method_fix_alpha_edges>`
|
||
|
||
Fonde i pixel a bassa opacità con i pixel vicini.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_flip_x:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **flip_x**\ (\ ) :ref:`🔗<class_Image_method_flip_x>`
|
||
|
||
Capovolge l'immagine orizzontalmente.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_flip_y:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **flip_y**\ (\ ) :ref:`🔗<class_Image_method_flip_y>`
|
||
|
||
Capovolge l'immagine verticalmente.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_generate_mipmaps:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **generate_mipmaps**\ (\ renormalize\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_Image_method_generate_mipmaps>`
|
||
|
||
Genera mipmap per l'immagine. Le mipmap sono copie precalcolate a bassa risoluzione dell'immagine che sono utilizzate automaticamente se l'immagine deve essere ridotta durante il rendering. Contribuiscono a migliorare la qualità dell'immagine e le prestazioni durante il rendering. Questo metodo restituisce un errore se l'immagine è compressa, in un formato personalizzato, o se la larghezza o l'altezza dell'immagine è ``0``. Abilitando ``renormalize`` durante la generazione delle mipmap per le texture di mappe normali, tutti i valori vettoriali risultanti saranno normalizzati.
|
||
|
||
È possibile verificare se l'immagine ha mipmap chiamando :ref:`has_mipmaps()<class_Image_method_has_mipmaps>` o :ref:`get_mipmap_count()<class_Image_method_get_mipmap_count>`. Chiamando :ref:`generate_mipmaps()<class_Image_method_generate_mipmaps>` su un'immagine che ha già mipmap, le mipmap esistenti nell'immagine saranno sostituite.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_data:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedByteArray<class_PackedByteArray>` **get_data**\ (\ ) |const| :ref:`🔗<class_Image_method_get_data>`
|
||
|
||
Restituisce una copia dei dati grezzi dell'immagine.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_data_size:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_data_size**\ (\ ) |const| :ref:`🔗<class_Image_method_get_data_size>`
|
||
|
||
Restituisce la dimensione (in byte) dei dati grezzi dell'immagine.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_format:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Format<enum_Image_Format>` **get_format**\ (\ ) |const| :ref:`🔗<class_Image_method_get_format>`
|
||
|
||
Restituisce il formato di questa immagine.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_height:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_height**\ (\ ) |const| :ref:`🔗<class_Image_method_get_height>`
|
||
|
||
Restituisce l'altezza dell'immagine.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_mipmap_count:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_mipmap_count**\ (\ ) |const| :ref:`🔗<class_Image_method_get_mipmap_count>`
|
||
|
||
Restituisce il numero di livelli mipmap o 0 se l'immagine non ha mipmap. L'immagine di livello principale più grande non conta come livello mipmap da questo metodo, quindi se vuoi includerla puoi aggiungere 1 a questo conteggio.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_mipmap_offset:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_mipmap_offset**\ (\ mipmap\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Image_method_get_mipmap_offset>`
|
||
|
||
Restituisce l'offset in cui il mipmap dell'immagine con indice ``mipmap`` è memorizzato nel dizionario :ref:`data<class_Image_property_data>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_pixel:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Color<class_Color>` **get_pixel**\ (\ x\: :ref:`int<class_int>`, y\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Image_method_get_pixel>`
|
||
|
||
Restituisce il colore del pixel in ``(x, y)``.
|
||
|
||
È lo stesso di :ref:`get_pixelv()<class_Image_method_get_pixelv>`, ma con due argomenti interi invece di un argomento :ref:`Vector2i<class_Vector2i>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_pixelv:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Color<class_Color>` **get_pixelv**\ (\ point\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_Image_method_get_pixelv>`
|
||
|
||
Restituisce il colore del pixel nella posizione ``point``.
|
||
|
||
È uguale a :ref:`get_pixel()<class_Image_method_get_pixel>`, ma con un argomento :ref:`Vector2i<class_Vector2i>` invece di due argomenti interi.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_region:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Image<class_Image>` **get_region**\ (\ region\: :ref:`Rect2i<class_Rect2i>`\ ) |const| :ref:`🔗<class_Image_method_get_region>`
|
||
|
||
Restituisce una nuova **Image** che è una copia dell'area di questa **Image** specificata con la regione ``region``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_size:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector2i<class_Vector2i>` **get_size**\ (\ ) |const| :ref:`🔗<class_Image_method_get_size>`
|
||
|
||
Restituisce le dimensioni dell'immagine (larghezza e altezza).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_used_rect:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Rect2i<class_Rect2i>` **get_used_rect**\ (\ ) |const| :ref:`🔗<class_Image_method_get_used_rect>`
|
||
|
||
Restituisce un :ref:`Rect2i<class_Rect2i>` che racchiude la porzione visibile dell'immagine, considerando ogni pixel con un canale alfa diverso da zero come visibile.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_get_width:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_width**\ (\ ) |const| :ref:`🔗<class_Image_method_get_width>`
|
||
|
||
Restituisce la larghezza dell'immagine.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_has_mipmaps:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **has_mipmaps**\ (\ ) |const| :ref:`🔗<class_Image_method_has_mipmaps>`
|
||
|
||
Restituisce ``true`` se l'immagine ha generato mipmap.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_is_compressed:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_compressed**\ (\ ) |const| :ref:`🔗<class_Image_method_is_compressed>`
|
||
|
||
Restituisce ``true`` se l'immagine è compressa.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_is_empty:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_empty**\ (\ ) |const| :ref:`🔗<class_Image_method_is_empty>`
|
||
|
||
Restituisce ``true`` se l'immagine non contiene dati.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_is_invisible:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_invisible**\ (\ ) |const| :ref:`🔗<class_Image_method_is_invisible>`
|
||
|
||
Restituisce ``true`` se tutti i pixel dell'immagine hanno un valore alfa pari a 0. Restituisce ``false`` se un pixel qualsiasi ha un valore alfa superiore a 0.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_linear_to_srgb:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **linear_to_srgb**\ (\ ) :ref:`🔗<class_Image_method_linear_to_srgb>`
|
||
|
||
Converts the entire image from linear encoding to nonlinear sRGB encoding by using a lookup table. Only works on images with :ref:`FORMAT_RGB8<class_Image_constant_FORMAT_RGB8>` or :ref:`FORMAT_RGBA8<class_Image_constant_FORMAT_RGBA8>` formats.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load**\ (\ path\: :ref:`String<class_String>`\ ) :ref:`🔗<class_Image_method_load>`
|
||
|
||
Carica un'immagine dal file al percorso ``path``. Consulta `Formati immagine supportati <../tutorials/assets_pipeline/importing_images.html#supported-image-formats>`__ per un elenco dei formati immagine supportati e delle limitazioni.
|
||
|
||
\ **Attenzione:** Questo metodo dovrebbe essere utilizzato solo nell'editor o nei casi in cui è necessario caricare immagini esterne in fase di esecuzione, come immagini situate nella cartella ``user://``, e potrebbe non funzionare nei progetti esportati.
|
||
|
||
Consulta anche la descrizione di :ref:`ImageTexture<class_ImageTexture>` per esempi d'uso.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_bmp_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_bmp_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_Image_method_load_bmp_from_buffer>`
|
||
|
||
Carica un'immagine dal contenuto binario di un file BMP.
|
||
|
||
\ **Nota:** Il modulo BMP di Godot non supporta immagini a 16 bit per pixel. Sono supportate solo immagini a 1 bit, 4 bit, 8 bit, 24 bit e 32 bit per pixel.
|
||
|
||
\ **Nota:** Questo metodo è disponibile solo nelle build del motore con il modulo BMP abilitato. Per impostazione predefinita, il modulo BMP è abilitato, ma può essere disabilitato in fase di compilazione attraverso l'opzione SCons ``module_bmp_enabled=no``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_dds_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_dds_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_Image_method_load_dds_from_buffer>`
|
||
|
||
Carica un'immagine dal contenuto binario di un file DDS.
|
||
|
||
\ **Nota:** Questo metodo è disponibile solo nelle build del motore con il modulo DDS abilitato. Per impostazione predefinita, il modulo DDS è abilitato, ma può essere disabilitato in fase di compilazione attraverso l'opzione SCons ``module_dds_enabled=no``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_exr_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_exr_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_Image_method_load_exr_from_buffer>`
|
||
|
||
Loads an image from the binary contents of an OpenEXR file.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_from_file:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Image<class_Image>` **load_from_file**\ (\ path\: :ref:`String<class_String>`\ ) |static| :ref:`🔗<class_Image_method_load_from_file>`
|
||
|
||
Crea una nuova **Image** e carica i dati dal file specificato.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_jpg_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_jpg_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_Image_method_load_jpg_from_buffer>`
|
||
|
||
Carica un'immagine dal contenuto binario di un file JPEG.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_ktx_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_ktx_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_Image_method_load_ktx_from_buffer>`
|
||
|
||
Carica un'immagine dal contenuto binario di un file `KTX <https://github.com/KhronosGroup/KTX-Software>`__. A differenza della maggior parte dei formati immagine, KTX può memorizzare dati compressi in VRAM e incorporare mipmap.
|
||
|
||
\ **Nota:** L'implementazione libktx di Godot supporta solo immagini 2D. Cubemap, array di texture e rimozione del padding non sono supportati.
|
||
|
||
\ **Nota:** Questo metodo è disponibile solo nelle build del motore con il modulo KTX abilitato. Per impostazione predefinita, il modulo KTX è abilitato, ma può essere disabilitato in fase di compilazione attraverso l'opzione SCons ``module_ktx_enabled=no``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_png_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_png_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_Image_method_load_png_from_buffer>`
|
||
|
||
Carica un'immagine dal contenuto binario di un file PNG.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_svg_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_svg_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`, scale\: :ref:`float<class_float>` = 1.0\ ) :ref:`🔗<class_Image_method_load_svg_from_buffer>`
|
||
|
||
Carica un'immagine dal contenuto binario UTF-8 di un file SVG **non compresso** (**.svg**).
|
||
|
||
\ **Nota:** Fai attenzione quando usi file SVG compressi (come **.svgz**), devono essere ``decompressi`` prima di essere caricati.
|
||
|
||
\ **Nota:** Questo metodo è disponibile solo nelle build del motore con il modulo SVG abilitato. Per impostazione predefinita, il modulo SVG è abilitato, ma può essere disabilitato in fase di compilazione attraverso l'opzione SCons ``module_svg_enabled=no``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_svg_from_string:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_svg_from_string**\ (\ svg_str\: :ref:`String<class_String>`, scale\: :ref:`float<class_float>` = 1.0\ ) :ref:`🔗<class_Image_method_load_svg_from_string>`
|
||
|
||
Carica un'immagine dal contenuto come stringa di un file SVG (**.svg**).
|
||
|
||
\ **Nota:** Questo metodo è disponibile solo nelle build del motore con il modulo SVG abilitato. Per impostazione predefinita, il modulo SVG è abilitato, ma può essere disabilitato in fase di compilazione attraverso l'opzione SCons ``module_svg_enabled=no``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_tga_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_tga_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_Image_method_load_tga_from_buffer>`
|
||
|
||
Carica un'immagine dal contenuto binario di un file TGA.
|
||
|
||
\ **Nota:** Questo metodo è disponibile solo nelle build del motore con il modulo TGA abilitato. Per impostazione predefinita, il modulo TGA è abilitato, ma può essere disabilitato in fase di compilazione attraverso l'opzione SCons ``module_tga_enabled=no``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_load_webp_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **load_webp_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_Image_method_load_webp_from_buffer>`
|
||
|
||
Carica un'immagine dal contenuto binario di un file WebP.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_normal_map_to_xy:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **normal_map_to_xy**\ (\ ) :ref:`🔗<class_Image_method_normal_map_to_xy>`
|
||
|
||
Converte i dati dell'immagine per rappresentare coordinate su un piano 3D. È utilizzato quando l'immagine rappresenta una mappa normale. Una mappa normale può aggiungere molti dettagli a una superficie 3D senza aumentare il numero di poligoni.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_premultiply_alpha:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **premultiply_alpha**\ (\ ) :ref:`🔗<class_Image_method_premultiply_alpha>`
|
||
|
||
Moltiplica i valori di colore con i valori alfa. I valori di colore risultanti per un pixel sono ``(color * alpha)/256``. Vedi anche :ref:`CanvasItemMaterial.blend_mode<class_CanvasItemMaterial_property_blend_mode>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_resize:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **resize**\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, interpolation\: :ref:`Interpolation<enum_Image_Interpolation>` = 1\ ) :ref:`🔗<class_Image_method_resize>`
|
||
|
||
Ridimensiona l'immagine alla larghezza (``width``) e altezza (``height``) specificate. I nuovi pixel sono calcolati attraverso la modalità d'interpolazione ``interpolation`` definita tramite le costanti di :ref:`Interpolation<enum_Image_Interpolation>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_resize_to_po2:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **resize_to_po2**\ (\ square\: :ref:`bool<class_bool>` = false, interpolation\: :ref:`Interpolation<enum_Image_Interpolation>` = 1\ ) :ref:`🔗<class_Image_method_resize_to_po2>`
|
||
|
||
Ridimensiona l'immagine alla potenza di 2 più vicina per larghezza e altezza. Se ``square`` è ``true`` imposta la larghezza e l'altezza in modo che siano uguali. I nuovi pixel vengono calcolati usando la modalità di interpolazione ``interpolation``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_rgbe_to_srgb:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Image<class_Image>` **rgbe_to_srgb**\ (\ ) :ref:`🔗<class_Image_method_rgbe_to_srgb>`
|
||
|
||
Converts a standard linear RGBE (Red Green Blue Exponent) image to an image that uses nonlinear sRGB encoding.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_rotate_90:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **rotate_90**\ (\ direction\: :ref:`ClockDirection<enum_@GlobalScope_ClockDirection>`\ ) :ref:`🔗<class_Image_method_rotate_90>`
|
||
|
||
Ruota l'immagine nella direzione specificata da ``direction`` di ``90`` gradi. La larghezza e l'altezza dell'immagine devono essere maggiori di ``1``. Se la larghezza e l'altezza non sono uguali, l'immagine verrà ridimensionata.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_rotate_180:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **rotate_180**\ (\ ) :ref:`🔗<class_Image_method_rotate_180>`
|
||
|
||
Ruota l'immagine di ``180`` gradi. La larghezza e l'altezza dell'immagine devono essere maggiori di ``1``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_dds:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **save_dds**\ (\ path\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Image_method_save_dds>`
|
||
|
||
Salva l'immagine come file DDS (DirectDraw Surface) nel percorso ``path``. DDS è un formato contenitore che può memorizzare texture in vari formati di compressione, come DXT1, DXT5 o BC7. Questa funzione restituirà :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVAILABLE>` se Godot è stato compilato senza il modulo DDS.
|
||
|
||
\ **Nota:** Il modulo DDS potrebbe essere disabilitato in certe build, il che significa che :ref:`save_dds()<class_Image_method_save_dds>` restituirà :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVAILABLE>` quando viene chiamato da un progetto esportato.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_dds_to_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedByteArray<class_PackedByteArray>` **save_dds_to_buffer**\ (\ ) |const| :ref:`🔗<class_Image_method_save_dds_to_buffer>`
|
||
|
||
Salva l'immagine come file DDS (DirectDraw Surface) in un array di byte. DDS è un formato contenitore che può memorizzare texture in vari formati di compressione, come DXT1, DXT5 o BC7. Questa funzione restituirà :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVAILABLE>` se Godot è stato compilato senza il modulo DDS.
|
||
|
||
\ **Nota:** Il modulo DDS potrebbe essere disabilitato in certe build, il che significa che :ref:`save_dds_to_buffer()<class_Image_method_save_dds_to_buffer>` restituirà :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVAILABLE>` quando viene chiamato da un progetto esportato.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_exr:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **save_exr**\ (\ path\: :ref:`String<class_String>`, grayscale\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Image_method_save_exr>`
|
||
|
||
Saves the image as an EXR file to ``path``. If ``grayscale`` is ``true`` and the image has only one channel, it will be saved explicitly as monochrome rather than one red channel. This function will return :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVAILABLE>` if Godot was compiled without the TinyEXR module.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_exr_to_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedByteArray<class_PackedByteArray>` **save_exr_to_buffer**\ (\ grayscale\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Image_method_save_exr_to_buffer>`
|
||
|
||
Saves the image as an EXR file to a byte array. If ``grayscale`` is ``true`` and the image has only one channel, it will be saved explicitly as monochrome rather than one red channel. This function will return an empty byte array if Godot was compiled without the TinyEXR module.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_jpg:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **save_jpg**\ (\ path\: :ref:`String<class_String>`, quality\: :ref:`float<class_float>` = 0.75\ ) |const| :ref:`🔗<class_Image_method_save_jpg>`
|
||
|
||
Salva l'immagine come file JPEG nel percorso ``path`` con la qualità ``quality`` specificata tra ``0.01`` e ``1.0`` (inclusi). Valori di ``quality`` più alti producono un aspetto migliore a costo di file più grandi. I valori ``quality`` consigliati sono compresi tra ``0.75`` e ``0.90``. Anche con una qualità di ``1.00``, la compressione JPEG rimane lossy.
|
||
|
||
\ **Nota:** JPEG non salva un canale alfa. Se l'**Image** contiene un canale alfa, l'immagine sarà comunque salvata, ma il file JPEG risultante non conterrà il canale alfa.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_jpg_to_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedByteArray<class_PackedByteArray>` **save_jpg_to_buffer**\ (\ quality\: :ref:`float<class_float>` = 0.75\ ) |const| :ref:`🔗<class_Image_method_save_jpg_to_buffer>`
|
||
|
||
Salva l'immagine come file JPEG in un array di byte con la qualità ``quality`` specificata tra ``0.01`` e ``1.0`` (inclusi). Valori di ``quality`` più alti producono un aspetto migliore a costo di array di byte più grandi (e quindi più memoria). I valori ``quality`` consigliati sono compresi tra ``0.75`` e ``0.90``. Anche con una qualità di ``1.00``, la compressione JPEG rimane lossy.
|
||
|
||
\ **Nota:** JPEG non salva un canale alfa. Se l'**Image** contiene un canale alfa, l'immagine sarà comunque salvata, ma l'array di byte risultante non conterrà il canale alfa.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_png:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **save_png**\ (\ path\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Image_method_save_png>`
|
||
|
||
Salva l'immagine come file PNG nel file nel percorso ``path``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_png_to_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedByteArray<class_PackedByteArray>` **save_png_to_buffer**\ (\ ) |const| :ref:`🔗<class_Image_method_save_png_to_buffer>`
|
||
|
||
Salva l'immagine come file PNG in un array di byte.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_webp:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Error<enum_@GlobalScope_Error>` **save_webp**\ (\ path\: :ref:`String<class_String>`, lossy\: :ref:`bool<class_bool>` = false, quality\: :ref:`float<class_float>` = 0.75\ ) |const| :ref:`🔗<class_Image_method_save_webp>`
|
||
|
||
Salva l'immagine come file WebP (Web Picture) nel percorso ``path``. Per impostazione predefinita, salva senza perdita di dati. Se ``lossy`` è ``true``, l'immagine sarà salvata con perdita di dati, utilizzando la qualità ``quality`` tra ``0.0`` e ``1.0`` (inclusi). WebP senza perdita offre una compressione più efficiente di PNG.
|
||
|
||
\ **Nota:** Il formato WebP è limitato a una dimensione di 16383×16383 pixel, mentre PNG può salvare immagini più grandi.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_save_webp_to_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedByteArray<class_PackedByteArray>` **save_webp_to_buffer**\ (\ lossy\: :ref:`bool<class_bool>` = false, quality\: :ref:`float<class_float>` = 0.75\ ) |const| :ref:`🔗<class_Image_method_save_webp_to_buffer>`
|
||
|
||
Salva l'immagine come file WebP (Web Picture) in un array di byte. Per impostazione predefinita, salva senza perdita di dati. Se ``lossy`` è ``true``, l'immagine sarà salvata con perdita di dati, utilizzando la qualità ``quality`` tra ``0.0`` e ``1.0`` (inclusi). WebP senza perdita offre una compressione più efficiente di PNG.
|
||
|
||
\ **Nota:** Il formato WebP è limitato a una dimensione di 16383×16383 pixel, mentre PNG può salvare immagini più grandi.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_set_data:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_data**\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`, use_mipmaps\: :ref:`bool<class_bool>`, format\: :ref:`Format<enum_Image_Format>`, data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_Image_method_set_data>`
|
||
|
||
Sovrascrive i dati di un'**Image** esistente. Equivalente non statico di :ref:`create_from_data()<class_Image_method_create_from_data>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_set_pixel:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_pixel**\ (\ x\: :ref:`int<class_int>`, y\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Image_method_set_pixel>`
|
||
|
||
Sets the :ref:`Color<class_Color>` of the pixel at ``(x, y)`` to ``color``.
|
||
|
||
|
||
.. tabs::
|
||
|
||
.. code-tab:: gdscript
|
||
|
||
var img_width = 10
|
||
var img_height = 5
|
||
var img = Image.create(img_width, img_height, false, Image.FORMAT_RGBA8)
|
||
|
||
img.set_pixel(1, 2, Color.RED) # Sets the color at (1, 2) to red.
|
||
|
||
.. code-tab:: csharp
|
||
|
||
int imgWidth = 10;
|
||
int imgHeight = 5;
|
||
var img = Image.Create(imgWidth, imgHeight, false, Image.Format.Rgba8);
|
||
|
||
img.SetPixel(1, 2, Colors.Red); // Sets the color at (1, 2) to red.
|
||
|
||
|
||
|
||
This is the same as :ref:`set_pixelv()<class_Image_method_set_pixelv>`, but with a two integer arguments instead of a :ref:`Vector2i<class_Vector2i>` argument.
|
||
|
||
\ **Note:** Depending on the image's format, the color set here may be clamped or lose precision. Do not assume the color returned by :ref:`get_pixel()<class_Image_method_get_pixel>` to be identical to the one set here; any comparisons will likely need to use an approximation like :ref:`Color.is_equal_approx()<class_Color_method_is_equal_approx>`.
|
||
|
||
\ **Note:** On grayscale image formats, only the red channel of ``color`` is used (and alpha if relevant). The green and blue channels are ignored.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_set_pixelv:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_pixelv**\ (\ point\: :ref:`Vector2i<class_Vector2i>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Image_method_set_pixelv>`
|
||
|
||
Sets the :ref:`Color<class_Color>` of the pixel at ``point`` to ``color``.
|
||
|
||
|
||
.. tabs::
|
||
|
||
.. code-tab:: gdscript
|
||
|
||
var img_width = 10
|
||
var img_height = 5
|
||
var img = Image.create(img_width, img_height, false, Image.FORMAT_RGBA8)
|
||
|
||
img.set_pixelv(Vector2i(1, 2), Color.RED) # Sets the color at (1, 2) to red.
|
||
|
||
.. code-tab:: csharp
|
||
|
||
int imgWidth = 10;
|
||
int imgHeight = 5;
|
||
var img = Image.Create(imgWidth, imgHeight, false, Image.Format.Rgba8);
|
||
|
||
img.SetPixelv(new Vector2I(1, 2), Colors.Red); // Sets the color at (1, 2) to red.
|
||
|
||
|
||
|
||
This is the same as :ref:`set_pixel()<class_Image_method_set_pixel>`, but with a :ref:`Vector2i<class_Vector2i>` argument instead of two integer arguments.
|
||
|
||
\ **Note:** Depending on the image's format, the color set here may be clamped or lose precision. Do not assume the color returned by :ref:`get_pixelv()<class_Image_method_get_pixelv>` to be identical to the one set here; any comparisons will likely need to use an approximation like :ref:`Color.is_equal_approx()<class_Color_method_is_equal_approx>`.
|
||
|
||
\ **Note:** On grayscale image formats, only the red channel of ``color`` is used (and alpha if relevant). The green and blue channels are ignored.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_shrink_x2:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **shrink_x2**\ (\ ) :ref:`🔗<class_Image_method_shrink_x2>`
|
||
|
||
Rimpicciolisce l'immagine di un fattore 2 su ciascun asse (ciò divide il numero di pixel per 4).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Image_method_srgb_to_linear:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **srgb_to_linear**\ (\ ) :ref:`🔗<class_Image_method_srgb_to_linear>`
|
||
|
||
Converts the raw data from nonlinear sRGB encoding to linear encoding using a lookup table. Only works on images with :ref:`FORMAT_RGB8<class_Image_constant_FORMAT_RGB8>` or :ref:`FORMAT_RGBA8<class_Image_constant_FORMAT_RGBA8>` formats.
|
||
|
||
\ **Note:** The 8-bit formats required by this method are not suitable for storing linearly encoded values; a significant amount of color information will be lost in darker values. To maintain image quality, this method should not be used.
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (Questo metodo dovrebbe solitamente essere sovrascritto dall'utente per aver un effetto.)`
|
||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||
.. |const| replace:: :abbr:`const (Questo metodo non ha effetti collaterali. Non modifica alcuna variabile appartenente all'istanza.)`
|
||
.. |vararg| replace:: :abbr:`vararg (Questo metodo accetta qualsiasi numero di argomenti oltre a quelli descritti qui.)`
|
||
.. |constructor| replace:: :abbr:`constructor (Questo metodo è utilizzato per creare un tipo.)`
|
||
.. |static| replace:: :abbr:`static (Questo metodo non necessita di alcun'istanza per essere chiamato, quindi può essere chiamato direttamente usando il nome della classe.)`
|
||
.. |operator| replace:: :abbr:`operator (Questo metodo descrive un operatore valido da usare con questo tipo come operando di sinistra.)`
|
||
.. |bitfield| replace:: :abbr:`BitField (Questo valore è un intero composto da una maschera di bit dei seguenti flag.)`
|
||
.. |void| replace:: :abbr:`void (Nessun valore restituito.)`
|