[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Per-pixel alpha question



Per Wigren wrote:
> How can I create a new per-pixel-alpha Surface without running 
> s.convert_alpha() ?
> The SRCALPHA-flag doesn't seem to work... :/

looks like the Surface constructor also needs a bit depth for it to work.
what you want is Surface(size, SRCALPHA, 32). this should do the job...

>>> s = 1, 1
>>> [hex(m) for m in Surface(s, SRCALPHA).get_masks()]
['0xff0000', '0xff00', '0xff', '0x0']

>>> [hex(m) for m in Surface(s, SRCALPHA, 32).get_masks()]
['0xff0000', '0xff00', '0xff', '0xff000000']

>>> [hex(m) for m in Surface((1,1), SRCALPHA, 16).get_masks()]
['0xf00', '0xf0', '0xf', '0xf000']

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org