Skip to content

Commit

Permalink
Fix display.get_image_region()
Browse files Browse the repository at this point in the history
  • Loading branch information
ecyoung3 committed May 29, 2024
1 parent ab37348 commit 0387fe6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/frheed/ui/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0387fe6

Please sign in to comment.