develooper Front page | perl.sdl.devel | Postings from April 2012

Re: Help: with create a surface from my own RGBA data

Thread Previous | Thread Next
From:
agraham
Date:
April 5, 2012 13:04
Subject:
Re: Help: with create a surface from my own RGBA data
Message ID:
4F7DFABE.4050609@g-b.net
On 04/05/2012 06:02 PM, Tobias Leich wrote:
> Hi, do you know the pixel format of the data you have?
>
> Do you get scanlines that you wanna pass to an SDL::Surface? Or do you
> get just the whole image?
>
> May I invite you to irc? Would be much easier than mails... #sdl at
> irc.perl.org.
>
> Cheers, FROGGS
>

Hi FROGGS,

I was on IRC and got a lot of help, thank you.

The data is RAW BGR/RGB or RGBA data from the network i.e. VNC rectangle 
packets.

The problem I had was it was not obvious how to put this "raw" data into 
a surface so that it could be blitted.

The solution (thanks to Scott Walters) was to get the get_pixels_ptr and 
fill the area of the surface directly as follows:

		$pixels_ptr=$surface->get_pixels_ptr();
		substr $$pixels_ptr, 0, length($data), $data;

# $data=raw RGB data.

I hope this information helps others.

Albert





Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About