[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] `pygame.draw.(aa)?lines?(...)` with Alpha



Hi all,

I recently got a problem that traces back to the drawing functions "line", "aaline", "lines", and "aalines" ignoring any alpha value they are fed.

This seems to me to be a Bad Thing. The obvious workaround is to draw to a temporary surface, and then blit the surface with transparency, but this is extremely wasteful, as it squares the asymptotic complexity. Really, I think this should instead be handled by PyGame in the underlying rasterizer.

Attached is a simple example.

Ian
import pygame
surface = pygame.display.set_mode((128,128))
pygame.draw.  line(surface, (255,0,0,128), (0, 0),(128,128))
pygame.draw.aaline(surface, (0,255,0,128), (0,64),(128, 64))
running = True
while running:
    for event in pygame.event.get():
        if event.type==pygame.QUIT or (event.type==pygame.KEYDOWN and event.key==pygame.K_ESCAPE):
            running = False
    pygame.display.flip()