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¶
Create an empty image of a specific size and format.
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
Transfer data from “src” to this Image using a “brush” as a mask/brush on coordinates “pos”.
Return a new Image from this Image that is created by brushhing see brush_transfer.
Return a new compressed Image from this Image using one of Image.COMPRESS_*.
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.
Return the color of the pixel in the Image on coordinates “x,y” on mipmap level “mipmap_level”.
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.
Load an Image.
Put a pixel of “color” on coordinates “x,y” on mipmap level “mipmap_level”.
Return a new Image from this Image that is resized to size “x,y” using Image.INTERPOLATE_*.
Save this Image as a png.