[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] gWorld to SDL_Surface
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] gWorld to SDL_Surface
- From: Nirav Patel <olpc@xxxxxxxxxxxxxx>
- Date: Sun, 5 Jul 2009 12:11:35 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sun, 05 Jul 2009 12:19:02 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=QKAbhw8u0BI5iGSI0FxAv+zHy2CS7dx4Yha6hzlrETA=; b=cXt06UdkQAfNDkiN4gkJz36wVQQS1vsbQslK13OQ1yUoZDOrOMf0ztJVbL/2gAOYes 48NFD092jc5mjLLKn4P3etiqsbHIp+6ckuCpZA1g8KfbzTCdn2YSRrc2Bm7ibUsC4ONj tThaLpyCvBrLp579uxaIpF1eHVnagE9wXHm6w=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=QCRLkbkft34hXtxes+qiWsPFXqtNFTA+pjlvvfnARyaKN24k8sOX7mRf6ZIjNc72C8 FdtkD38Kxvr0uzE1SGysmLziJ4aamaNlxaf6VR+msxlu3MX0GFzKVbcgKfgTqSop1Ud7 cNqtuE38+Fc64/daR3FoIwuI65aMhqBzCP3ws=
- In-reply-to: <43F92A15-AF77-4DDD-9758-0000371FDEDB@xxxxxxxxx>
- References: <43F92A15-AF77-4DDD-9758-0000371FDEDB@xxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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
>