mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 19:29:06 +00:00
341 lines
29 KiB
ReStructuredText
341 lines
29 KiB
ReStructuredText
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
|
|
|
|
.. _class_Image:
|
|
|
|
Image
|
|
=====
|
|
|
|
**Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
|
|
|
|
**Category:** Core
|
|
|
|
Brief Description
|
|
-----------------
|
|
|
|
Image datatype.
|
|
|
|
Member Functions
|
|
----------------
|
|
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`blit_rect<class_Image_blit_rect>` **(** :ref:`Image<class_image>` src, :ref:`Rect2<class_rect2>` src_rect, :ref:`Vector2<class_vector2>` dst **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`clear_mipmaps<class_Image_clear_mipmaps>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`compress<class_Image_compress>` **(** :ref:`int<class_int>` mode, :ref:`int<class_int>` arg1, :ref:`float<class_float>` arg2 **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`convert<class_Image_convert>` **(** :ref:`int<class_int>` format **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`copy_from<class_Image_copy_from>` **(** :ref:`Image<class_image>` src **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`create<class_Image_create>` **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`bool<class_bool>` use_mipmaps, :ref:`int<class_int>` format **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`create_from_data<class_Image_create_from_data>` **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`bool<class_bool>` use_mipmaps, :ref:`int<class_int>` format, :ref:`PoolByteArray<class_poolbytearray>` data **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`crop<class_Image_crop>` **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`decompress<class_Image_decompress>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`detect_alpha<class_Image_detect_alpha>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`expand_x2_hq2x<class_Image_expand_x2_hq2x>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`fix_alpha_edges<class_Image_fix_alpha_edges>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`flip_x<class_Image_flip_x>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`flip_y<class_Image_flip_y>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`generate_mipmaps<class_Image_generate_mipmaps>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolByteArray<class_poolbytearray>` | :ref:`get_data<class_Image_get_data>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_format<class_Image_get_format>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_height<class_Image_get_height>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_mipmap_offset<class_Image_get_mipmap_offset>` **(** :ref:`int<class_int>` mipmap **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Color<class_color>` | :ref:`get_pixel<class_Image_get_pixel>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Image<class_image>` | :ref:`get_rect<class_Image_get_rect>` **(** :ref:`Rect2<class_rect2>` rect **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Rect2<class_rect2>` | :ref:`get_used_rect<class_Image_get_used_rect>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_width<class_Image_get_width>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_mipmaps<class_Image_has_mipmaps>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_compressed<class_Image_is_compressed>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_empty<class_Image_is_empty>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_invisible<class_Image_is_invisible>` **(** **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`load<class_Image_load>` **(** :ref:`String<class_string>` path **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`lock<class_Image_lock>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`normalmap_to_xy<class_Image_normalmap_to_xy>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`premultiply_alpha<class_Image_premultiply_alpha>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`put_pixel<class_Image_put_pixel>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`Color<class_color>` color **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`resize<class_Image_resize>` **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`int<class_int>` interpolation=1 **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`resize_to_po2<class_Image_resize_to_po2>` **(** :ref:`bool<class_bool>` square="false" **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`save_png<class_Image_save_png>` **(** :ref:`String<class_string>` path **)** const |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`shrink_x2<class_Image_shrink_x2>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`srgb_to_linear<class_Image_srgb_to_linear>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`unlock<class_Image_unlock>` **(** **)** |
|
|
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Member Variables
|
|
----------------
|
|
|
|
- :ref:`Dictionary<class_dictionary>` **data**
|
|
|
|
Numeric Constants
|
|
-----------------
|
|
|
|
- **FORMAT_L8** = **0**
|
|
- **FORMAT_LA8** = **1**
|
|
- **FORMAT_R8** = **2**
|
|
- **FORMAT_RG8** = **3**
|
|
- **FORMAT_RGB8** = **4**
|
|
- **FORMAT_RGBA8** = **5**
|
|
- **FORMAT_RGBA4444** = **6**
|
|
- **FORMAT_RGBA5551** = **7**
|
|
- **FORMAT_RF** = **8**
|
|
- **FORMAT_RGF** = **9**
|
|
- **FORMAT_RGBF** = **10**
|
|
- **FORMAT_RGBAF** = **11**
|
|
- **FORMAT_RH** = **12**
|
|
- **FORMAT_RGH** = **13**
|
|
- **FORMAT_RGBH** = **14**
|
|
- **FORMAT_RGBAH** = **15**
|
|
- **FORMAT_RGBE9995** = **16**
|
|
- **FORMAT_DXT1** = **17**
|
|
- **FORMAT_DXT3** = **18**
|
|
- **FORMAT_DXT5** = **19**
|
|
- **FORMAT_RGTC_R** = **20**
|
|
- **FORMAT_RGTC_RG** = **21**
|
|
- **FORMAT_BPTC_RGBA** = **22**
|
|
- **FORMAT_BPTC_RGBF** = **23**
|
|
- **FORMAT_BPTC_RGBFU** = **24**
|
|
- **FORMAT_PVRTC2** = **25**
|
|
- **FORMAT_PVRTC2A** = **26**
|
|
- **FORMAT_PVRTC4** = **27**
|
|
- **FORMAT_PVRTC4A** = **28**
|
|
- **FORMAT_ETC** = **29**
|
|
- **FORMAT_ETC2_R11** = **30**
|
|
- **FORMAT_ETC2_R11S** = **31**
|
|
- **FORMAT_ETC2_RG11** = **32**
|
|
- **FORMAT_ETC2_RG11S** = **33**
|
|
- **FORMAT_ETC2_RGB8** = **34**
|
|
- **FORMAT_ETC2_RGBA8** = **35**
|
|
- **FORMAT_ETC2_RGB8A1** = **36**
|
|
- **FORMAT_MAX** = **37**
|
|
- **INTERPOLATE_NEAREST** = **0**
|
|
- **INTERPOLATE_BILINEAR** = **1**
|
|
- **INTERPOLATE_CUBIC** = **2**
|
|
- **ALPHA_NONE** = **0**
|
|
- **ALPHA_BIT** = **1**
|
|
- **ALPHA_BLEND** = **2**
|
|
- **COMPRESS_S3TC** = **0**
|
|
- **COMPRESS_PVRTC2** = **1**
|
|
- **COMPRESS_PVRTC4** = **2**
|
|
- **COMPRESS_ETC** = **3**
|
|
- **COMPRESS_ETC2** = **4**
|
|
- **COMPRESS_SOURCE_GENERIC** = **0**
|
|
- **COMPRESS_SOURCE_SRGB** = **1**
|
|
- **COMPRESS_SOURCE_NORMAL** = **2**
|
|
|
|
Description
|
|
-----------
|
|
|
|
Native image datatype. Contains image data, which can be converted to a texture, and several functions to interact with it.
|
|
|
|
Member Function Description
|
|
---------------------------
|
|
|
|
.. _class_Image_blit_rect:
|
|
|
|
- void **blit_rect** **(** :ref:`Image<class_image>` src, :ref:`Rect2<class_rect2>` src_rect, :ref:`Vector2<class_vector2>` dst **)**
|
|
|
|
Copy a "src_rect" :ref:`Rect2<class_rect2>` from "src" :ref:`Image<class_image>` to this :ref:`Image<class_image>` on coordinates "dest".
|
|
|
|
.. _class_Image_clear_mipmaps:
|
|
|
|
- void **clear_mipmaps** **(** **)**
|
|
|
|
.. _class_Image_compress:
|
|
|
|
- :ref:`int<class_int>` **compress** **(** :ref:`int<class_int>` mode, :ref:`int<class_int>` arg1, :ref:`float<class_float>` arg2 **)**
|
|
|
|
.. _class_Image_convert:
|
|
|
|
- void **convert** **(** :ref:`int<class_int>` format **)**
|
|
|
|
.. _class_Image_copy_from:
|
|
|
|
- void **copy_from** **(** :ref:`Image<class_image>` src **)**
|
|
|
|
.. _class_Image_create:
|
|
|
|
- void **create** **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`bool<class_bool>` use_mipmaps, :ref:`int<class_int>` format **)**
|
|
|
|
Create an empty image of a specific size and format.
|
|
|
|
.. _class_Image_create_from_data:
|
|
|
|
- void **create_from_data** **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`bool<class_bool>` use_mipmaps, :ref:`int<class_int>` format, :ref:`PoolByteArray<class_poolbytearray>` data **)**
|
|
|
|
.. _class_Image_crop:
|
|
|
|
- void **crop** **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height **)**
|
|
|
|
.. _class_Image_decompress:
|
|
|
|
- :ref:`int<class_int>` **decompress** **(** **)**
|
|
|
|
.. _class_Image_detect_alpha:
|
|
|
|
- :ref:`int<class_int>` **detect_alpha** **(** **)** const
|
|
|
|
.. _class_Image_expand_x2_hq2x:
|
|
|
|
- void **expand_x2_hq2x** **(** **)**
|
|
|
|
.. _class_Image_fix_alpha_edges:
|
|
|
|
- void **fix_alpha_edges** **(** **)**
|
|
|
|
.. _class_Image_flip_x:
|
|
|
|
- void **flip_x** **(** **)**
|
|
|
|
.. _class_Image_flip_y:
|
|
|
|
- void **flip_y** **(** **)**
|
|
|
|
.. _class_Image_generate_mipmaps:
|
|
|
|
- :ref:`int<class_int>` **generate_mipmaps** **(** **)**
|
|
|
|
.. _class_Image_get_data:
|
|
|
|
- :ref:`PoolByteArray<class_poolbytearray>` **get_data** **(** **)** const
|
|
|
|
Return the raw data of the :ref:`Image<class_image>`.
|
|
|
|
.. _class_Image_get_format:
|
|
|
|
- :ref:`int<class_int>` **get_format** **(** **)** const
|
|
|
|
Return the format of the :ref:`Image<class_image>`, one of :ref:`Image<class_image>`.FORMAT\_\*.
|
|
|
|
.. _class_Image_get_height:
|
|
|
|
- :ref:`int<class_int>` **get_height** **(** **)** const
|
|
|
|
Return the height of the :ref:`Image<class_image>`.
|
|
|
|
.. _class_Image_get_mipmap_offset:
|
|
|
|
- :ref:`int<class_int>` **get_mipmap_offset** **(** :ref:`int<class_int>` mipmap **)** const
|
|
|
|
.. _class_Image_get_pixel:
|
|
|
|
- :ref:`Color<class_color>` **get_pixel** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
|
|
|
|
.. _class_Image_get_rect:
|
|
|
|
- :ref:`Image<class_image>` **get_rect** **(** :ref:`Rect2<class_rect2>` rect **)** const
|
|
|
|
Return a new :ref:`Image<class_image>` that is a copy of "area" in this :ref:`Image<class_image>`.
|
|
|
|
.. _class_Image_get_used_rect:
|
|
|
|
- :ref:`Rect2<class_rect2>` **get_used_rect** **(** **)** const
|
|
|
|
Return the area of this :ref:`Image<class_image>` that is used/visibly colored/opaque.
|
|
|
|
.. _class_Image_get_width:
|
|
|
|
- :ref:`int<class_int>` **get_width** **(** **)** const
|
|
|
|
Return the width of the :ref:`Image<class_image>`.
|
|
|
|
.. _class_Image_has_mipmaps:
|
|
|
|
- :ref:`bool<class_bool>` **has_mipmaps** **(** **)** const
|
|
|
|
.. _class_Image_is_compressed:
|
|
|
|
- :ref:`bool<class_bool>` **is_compressed** **(** **)** const
|
|
|
|
.. _class_Image_is_empty:
|
|
|
|
- :ref:`bool<class_bool>` **is_empty** **(** **)** const
|
|
|
|
.. _class_Image_is_invisible:
|
|
|
|
- :ref:`bool<class_bool>` **is_invisible** **(** **)** const
|
|
|
|
.. _class_Image_load:
|
|
|
|
- :ref:`int<class_int>` **load** **(** :ref:`String<class_string>` path **)**
|
|
|
|
Load an :ref:`Image<class_image>`.
|
|
|
|
.. _class_Image_lock:
|
|
|
|
- void **lock** **(** **)**
|
|
|
|
.. _class_Image_normalmap_to_xy:
|
|
|
|
- void **normalmap_to_xy** **(** **)**
|
|
|
|
.. _class_Image_premultiply_alpha:
|
|
|
|
- void **premultiply_alpha** **(** **)**
|
|
|
|
.. _class_Image_put_pixel:
|
|
|
|
- void **put_pixel** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`Color<class_color>` color **)**
|
|
|
|
.. _class_Image_resize:
|
|
|
|
- void **resize** **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`int<class_int>` interpolation=1 **)**
|
|
|
|
.. _class_Image_resize_to_po2:
|
|
|
|
- void **resize_to_po2** **(** :ref:`bool<class_bool>` square="false" **)**
|
|
|
|
.. _class_Image_save_png:
|
|
|
|
- :ref:`int<class_int>` **save_png** **(** :ref:`String<class_string>` path **)** const
|
|
|
|
Save this :ref:`Image<class_image>` as a png.
|
|
|
|
.. _class_Image_shrink_x2:
|
|
|
|
- void **shrink_x2** **(** **)**
|
|
|
|
.. _class_Image_srgb_to_linear:
|
|
|
|
- void **srgb_to_linear** **(** **)**
|
|
|
|
.. _class_Image_unlock:
|
|
|
|
- void **unlock** **(** **)**
|
|
|
|
|