Issue #81 resolved

Restore double to integer convertion to _numpysurfarray.make_surface and blit_array

Lenard Lindstrom
created an issue

The pure Python version of //blit_array// called the NumPy array \astype\ method to size the array for copying to the surface. A side affect of this was to convert float arrays to int. This behavior was removed in Pygame 1.9.2 when the //_numpysurfarray// code was reimplemented in C.

As it turns out, developers have come to expect the implicit conversion of float to int arrays, as brought up in this mailing list thread: [[http://archives.seul.org/pygame/users/Aug-2011/msg00133.html]]. So this issue is to add the implicit conversion back into _numpysurfarray. It will not involve the //pixelcopy// module, so has has no significant impact on future optimizations of array blits.

It was suggested that rounding floats to int would be more useful than simple truncation. This possibility will be explored. If it is impractical then the simple //astype// call will be reinstituted.

Comments (5)

  1. Lenard Lindstrom reporter

    Let _numpysurfarray.blit_array and make_surface methods accept float arrays ( closes #81 )

    As requested, surfarray once again excepts numpy arrays with a float dtype. Float values are rounded to int with the numpy.rint ufunc. In Pygame 1.9.1, floats were simply truncated.

    0d2f059b5e4a

  2. Log in to comment