diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/texture.cpp | 8 | ||||
-rw-r--r-- | scene/resources/texture.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 063a13efc0..76b322dc8c 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -1272,6 +1272,14 @@ bool AtlasTexture::is_pixel_opaque(int p_x, int p_y) const { return atlas->is_pixel_opaque(x, y); } +Ref<Image> AtlasTexture::get_image() const { + if (!atlas.is_valid()) { + return Ref<Image>(); + } + + return atlas->get_image()->get_rect(region); +} + AtlasTexture::AtlasTexture() {} ///////////////////////////////////////// diff --git a/scene/resources/texture.h b/scene/resources/texture.h index f6b991c335..576c053c25 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -252,6 +252,8 @@ public: bool is_pixel_opaque(int p_x, int p_y) const override; + virtual Ref<Image> get_image() const override; + AtlasTexture(); }; |