allocation of pixel buffer
| From: | Chris Barker - NOAA Federal | Date: | Wed, 19 Jun 2013 19:31:36 +0000 |
| Subject: | allocation of pixel buffer | ||
| Groups: | php.gd.devel | ||
| Request: | Send a blank email to php-gd-devel+get-717@lists.php.net to get a copy of this message | ||
Folks,
I'm working on some new bindings of GD for Python. One of the things
I'd hoped to do is wrap the pixel buffer in a numpy array, so that
users could manipulate it with numpy functions (and nifty tools like
the nd-image package) and not have to copy the data back-and forthc
between gd and numpy.
However, I've noticed that the pixel buffer is allocated row-by-row,
rather than as oen big block of data. This make it impossible to share
the buffer with numpy, as numpy requires a single block of contiguous
memory.
It there a compelling reason for it to be allocated this way? or could
I re-write the allocation routines to allocate a single block of
memory? (still casting it to a **, so it would still be able to be
used in the same way in the rest of the code.
Honestly, I'm not sure I'd ever get around to it -- copying data isn't
all THAT expensive, but I was wondering if it's done this way for a
godo reason I'm not thinking of at the moment.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov