I took a look at the gist and it looks reasonable
(I can't run it because I don't have the SDL module
and lib installed on my system), however...

I would expect the performance to be *very* poor
since the image data is essentially being converted
from packed byte data to a perl list and then poked
a byte at a time into the SDL surface data.

The better approach would be to wrap a PDL object
(a.k.a. piddle) into an SDL surface.  Then you could
just lock, copy the data via a PDL direct assignment,
unlock and use SDL.  There is an examples/pdl.pl
that shows how to do the wrapping.

BUT, I took a look at the xs code and it appears
that your SDL_Surface objects no longer use a
packed-string representation for the SDL surface
data.  If that is the case, I would be surprised if
the pdl.pl example works at all now.

If someone could verify this, I would appreciate it.
If that is the case, it should be straightforward to
modify the SDL_CreateRGBSurfaceFrom routine
to allow for a SvPV for pixel data as one alternative.

Given the power of PDL for whole-image data
manipulation, allowing for easy interoperability
with the current SDL module would benefit both
our user and developer communities.

Regards,
Chris


On Sun, Sep 23, 2012 at 3:07 PM, Tobias Leich <em...@froggs.de> wrote:
> Hi, Andrei asked some days ago how to load an image via PDL and but it
> in a Surface to use it in SDL.
>
> The example is here: https://gist.github.com/3772701
>
> I'll put that in the examples folder too.
>
> Cheers, Tobias

Reply via email to