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

Re: [pygame] alpha channel in font-rendered Surfaces



On Thu, Feb 15, 2007 at 07:40:13AM -0600, Brendan Speer wrote:
> On 2/15/07, Goran <goran@xxxxxxxxxxxxxxxxxx> wrote:
> >I have a problem when trying to fade-in a text.
> >
> >Using the alpha-channel when blitting in an image works fine, but not a
> >surface generated by Font.render().
>
> Surface.convert_alpha creates per-pixel alpha values.
> 
> >From the Surface.set_alpha help: 'This value is different than the per 
> >pixel
> Surface alpha. If the Surface format contains per pixel alphas, then this
> alpha value will be ignored. If the Surface contains per pixel alphas,
> setting the alpha value to None will disable the per pixel transparency.'
> 
> In order to do what you're asking, you need to look at Sufarray. and
> manipulate each per-pixel alpha individually,

I do that in PySpaceWar with Numeric:
http://mg.pov.lt/pyspacewar/trac/browser/trunk/src/pyspacewar/ui.py?rev=260#L817

(The code is GPLed.)

> or you can use convert()
> instead of convert_alpha() (I think...)

There's a fallback in PySpaceWar that does this when Numeric is not
installed.

Marius Gedminas
-- 
11. Are you at least tracking the number of users of retchmail?

As far as I know, retchmail has exactly three users. 
	-- http://open.nit.ca/wiki/index.php?page=RetchMail

Attachment: signature.asc
Description: Digital signature