> On Thu, Jun 12, 2008 at 2:54 PM, Nils Wagner
> <[EMAIL PROTECTED]> wrote:
>
>> src/ft2font.cpp: In member function 'Py::Object FT2Image::py_as_array(const
>> Py::Tuple&)':
>> src/ft2font.cpp:273: error: cannot convert 'int*' to 'npy_intp*' in argument
>> passing
>> error: command 'gcc' failed with exit status 1

Hmm, I had tried to use PyArray_SimpleNewFromData with an 'int
dimensions[2]' array, which worked on numpy 1.1 but apparently breaks
in the latest numpy svn.  Since I am unsure what is the most portable
thing to do here, I reverted to a pattern that we've used elsewhere
that appears robust across numpy versions (included below).  If any
numpy god wants to tell me the right way to create and array from an
existing buffer, let me know.

Fixed in svn 5495


 int dimensions[2];
 dimensions[0] = get_height();  //numrows
 dimensions[1] = get_width();   //numcols

 //this is breaking with numpy svn, which wants a npy_intp*
 //PyArrayObject *A = (PyArrayObject *) PyArray_SimpleNewFromData(2,
dimensions, PyArray_UBYTE, _buffer);


PS: please keep all replies on list.
 PyArrayObject *A = (PyArrayObject *) PyArray_FromDims(2, dimensions,
PyArray_UBYTE);


 unsigned char *src            = _buffer;
 unsigned char *src_end        = src + (dimensions[0] * dimensions[1]);
 unsigned char *dst            = (unsigned char *)A->data;

 while (src != src_end) {
   *dst++ = *src++;
 }


PS: please keep all replies on list

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to