Skip to content

Error raising on unsorted dimensions for draw_rect/draw_rounded_rect #7217

@Intenzi

Description

@Intenzi

With the change in #6978
There is a hidden error now raised due to radius argument for draw_rounded_rectangle

This is in reference to x0, x1 dimensions raising the ValueError: x1 must be greater than or equal to x0

Wherein, the passed dimensions are sorted but when sent to draw_rounded_rectangle, it utilises underlying code of:-
self.draw.draw_rectangle((x0 + r + 1, y0, x1 - r - 1, y1), fill, 1)

Dynamic code such as draw_rounded_rectangle((2, 2), (2 + variable, 10), radius=3)
[variable is >=0]
Thus implicitly fail in certain cases where the variable's value is 4 or less, which explicitly is greater than x0.
The documentation only states for x1 >= x0 and y1 >= y0, which while satisfied will raise the error in the above case.

Question:
Is there an already known solution towards it, for example utilizing x0 + variable + radius + 1 when passing x1's value to the function? Which does not seem very ideal and may cause certain changes to the image generation that I am unaware of.
Can this be documented with a possible solution in such a case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions