Re: [Pdl-porters] Interfacing SDL Surface with a piddle
On 6/27/2010 12:18 PM, Kartik Thakore wrote: This is a good idea. How do I make a piddle of bytes 4 * $width * $height ? At least you would have all the surface and piddle data in the same spot which seems to be your difficulty here This might be easier indeed, thanks. PDL $width = 640; PDL $height = 480; PDL $piddle = zeroes(byte,4,$width,$height); PDL ?vars PDL variables in package main:: Name Type Dimension Flow State Mem $piddleByte D [4,640,480] P1.17Mb
Re: [Pdl-porters] Interfacing SDL Surface with a piddle
On 6/27/2010 10:59 AM, Kartik Thakore wrote: Hi Ok I looked at get_dataref. But I still don't understand why the surface-pixels is swaped out when a piddle is written. Both of the Devel::Peek for the get_dataref and surface-get_pixels is the exact same. get_dataref is a perl reference to the data section of the piddle. The surface-pixels is just a pointer to the pixel data. I see no copying of data in the code so it doesn't seem like they should be the same. I notice on the page you reference for the XS stuff that there is a surface_new_from routine. Have you tried creating a piddle of data the size and structure of the surface and then creating the desired surface from that? At least you would have all the surface and piddle data in the same spot which seems to be your difficulty here. --Chris On Sun, Jun 27, 2010 at 1:32 AM, Chris Marshall c...@alum.mit.edu mailto:c...@alum.mit.edu wrote: On 6/26/2010 10:49 PM, Kartik Thakore wrote: Right but where is the piddle xs code? It is in Basic/Core in the PDL directory. The piddle data is in the string of the perl scalar. That way it gets the advantage of the perl memory allocation/freeing... --Chris On Sat, Jun 26, 2010 at 10:35 PM, Chris Marshall c...@alum.mit.edu mailto:c...@alum.mit.edu mailto:c...@alum.mit.edu mailto:c...@alum.mit.edu wrote: On 6/26/2010 10:10 PM, Kartik Thakore wrote: What SV_type is getdata_ref using? where can I find that? You can get a copy of the PDL source from CPAN and that should explain things. --Chris No virus found in this incoming message. Checked by AVG - www.avg.com http://www.avg.com Version: 9.0.830 / Virus Database: 271.1.1/2964 - Release Date: 06/26/10 02:35:00 No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.830 / Virus Database: 271.1.1/2966 - Release Date: 06/27/10 02:35:00
Re: [Pdl-porters] Interfacing SDL Surface with a piddle
Hi Ok I looked at get_dataref. But I still don't understand why the surface-pixels is swaped out when a piddle is written. Both of the Devel::Peek for the get_dataref and surface-get_pixels is the exact same. On Sun, Jun 27, 2010 at 1:32 AM, Chris Marshall c...@alum.mit.edu wrote: On 6/26/2010 10:49 PM, Kartik Thakore wrote: Right but where is the piddle xs code? It is in Basic/Core in the PDL directory. The piddle data is in the string of the perl scalar. That way it gets the advantage of the perl memory allocation/freeing... --Chris On Sat, Jun 26, 2010 at 10:35 PM, Chris Marshall c...@alum.mit.edu mailto:c...@alum.mit.edu wrote: On 6/26/2010 10:10 PM, Kartik Thakore wrote: What SV_type is getdata_ref using? where can I find that? You can get a copy of the PDL source from CPAN and that should explain things. --Chris No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.830 / Virus Database: 271.1.1/2964 - Release Date: 06/26/10 02:35:00
Re: [Pdl-porters] Interfacing SDL Surface with a piddle
Hi David, Chris, We have a go. I have managed to make a usable SDL + PDL piddle. I have updated the repo with an example and docs. http://github.com/kthakore/SDL_perl/blob/master/lib/pods/SDL/Cookbook/PDL.pod http://github.com/kthakore/SDL_perl/blob/master/examples/cookbook/pdl.pl :) David you are up for PDL::SDL::Graphics. Join me on #sdl irc.perl.org if you need help. Or just send and email to sdl-devel@perl.org Regards, Kartik Thakore