Added a new helper method to image.

This commit is contained in:
Relintai 2022-03-10 15:33:07 +01:00
parent 11e474ae3b
commit cc64dee592
2 changed files with 4 additions and 0 deletions

View File

@ -1685,6 +1685,9 @@ const uint8_t *Image::datar() const {
uint8_t *Image::dataw() { uint8_t *Image::dataw() {
return data.dataw(); return data.dataw();
} }
int Image::get_data_size() const {
return data.size();
}
void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format) { void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format) {
ERR_FAIL_COND_MSG(p_width <= 0, "Image width must be greater than 0."); ERR_FAIL_COND_MSG(p_width <= 0, "Image width must be greater than 0.");

View File

@ -212,6 +212,7 @@ public:
Vector<uint8_t> get_data() const; Vector<uint8_t> get_data() const;
const uint8_t* datar() const; const uint8_t* datar() const;
uint8_t* dataw(); uint8_t* dataw();
int get_data_size() const;
Image(); Image();
Image(int p_width, int p_height, bool p_use_mipmaps, Format p_format); Image(int p_width, int p_height, bool p_use_mipmaps, Format p_format);