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

Re: [pygame] Bug: numpyarray.pixels_alpha array not properly aligned



On, Tue Jan 08, 2008, Lenard Lindstrom wrote:

[...] 
> The problem is that the major and minor axis of the array are reversed from 
> those of the surface. Try replacing lines 272-276 with:
> 
>    return numpy.ndarray(buffer=surface.get_buffer (),
>                         dtype=numpy.uint8,
>                         shape=surface.get_size (),
>                         offset=start,
>                         strides=(4, surface.get_pitch ()))
> 
> The offset argument sets the relative position of the alpha byte. The 
> strides argument makes the second argument the major axis and the first 
> argument skip by the pixel size of 4 bytes. It works with the test case I 
> submitted and an application I wrote that relies heavily on arrays. Hope 
> this helps.

You refer to rev. 1072 I guess, not to the fixed version? I cannot see
any misbehaviour anymore.

Regards
Marcus

Attachment: pgpBLH06Pnpco.pgp
Description: PGP signature