From 0387fe65fc785ac8dd8e397226c64e6d2f7bdd21 Mon Sep 17 00:00:00 2001 From: Elliot Young Date: Wed, 29 May 2024 00:44:30 -0700 Subject: [PATCH] Fix `display.get_image_region()` --- src/frheed/ui/display.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/frheed/ui/display.py b/src/frheed/ui/display.py index 07241ba..b8fc619 100644 --- a/src/frheed/ui/display.py +++ b/src/frheed/ui/display.py @@ -331,7 +331,8 @@ def get_image_region( if isinstance(image, QtGui.QImage): image = image_util.qimage_to_ndarray(image) - rect = shape.get_bounding_rect().toRect() + # The rectangle must have positive width and height to draw the region + rect = shape.get_bounding_rect().toRect().normalized() x1, y1, x2, y2 = rect.left(), rect.top(), rect.right(), rect.bottom() if isinstance(shape, Rectangle): return image_util.get_rectangle_region(image, x1, y1, x2, y2)