pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

Artifact when rectangle with rounded corners

Open Nikolasitude opened this issue 1 year ago • 1 comments
trafficstars

Environment:

pygame-ce 2.5.0 (SDL 2.30.3, Python 3.12.1)

Current behavior:

The bug manifests when 2 conditions are met :

  • When a value is given to make pygame.rect’s borders rounder (give it any positive number)
  • When the rectangle has a height or a weight so little the the borders touch

The bug consists of a rectangle that appears in front of the first rectangle.

Test code

from pygame import *
from time import sleep

init()

_window = display.set_mode((960,540), 16)

for x in range(100):
    x = x%20
    _window.fill((0,0,0))
    draw.rect(_window, (200,200,200), [50,50,100,20], x, 1)
    draw.rect(_window, (200,200,200), [180,50,100,20], 17, x)

    draw.rect(_window, (200,200,200), [50,200,100,50], 17, x)
    draw.rect(_window, (200,200,200), [180,200,100,35], 17, x)

    draw.rect(_window, (200,200,200), [50,350,100,35], x, 1)

    display.update()
    sleep(0.1)

Nikolasitude avatar Sep 16 '24 12:09 Nikolasitude