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

[pygame] surfarray on 64-bit machines



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.

Attachment: signature.asc
Description: Digital signature