Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
BitMap¶
Inherits: Resource < RefCounted < Object
Boolean matrix.
Description¶
A two-dimensional array of boolean values, can be used to efficiently store a binary matrix (every matrix element takes only one bit) and query the values using natural cartesian coordinates.
Methods¶
convert_to_image ( ) const |
|
void |
|
void |
create_from_image_alpha ( Image image, float threshold=0.1 ) |
get_size ( ) const |
|
get_true_bit_count ( ) const |
|
void |
|
opaque_to_polygons ( Rect2i rect, float epsilon=2.0 ) const |
|
void |
|
void |
|
void |
set_bit_rect ( Rect2i rect, bool bit ) |
void |
Method Descriptions¶
Image convert_to_image ( ) const
Returns an image of the same size as the bitmap and with a Format of type Image.FORMAT_L8. true
bits of the bitmap are being converted into white pixels, and false
bits into black.
void create ( Vector2i size )
Creates a bitmap with the specified size, filled with false
.
void create_from_image_alpha ( Image image, float threshold=0.1 )
Creates a bitmap that matches the given image dimensions, every element of the bitmap is set to false
if the alpha value of the image at that position is equal to threshold
or less, and true
in other case.
bool get_bit ( int x, int y ) const
Returns bitmap's value at the specified position.
bool get_bitv ( Vector2i position ) const
Returns bitmap's value at the specified position.
Vector2i get_size ( ) const
Returns bitmap's dimensions.
int get_true_bit_count ( )