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

Re: [pygame] surfarray on 64-bit machines



Hi Marius,

I am curious, but what happens if array[:] is replaced with array[...]. It is a two dimension array, so I am surprised the single index slice [:] even works. The alternate form [..] is indifferent to array dimension.

Lenard

Marius Gedminas wrote:
A user reported that PySpaceWar fails on 64-bit Linux machines if I try
to scale the alpha channel.  Here's the code (simplified):

    import pygame
    import Numeric
    image = pygame.image.load('title.png')   # has an alpha channel
    mask = pygame.surfarray.array_alpha(image).astype(Numeric.Int)
    array = pygame.surfarray.pixels_alpha(self.image)
    alpha = 42.5 # a float between 1 and 255
    array[:] = (mask * alpha / 255).astype(Numeric.UnsignedInt8)

The error happens on the last line, and it says

    ValueError: matrices are not aligned for copy

Any ideas?  The code works fine on 32-bit systems.

Marius Gedminas


--
Lenard Lindstrom
<len-l@xxxxxxxxx>