Image

Inherits: Resource < Reference < Object

Category: Core

Brief Description

Image datatype.

Member Functions

Image Image ( int width, int height, bool mipmaps, int format )
void blend_rect ( Image src, Rect2 src_rect, Vector2 dest=0 )
void blend_rect_mask ( Image src, Image mask, Rect2 src_rect, Vector2 dest=0 )
void blit_rect ( Image src, Rect2 src_rect, Vector2 dest=0 )
void blit_rect_mask ( Image src, Image mask, Rect2 src_rect, Vector2 dest=0 )
void brush_transfer ( Image src, Image brush, Vector2 pos=0 )
Image brushed ( Image src, Image brush, Vector2 pos=0 )
Image compressed ( int format=0 )
Image converted ( int format=0 )
Image decompressed ( )
bool empty ( )
void fill ( Color color=0 )
void fix_alpha_edges ( )
RawArray get_data ( )
int get_format ( )
int get_height ( )
Color get_pixel ( int x, int y, int mipmap_level=0 )
Image get_rect ( Rect2 area=0 )
Rect2 get_used_rect ( )
int get_width ( )
int load ( String path=0 )
void put_pixel ( int x, int y, Color color, int mipmap_level=0 )
Image resized ( int x, int y, int interpolation=1 )
int save_png ( String path=0 )

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

Alpha-blends a “src_rect” Rect2 from “src” Image to this Image on coordinates “dest”.

Alpha-blends a “src_rect” Rect2 from “src” Image to this Image using a “mask” 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” Image and “mask” Image *must* have the same size (width and height) but they can have different formats

Alpha-blends a “src_rect” Rect2 from “src” Image to this Image on coordinates “dest”.

Alpha-blends a “src_rect” Rect2 from “src” Image to this Image using a “mask” 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” Image and “mask” Image *must* have the same size (width and height) but they can have different formats

Copy a “src_rect” Rect2 from “src” Image to this Image on coordinates “dest”.

Blits a “src_rect” Rect2 from “src” Image to this Image using a “mask” 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” Image and “mask” Image *must* have the same size (width and height) but they can have different formats

Blits a “src_rect” Rect2 from “src” Image to this Image using a “mask” 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” Image and “mask” Image *must* have the same size (width and height) but they can have different formats

  • void clear_mipmaps ( )
  • void convert ( int format )
  • void copy_from ( Image src )
  • void create ( int width, int height, bool use_mipmaps, int format )

Create an empty image of a specific size and format.

  • void crop ( int width, int height )
  • int decompress ( )
  • int detect_alpha ( ) const
  • void expand_x2_hq2x ( )
  • void fill ( Color color )

Fills an Image with a specified Color

  • void fill ( Color color=0 )

Fills an Image with a specified Color

  • void fix_alpha_edges ( )
  • void flip_x ( )
  • void flip_y ( )
  • int generate_mipmaps ( )

Return the raw data of the Image.

  • int get_format ( ) const

Return the format of the Image, one of Image.FORMAT_*.

  • int get_height ( ) const

Return the height of the Image.

  • int get_mipmap_offset ( int mipmap ) const

Return a new Image that is a copy of “area” in this Image.

  • Rect2 get_used_rect ( ) const

Return the area of this Image that is used/visibly colored/opaque.

  • int get_width ( ) const

Return the width of the Image.

  • bool has_mipmaps ( ) const
  • bool is_compressed ( ) const
  • bool is_empty ( ) const
  • bool is_invisible ( ) const

Load an Image.

  • void lock ( )
  • void normalmap_to_xy ( )
  • void premultiply_alpha ( )
  • void resize ( int width, int height, int interpolation=null )
  • void resize_to_po2 ( bool square=false )

Save this Image as a png.

  • void shrink_x2 ( )
  • void srgb_to_linear ( )
  • void unlock ( )