Hi,
My guess is the corresponding unmap_rgb. It takes a signed Python
integer as an argument, a legacy feature from before Python 2.3. Before
then PyArgs_ParseTuple had no formats for unsigned integers. So this is
understandable. But why then does surfarray.array2d return arrays of
unsigned integer? I think with the elimination of Python ints from
Python 3.0 it is preferable to update map_rgb and unmap_rgb to use
positive longs.
Lenard
Brian Fisher wrote:
the underlying c function SDL_MapRGB returns unsigned:
http://www.libsdl.org/docs/html/sdlmaprgb.html
so unsigned seems like the right choice based on that alone... no idea
why it would be signed
On Thu, Jan 22, 2009 at 10:39 PM, Lenard Lindstrom <[email protected]
<mailto:[email protected]>> wrote:
Hi,
I am writing more unit tests for surfarray after completing the
blit_array tests. Right now I am working on array2d. It would seem
natural to compare the elements of an array returned by array2d
with values returned by map_rgb for the surface used to create the
array. But it is not that easy. map_rgb returns a signed integer.
The array is unsigned. So, though the two numbers may represent
the same pixel value, they cannot be directly compared for
assertion tests. It also brings up another issue, shouldn't
map_rgb be compatible with array2d and blit_array. How else would
one format surface specific pixel values from Color values. So the
question is, do I change map_rgb to return an unsigned value as a
Python long? Would this break anything?
--
Lenard Lindstrom
<[email protected]>