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

Re: [pygame] [bug] blit_array() fails with a 24 bit surface



Ah, I see.  I misread what the docs were saying.  Carry on.

*quietly goes off to stand in a corner*
-FM

On Wed, Oct 22, 2008 at 9:43 PM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
> Hi Charlie,
>
> 3d arrays work with 24 and 32 bit surfaces, 2d arrays with 16 and 32 bit
> surfaces. So blit_array should work. It it just tricky getting the byte
> alignments right.
>
> Lenard
>
>
> Charlie Nolan wrote:
>>
>> That may be a fundamental weakness of the method used, seeing as how
>> pixels*d doesn't work on 24-bit surfaces.  If so, it should definitely
>> give a better error message and be mentioned in the docs.
>>
>> -FM
>>
>> On Wed, Oct 22, 2008 at 3:34 PM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
>>
>>>
>>> I've just filed bug 24 at http://pygame.motherhamster.org/bugzilla/
>>>
>>> Pygame-1.9.0a0 (rev. 1668)
>>> numpy 1.0.4
>>> Python 2.5.2
>>>
>>> pygame.surfarray.blit_array() raises an exception when a 3d array is
>>> copied
>>> to a 24 bit surface.
>>>
>>> Test Program:
>>>
>>> import pygame
>>>
>>> pygame.surfarray.use_arraytype('numpy')
>>> s = pygame.Surface((10,10), 0, 24)
>>> a = pygame.surfarray.array3d(s)
>>> pygame.surfarray.blit_array(s, a)
>>>
>>>
>>> Exception:
>>> Traceback (most recent call last):
>>>  File "array_bug.py", line 6, in <module>
>>>  pygame.surfarray.blit_array(s, a)
>>>  File "C:\PRG\PYTHON25\lib\site-packages\pygame\surfarray.py", line 260,
>>> in
>>> bli
>>> t_array
>>>  return numpysf.blit_array (surface, array)
>>>  File "C:\PRG\PYTHON25\lib\site-packages\pygame\_numpysurfarray.py", line
>>> 381,
>>> in blit_array
>>>  (array[:,:,1::3] >> losses[1] << shifts[1]) | \
>>> TypeError: unsupported operand type(s) for >>: 'float' and 'int'
>>>
>>>
>>> I will see what I can do with it.
>>>
>>> --
>>> Lenard Lindstrom
>>> <len-l@xxxxxxxxx>
>>>
>>>
>>>
>
>
> --
> Lenard Lindstrom
> <len-l@xxxxxxxxx>
>
>