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

Re: [pygame] SDL 2.0



On, Sun Aug 18, 2013, ninmonkeys@xxxxxxxxx wrote:

> Is this required If you use the pixel access sample in the sdl2
> migration wiki?

What example do you mean exactly?

Generally speaking: no, you do not have to rely on numpy, but can use
your own favourite way of accessing the data, either by using the ctypes
pointer to the pixels directly or wrapping it into a Python array, byte
array or something else. If you plan to do so, I recommend you to take a
brief look at the sdl2/ext/array.py code, which contains several ways of
accessing and converting such a buffer. It might save you some time to
create your own implementation.

Cheers
Marcus

>
> On Aug 17, 2013, at 12:28 AM, Marcus von Appen <mva@xxxxxxxxxxxx> wrote:
>
> > On, Sat Aug 17, 2013, Lenard Lindstrom wrote:
> >
> >> Ctypes may be the way to go on PyPy, but it is slow in CPython. It lacks
> >> new buffer support. Well, ctype types have buffers, but they don't work
> >> with NumPy.
> >
> > Take a look at
> > https://bitbucket.org/marcusva/py-sdl2/src/963b26e2110449a453efa7fa45328c0062c72697/sdl2/ext/pixelaccess.py?at=default
> >
> > Accessing ctypes buffers or exposing ctypes buffers to Numpy is not a
> > problem.
> >
> > Cheers
> > Marcus

Attachment: pgpAz4K4Bo0ka.pgp
Description: PGP signature