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

Re: [pygame] alpha and fonts



Andrew Straw wrote:
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.

rendered_surf = f.render("blah blah", 1, (255,255,255,255),(0,0,0,0))
rendered_surf = f.render("blah blah", 1, (255,255,255),(0,0,0))
the problem you face is that these two functions are actually doing the exact same thing. when passing color values to the Font.render method, they ignore the alpha value. if you pass any background color, it will return an image with solid alpha. if you pass no argument for the background color, then you will get a rendered image with proper alpha.

for the first version of your function you will want to call it like this

rendered_surf = f.render("blah blah", 1, (255,255,255))

that should give you the type of image you are looking for.


--
"Neither will I tell you by what authority I do these things"
pete*shinners.org