diff options
Diffstat (limited to 'core/io/image.cpp')
-rw-r--r-- | core/io/image.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/io/image.cpp b/core/io/image.cpp index 16dd66fc98..65addaf964 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -2636,9 +2636,9 @@ Rect2i Image::get_used_rect() const { } } -Ref<Image> Image::get_rect(const Rect2i &p_area) const { - Ref<Image> img = memnew(Image(p_area.size.x, p_area.size.y, mipmaps, format)); - img->blit_rect(Ref<Image>((Image *)this), p_area, Point2i(0, 0)); +Ref<Image> Image::get_region(const Rect2i &p_region) const { + Ref<Image> img = memnew(Image(p_region.size.x, p_region.size.y, mipmaps, format)); + img->blit_rect(Ref<Image>((Image *)this), p_region, Point2i(0, 0)); return img; } @@ -3362,7 +3362,7 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("fill_rect", "rect", "color"), &Image::fill_rect); ClassDB::bind_method(D_METHOD("get_used_rect"), &Image::get_used_rect); - ClassDB::bind_method(D_METHOD("get_rect", "rect"), &Image::get_rect); + ClassDB::bind_method(D_METHOD("get_region", "region"), &Image::get_region); ClassDB::bind_method(D_METHOD("copy_from", "src"), &Image::copy_internals_from); @@ -3524,6 +3524,7 @@ Ref<Image> Image::get_image_from_mipmap(int p_mipamp) const { void Image::bump_map_to_normal_map(float bump_scale) { ERR_FAIL_COND(!_can_modify(format)); + clear_mipmaps(); convert(Image::FORMAT_RF); Vector<uint8_t> result_image; //rgba output |