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

Re: [pygame] Overwrite color not alpha?



On Sun, 2006-02-12 at 11:12 -0800, Kamilche wrote:
>      pygame.surfarray.pixels3d(pic)[:, :, :3] = (255,0,0)
> where 'pic' is the pygame surface, and (255,0,0) is the color red.

Also note that the pixels3d is "always" 3d, so the pixel alphas are
never included. In this case it makes things a little better, but it
ends up being lame when you really do want alpha.

pygame.surfarray.pixels3d(dst)[:] = pygame.surfarray.pixels3d(src)

Slicing Numeric arrays is pretty much a free operation, so no need to
worry about the extra slicing being inefficient.