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

Re: [pygame] surfarray on 64-bit machines



I may be having this same error.  I've got a bug report with that same
error message at one point (and on a 64-bit machine), even though it
works fine on my (32-bit) machine.  Could you try printing out
"array[:].shape"?  In my case, I do a sensible slice and somehow end
up with a 0x600 array.

-FM

On Wed, Oct 22, 2008 at 7:23 PM, Marius Gedminas <marius@xxxxxxxxx> 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
> --
> If C gives you enough rope to hang yourself, C++ gives you enough rope to bind
> and gag your neighborhood, rig the sails on a small ship, and still have enough
> rope left over to hang yourself from the yardarm.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFI/8PxkVdEXeem148RAkA6AJwMJ03rjyOqAh6NWRtif4Hf࿞㋀⟞恍
> o4PpuubhJjENjPrqIg0CZXQ=
> =2e46
> -----END PGP SIGNATURE-----
>
>