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

Re: [pygame] Peculiarities of pygame.surfarray.blit_array



Marcus von Appen wrote:
On, Tue Jan 20, 2009, Lenard Lindstrom wrote:

Hi René,

The blit bug is with _numericsurfarray.c, the old surfarray module, so has been around for awhile. It somehow found its way into _numpysurfarray.py as well. I have only tried it with 3d arrays so far. It doesn't just ignore the destination surface's alpha, it resets it.

I found the bug while fixing a NumPy specific bug. After looking at blit_array in _numpysurfarray.py I figured it was easier to just reuse the C version for Numeric. I wrote a new extension module where blit_array is a generic array function that uses the array interface. Other than setting alpha to zero it appears to work. I will give it a good workout with the unit tests before committing it, of course. It's not too difficult to adapt Numeric code for the array interface, so maybe array_colorkey can go their as well.

[...]

Does that mean you implemented the Numpy code in C?


Just the blit_array function. It seemed easier than debugging the Python version. The blit_array in _numpysurfarray.py simply lacks 24bit surface support and may need additional code. I haven't decided yet if a C solution is preferable. But it uses the array interface so is not NumPy specific. For instance, no NumPy headers are included by the new module. That was important. Anyway, NumPy array creation can remain in Python code.

--
Lenard Lindstrom
<len-l@xxxxxxxxx>