Surface.convert() does not remove the SRCALPHA flag

Issue #340 new
gummbum NA created an issue
# Windows 7, Python 2.7, pygame.1.9.2-cp27
import pygame
pygame.display.set_mode((200, 200))
surf1 = pygame.Surface((20, 20), pygame.SRCALPHA)
print('surf1', surf1.get_flags() & pygame.SRCALPHA)

surf2 = surf1.convert()
print('surf2', surf2.get_flags() & pygame.SRCALPHA)

surf3 = surf1.convert(surf1.get_bitsize(), 0)
print('surf3', surf3.get_flags() & pygame.SRCALPHA)

surf4 = surf1.convert(surf1.get_bitsize(), surf1.get_flags() ^ pygame.SRCALPHA)
print('surf4', surf4.get_flags() & pygame.SRCALPHA)

Comments (2)

  1. gummbum NA reporter

    Update. I don't know if this affects performance. It may just be an issue with surface alpha. See also issue #341, as these two issues are likely related.

    In the sample code initially provided, the SRCALPHA flag can be removed in all cases by disabling surface alpha after calling surf.convert():

    >>> surf = image.convert()
    >>> surf.set_alpha(None)
    >>> print('surf', surf.get_flags() & pygame.SRCALPHA)
  2. Log in to comment