Image
Category: Built-In Types
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
- COMPRESS_BC = 0
- COMPRESS_PVRTC2 = 1
- COMPRESS_PVRTC4 = 2
- COMPRESS_ETC = 3
- FORMAT_GRAYSCALE = 0
- FORMAT_INTENSITY = 1
- FORMAT_GRAYSCALE_ALPHA = 2
- FORMAT_RGB = 3
- FORMAT_RGBA = 4
- FORMAT_INDEXED = 5
- FORMAT_INDEXED_ALPHA = 6
- FORMAT_YUV_422 = 7
- FORMAT_YUV_444 = 8
- FORMAT_BC1 = 9
- FORMAT_BC2 = 10
- FORMAT_BC3 = 11
- FORMAT_BC4 = 12
- FORMAT_BC5 = 13
- FORMAT_PVRTC2 = 14
- FORMAT_PVRTC2_ALPHA = 15
- FORMAT_PVRTC4 = 16
- FORMAT_PVRTC4_ALPHA = 17
- FORMAT_ETC = 18
- FORMAT_ATC = 19
- FORMAT_ATC_ALPHA_EXPLICIT = 20
- FORMAT_ATC_ALPHA_INTERPOLATED = 21
- FORMAT_CUSTOM = 22
- INTERPOLATE_NEAREST = 0
- INTERPOLATE_BILINEAR = 1
- INTERPOLATE_CUBIC = 2
Description
Built in native image datatype. Contains image data, which can be converted to a texture, and several functions to interact with it.
Member Function Description
Image Image ( int width, int height, bool mipmaps, int format )
Create an empty image of a specific size and format.
void blend_rect ( Image src, Rect2 src_rect, Vector2 dest=0 )
Alpha-blends a “src_rect” Rect2 from “src” Image to this Image on coordinates “dest”.
void blend_rect_mask ( Image src, Image mask, Rect2 src_rect, Vector2 dest=0 )
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
void blit_rect ( Image src, Rect2 src_rect, Vector2 dest=0 )
Copy a “src_rect” Rect2 from “src” Image to this Image on coordinates “dest”.
void blit_rect_mask ( Image src, Image mask, Rect2 src_rect, Vector2 dest=0 )
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 brush_transfer ( Image src, Image brush, Vector2 pos=0 )
Transfer data from “src” to this Image using a “brush” as a mask/brush on coordinates “pos”.
Image brushed ( Image src, Image brush, Vector2 pos=0 )
Return a new Image from this Image that is created by brushhing see brush_transfer.
Image compressed ( int format=0 )
Return a new compressed Image from this Image using one of Image.COMPRESS_*.
Image converted ( int format=0 )
Return a new Image from this Image with a different format.
Image decompressed ( )
Return a new decompressed Image.
bool empty ( )
Return whether this Image is empty(no data).
void fill ( Color color=0 )
Fills an Image with a specified Color
void fix_alpha_edges ( )
RawArray get_data ( )
Return the raw data of the Image.
int get_format ( )
Return the format of the Image, one of Image.FORMAT_*.
int get_height ( )
Return the height of the Image.
Color get_pixel ( int x, int y, int mipmap_level=0 )
Return the color of the pixel in the Image on coordinates “x,y” on mipmap level “mipmap_level”.
Image get_rect ( Rect2 area=0 )
Return a new Image that is a copy of “area” in this Image.
Rect2 get_used_rect ( )
Return the area of this Image that is used/visibly colored/opaque.
int get_width ( )
Return the width of the Image.
int load ( String path=0 )
Load an Image.
void put_pixel ( int x, int y, Color color, int mipmap_level=0 )
Put a pixel of “color” on coordinates “x,y” on mipmap level “mipmap_level”.
Image resized ( int x, int y, int interpolation=1 )
Return a new Image from this Image that is resized to size “x,y” using Image.INTERPOLATE_*.
int save_png ( String path=0 )
Save this Image as a png.
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/2.1/classes/class_image.html