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

Re: [pygame] gWorld to SDL_Surface



You will presumably have to copy the data out of the buffer.  I don't
know exactly how video capturing works in OS X, but I assume there is
a limited number of frames it can buffer and it reuses this buffer.
What is the pixel format of the data in gWorld?  You will almost
certainly have to write a C function to do the copying.  If it is
already in a packed RGB format, you can simply memcpy the data and set
the correct shifts and masks for the SDL surface.

However, keep in mind that this will limit the possible surfaces being
output by the camera module to that which the camera buffer contains.
This means that the surface may have to be converted on blitting to
the display surface, which can be a slow operation.  Take a look at
how this is being done in the current _camera.c, specifically a
function like rgb444_to_rgb().

Though, if it is already in a packed RGB format, you could also just
make a SDL surface with the surface pixels pointing to the gWorld
data, set the shifts and masks correctly, and then just use
SDL_ConvertSurface() to do the conversion to the desired output
Surface if the user specifies one.

Nirav

On Sun, Jul 5, 2009 at 1:36 AM, el lauwer<el.lauwer@xxxxxxxxx> wrote:
> Hoi,
>
> I am trying to put the pixels from the frame I grabbed into an SDL_Surface,
> but I find it hard to get the gWorld data into the SDL_Surface. how can you
> fill the buffer of the surface. I have tried to use SDL_Color, but the
> compiler said that the type didn't exist :s.
>
> is copying all the data from one buffer to an other a good idea, since this
> copying takes a while to complete, definitely because it does it for every
> frame.
>
>
> Slu
>