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

[pygame] [BUG] SRCALPHA - unexpected behaviour.



After a chat on irc today, this unexpected behaviour popped up again.
It's bit me a few times, as well as people in irc.


import pygame
surf = pygame.Surface((100, 100), pygame.SRCALPHA)
flags = surf.get_flags()
depth = surf.get_bitsize()
assert(depth == 32)
assert(flags & pygame.SRCALPHA == pygame.SRCALPHA)

You would expect that surface to have the SRCALPHA flag if the surface
was 32bit right?

It doesn't at the moment.  But is there a good reason why it does not?

I can understand that if the surface returned was 16bit, or 8bit that
the SRCALPHA flag is not set.  However if it's 32bit, then I think it
probably should be set.

What do you think?  Is there something we're missing?

Can you see something breaking if I change this?  So that if SRCALPHA
is specified, and the bitsize is 32, then use the SRCALPHA flag.  If
someone specifies the SRCALPHA flag I think they expect it to be used
- especially if the surface is 32 bit anyway.