Re: SDL::Surface::new_from and PLot question

[email protected] (David Mertens)
Newsgroups perl.sdl.devel
Message-ID <[email protected]>
On Mon, Nov 16, 2009 at 1:54 PM, Kartik Thakore <[email protected]>wrote:

> Hi,
>
> So I fixed new_from to prevent it from segfaulting. Now as for direct write
> from PLot to Surface, where can I see the how the raw data is stored and
> made acessible in PDL.
>
> Kartik Thakore
>

Kartik -

I've never looked too closely at the internals of PDL to know precisely how
it stores the data, but as I understand, the data is typically stored in a
packed scalar.  The proper way to get at this data is using the get_dataref
and upd_data member functions.  These functions are discussed here:
http://search.cpan.org/~chm/PDL-2.4.5/Basic/Core/Core.pm.PL#get_dataref

For the PDL folks, who probably don't know what's going on, I am trying to
make PLplot play with SDL.  I would like to quickly draw animations of
plots.  Doug wrote an option into PLplot that allows it to plot to a memory
location, and PDL::Graphics::PLplot is capable of specifying a piddle for
this purpose.  His original intention was to allow him to load an image into
a piddle and overlay a graph.  My intention is to make an SDL surface that
uses the same memory location as a PLplot output, so that I can use SDL's
quick redrawing mechanisms for fast interactive plotting.  I don't actually
need to get PDL involved in this - SDL would do well to interact directly
with PLplot - but it's probably a good idea to interface SDL::Surfaces with
PDL while we're at it.

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.