[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pygame] alpha and fonts
Hi,
I have a question regarding fonts and alpha. The render() method
doesn't seem to handle alpha properly (to my way of thinking, anyway).
Example code is below.
This:
f = pygame.font.Font(None,30)
rendered_surf = f.render("blah blah", 1, (255,255,255,255),(0,0,0,0))
texels_pil =
Image.fromstring('RGBA',rendered_surf.get_size(),pygame.image.tostring(r
endered_surf,'RGBA'))
Should produce the same output as this: (I think)
f = pygame.font.Font(None,30)
rendered_surf = f.render("blah blah", 1, (255,255,255),(0,0,0))
texels_pil =
Image.fromstring('RGB',rendered_surf.get_size(),pygame.image.tostring(re
ndered_surf,'RGB'))
r,g,b=texels_pil.split()
a=r
texels_pil = Image.merge("RGBA",(r,g,b,a))
Why doesn't this work?
Cheers!
Andrew