.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Image.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Image: Image ===== **Inherits:** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Image datatype. Member Functions ---------------- +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`blend_rect` **(** :ref:`Image` src, :ref:`Rect2` src_rect, :ref:`Vector2` dst **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`blend_rect_mask` **(** :ref:`Image` src, :ref:`Image` mask, :ref:`Rect2` src_rect, :ref:`Vector2` dst **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`blit_rect` **(** :ref:`Image` src, :ref:`Rect2` src_rect, :ref:`Vector2` dst **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`blit_rect_mask` **(** :ref:`Image` src, :ref:`Image` mask, :ref:`Rect2` src_rect, :ref:`Vector2` dst **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_mipmaps` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`compress` **(** :ref:`int` mode, :ref:`int` source, :ref:`float` lossy_quality **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`convert` **(** :ref:`int` format **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`copy_from` **(** :ref:`Image` src **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`create` **(** :ref:`int` width, :ref:`int` height, :ref:`bool` use_mipmaps, :ref:`int` format **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`create_from_data` **(** :ref:`int` width, :ref:`int` height, :ref:`bool` use_mipmaps, :ref:`int` format, :ref:`PoolByteArray` data **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`crop` **(** :ref:`int` width, :ref:`int` height **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`decompress` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`detect_alpha` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`expand_x2_hq2x` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`fill` **(** :ref:`Color` color **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`fix_alpha_edges` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`flip_x` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`flip_y` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`generate_mipmaps` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolByteArray` | :ref:`get_data` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_format` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_height` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_mipmap_offset` **(** :ref:`int` mipmap **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Color` | :ref:`get_pixel` **(** :ref:`int` x, :ref:`int` y **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Image` | :ref:`get_rect` **(** :ref:`Rect2` rect **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_size` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`get_used_rect` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_width` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_mipmaps` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_compressed` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_empty` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_invisible` **(** **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`load` **(** :ref:`String` path **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`lock` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`normalmap_to_xy` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`premultiply_alpha` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`resize` **(** :ref:`int` width, :ref:`int` height, :ref:`int` interpolation=1 **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`resize_to_po2` **(** :ref:`bool` square=false **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`save_png` **(** :ref:`String` path **)** const | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_pixel` **(** :ref:`int` x, :ref:`int` y, :ref:`Color` color **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`shrink_x2` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`srgb_to_linear` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`unlock` **(** **)** | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Member Variables ---------------- - :ref:`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_blend_rect: - void **blend_rect** **(** :ref:`Image` src, :ref:`Rect2` src_rect, :ref:`Vector2` dst **)** Alpha-blends a "src_rect" :ref:`Rect2` from "src" :ref:`Image` to this :ref:`Image` on coordinates "dest". .. _class_Image_blend_rect_mask: - void **blend_rect_mask** **(** :ref:`Image` src, :ref:`Image` mask, :ref:`Rect2` src_rect, :ref:`Vector2` dst **)** Alpha-blends a "src_rect" :ref:`Rect2` from "src" :ref:`Image` to this :ref:`Image` using a "mask" :ref:`Image` on coordinates "dest". Alpha channels are required for both "src" and "mask", dest pixels and src pixels will blend if the corresponding mask pixel's alpha value is not 0. "src" :ref:`Image` and "mask" :ref:`Image` \*must\* have the same size (width and height) but they can have different formats .. _class_Image_blit_rect: - void **blit_rect** **(** :ref:`Image` src, :ref:`Rect2` src_rect, :ref:`Vector2` dst **)** Copy a "src_rect" :ref:`Rect2` from "src" :ref:`Image` to this :ref:`Image` on coordinates "dest". .. _class_Image_blit_rect_mask: - void **blit_rect_mask** **(** :ref:`Image` src, :ref:`Image` mask, :ref:`Rect2` src_rect, :ref:`Vector2` dst **)** Blits a "src_rect" :ref:`Rect2` from "src" :ref:`Image` to this :ref:`Image` using a "mask" :ref:`Image` on coordinates "dest". Alpha channel is required for "mask", will copy src pixel onto dest if the corresponding mask pixel's alpha value is not 0. "src" :ref:`Image` and "mask" :ref:`Image` \*must\* have the same size (width and height) but they can have different formats .. _class_Image_clear_mipmaps: - void **clear_mipmaps** **(** **)** .. _class_Image_compress: - :ref:`int` **compress** **(** :ref:`int` mode, :ref:`int` source, :ref:`float` lossy_quality **)** .. _class_Image_convert: - void **convert** **(** :ref:`int` format **)** .. _class_Image_copy_from: - void **copy_from** **(** :ref:`Image` src **)** .. _class_Image_create: - void **create** **(** :ref:`int` width, :ref:`int` height, :ref:`bool` use_mipmaps, :ref:`int` format **)** Create an empty image of a specific size and format. .. _class_Image_create_from_data: - void **create_from_data** **(** :ref:`int` width, :ref:`int` height, :ref:`bool` use_mipmaps, :ref:`int` format, :ref:`PoolByteArray` data **)** .. _class_Image_crop: - void **crop** **(** :ref:`int` width, :ref:`int` height **)** .. _class_Image_decompress: - :ref:`int` **decompress** **(** **)** .. _class_Image_detect_alpha: - :ref:`int` **detect_alpha** **(** **)** const .. _class_Image_expand_x2_hq2x: - void **expand_x2_hq2x** **(** **)** .. _class_Image_fill: - void **fill** **(** :ref:`Color` color **)** Fills an :ref:`Image` with a specified :ref:`Color` .. _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` **generate_mipmaps** **(** **)** .. _class_Image_get_data: - :ref:`PoolByteArray` **get_data** **(** **)** const Return the raw data of the :ref:`Image`. .. _class_Image_get_format: - :ref:`int` **get_format** **(** **)** const Return the format of the :ref:`Image`, one of :ref:`Image`.FORMAT\_\*. .. _class_Image_get_height: - :ref:`int` **get_height** **(** **)** const Return the height of the :ref:`Image`. .. _class_Image_get_mipmap_offset: - :ref:`int` **get_mipmap_offset** **(** :ref:`int` mipmap **)** const .. _class_Image_get_pixel: - :ref:`Color` **get_pixel** **(** :ref:`int` x, :ref:`int` y **)** const .. _class_Image_get_rect: - :ref:`Image` **get_rect** **(** :ref:`Rect2` rect **)** const Return a new :ref:`Image` that is a copy of "area" in this :ref:`Image`. .. _class_Image_get_size: - :ref:`Vector2` **get_size** **(** **)** const .. _class_Image_get_used_rect: - :ref:`Rect2` **get_used_rect** **(** **)** const Return the area of this :ref:`Image` that is used/visibly colored/opaque. .. _class_Image_get_width: - :ref:`int` **get_width** **(** **)** const Return the width of the :ref:`Image`. .. _class_Image_has_mipmaps: - :ref:`bool` **has_mipmaps** **(** **)** const .. _class_Image_is_compressed: - :ref:`bool` **is_compressed** **(** **)** const .. _class_Image_is_empty: - :ref:`bool` **is_empty** **(** **)** const .. _class_Image_is_invisible: - :ref:`bool` **is_invisible** **(** **)** const .. _class_Image_load: - :ref:`int` **load** **(** :ref:`String` path **)** Load an :ref:`Image`. .. _class_Image_lock: - void **lock** **(** **)** .. _class_Image_normalmap_to_xy: - void **normalmap_to_xy** **(** **)** .. _class_Image_premultiply_alpha: - void **premultiply_alpha** **(** **)** .. _class_Image_resize: - void **resize** **(** :ref:`int` width, :ref:`int` height, :ref:`int` interpolation=1 **)** .. _class_Image_resize_to_po2: - void **resize_to_po2** **(** :ref:`bool` square=false **)** .. _class_Image_save_png: - :ref:`int` **save_png** **(** :ref:`String` path **)** const Save this :ref:`Image` as a png. .. _class_Image_set_pixel: - void **set_pixel** **(** :ref:`int` x, :ref:`int` y, :ref:`Color` color **)** .. _class_Image_shrink_x2: - void **shrink_x2** **(** **)** .. _class_Image_srgb_to_linear: - void **srgb_to_linear** **(** **)** .. _class_Image_unlock: - void **unlock** **(** **)**