[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Using Numeric & Surfarray with alpha values
On Sat, 2005-11-26 at 18:28 -0500, Mike Rotondo wrote:
> We are writing a 2D particle engine and we would like to render each
> particle with gradually decreasing alpha values. However, our original
> image for the particles has per-pixel alpha, so we can't use set-alpha.
> So, we are going to have to modify each pixel's alpha value ith Numeric,
> it seems.
> [[pixel and (pixel * particle.life / particle.decay) for pixl in row]
> for row in array]
I'm a bit rusty with my surfarray mojo. I would think directly rendering
the particles is going to win over creating an offscreen temporary. In
fact it must be a pretty good speedup.
It looks like you may be dealing with one "particle" for every pixel? I
don't see how just dividing pixel alphas will move anything around?