mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 05:19:50 +01:00
Added clear() helper method to Image.
This commit is contained in:
parent
629ec81669
commit
b7d93e4525
@ -30,8 +30,8 @@
|
||||
|
||||
#include "image.h"
|
||||
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/containers/hash_map.h"
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/io/image_loader.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
@ -1724,6 +1724,12 @@ void Image::clear_mipmaps() {
|
||||
mipmaps = false;
|
||||
}
|
||||
|
||||
void Image::clear() {
|
||||
width = 0;
|
||||
height = 0;
|
||||
data.resize(0);
|
||||
}
|
||||
|
||||
bool Image::empty() const {
|
||||
return (data.size() == 0);
|
||||
}
|
||||
@ -2923,6 +2929,7 @@ void Image::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("create", "width", "height", "use_mipmaps", "format"), &Image::_create_empty);
|
||||
ClassDB::bind_method(D_METHOD("create_from_data", "width", "height", "use_mipmaps", "format", "data"), &Image::_create_from_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("clear"), &Image::clear);
|
||||
ClassDB::bind_method(D_METHOD("is_empty"), &Image::empty);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("load", "path"), &Image::load);
|
||||
|
@ -259,6 +259,9 @@ public:
|
||||
void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const PoolVector<uint8_t> &p_data);
|
||||
|
||||
void create(const char **p_xpm);
|
||||
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* returns true when the image is empty (0,0) in size
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user