[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] Hashido
> > surface = font.render("some text",1,(240,240,240))
> >
> > What is the surface format of this text?
> > Because i tried to convert it to the screen format and it basically nuked
> > my rendered font.
>
> use convert_alpha() for rendered text without BG color.
yes, niki has the answer. the Font.render() function will
create different surface types, based on the arguments it
gets. here's a quick reference...
not smooth, with bg = colormapped 8bit
not smooth, no bg = colormapped 8bit, with colorkey
smoothed, with bg = 32bit RGB surface
smoothed, no bg = 32 RGB surface RGBA surface
niki has the answer here, when using convert() on a surface
with an alpha channel, you'll need to use convert_alpha() to
maintain that alpha channel.
also, note that convert_alpha() won't always convert your
surface to the exact same format as the display, but SDL will
choose a format that will be fastest for blitting to the
display surface.
alpha blended blits are always the slowest. if you have a
pretty consistent background color, i would recommend rendering
the text smoothed with the average background color, then enable
a colorkey on the surface. this will be the quickest nicest
looking font, but will put an off-colored halo around the text
where it doesn't quite line up.
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org