summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-08-26 18:37:08 +0200
committerGitHub <noreply@github.com>2017-08-26 18:37:08 +0200
commit9f1e3903df1b5d6b3df297b6ba87106c052d7b08 (patch)
treebb957c415e72ed27e0042e1b740ebf254f6a2045
parent9d7945250e19e38f77498afab51067fd670b0ce2 (diff)
parent4de96518c889886afc87c548728a9df6444403fc (diff)
Merge pull request #10648 from Xrayez/image-get-size
Add handy get_size() method to Image class
-rw-r--r--core/image.cpp6
-rw-r--r--core/image.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 91572e44e4..0f09fbc0c1 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -343,6 +343,11 @@ int Image::get_height() const {
return height;
}
+Vector2 Image::get_size() const {
+
+ return Vector2(width, height);
+}
+
bool Image::has_mipmaps() const {
return mipmaps;
@@ -2215,6 +2220,7 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_width"), &Image::get_width);
ClassDB::bind_method(D_METHOD("get_height"), &Image::get_height);
+ ClassDB::bind_method(D_METHOD("get_size"), &Image::get_size);
ClassDB::bind_method(D_METHOD("has_mipmaps"), &Image::has_mipmaps);
ClassDB::bind_method(D_METHOD("get_format"), &Image::get_format);
ClassDB::bind_method(D_METHOD("get_data"), &Image::get_data);
diff --git a/core/image.h b/core/image.h
index 7acc4744e9..2d61032896 100644
--- a/core/image.h
+++ b/core/image.h
@@ -177,6 +177,7 @@ private:
public:
int get_width() const; ///< Get image width
int get_height() const; ///< Get image height
+ Vector2 get_size() const;
bool has_mipmaps() const;
int get_mipmap_count() const;