How does this buffer interface relate to numeric python arrays?  Numpy
arrays sound like a useful way of passing buffers round.  You can get the
array to use the data from another your t1python's internal structures.

As for keeping things consistent, it looks like you can get the numpy
array to keep a reference to the t1python structure, so that the array
data is not freed while the array is still in use, by setting the
PyArray_Object structure's base field.

I am going to write wrappers for some of the gdkrgb functions for pygtk,
and will include numpy versions that can render from a numpy array (if
numpy is available).  This would remove most the array copying from the
process of rendering the pixel data.  For more information on the gdkrgb
functions, look at the header $(gtk_prefix)/include/gdk/gdkrgb.h.  It is
basically a set of routines for efficiently rendering RGB, greyscale or
indexed image data to an drawable.

There may already be a similar interface in PIL for rendering numpy arrays
(I haven't looked, but it sounds reasonable that there would be support
for it).

Of course, I may have misunderstood what you want this buffer interface to
do.  If so, could you point out what features you are after that aren't
provided by numpy?

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Wed, 4 Aug 1999, Fred L. Drake, Jr. wrote:

> 
>   There has been a bit of discussion lately regarding the buffer
> interface to objects in the C API.  Some of this has been on the main
> list (comp.lang.python) and some has been on other Python-related
> lists.
>   I have a question that I don't recall seeing answered (or asked):
> What is the real intent of the buffer interface?  When should a Python 
> C type implement it?
>   The context is this:  the t1python package (an interface to a Type1
> font renderer) has, in the past, been passing bitmaps back to Python
> as string objects.  In the next release, I may create a new type in
> the C layer that provides all the interesting stuff, and would like to 
> be able to convert these "glyph" objects to PIL images and GTK+/GNOME
> compatible images.  Does it make the most sense for the glyph objects
> to offer the buffer interface to make more conversions possible
> without increasing the number of memory copies, or do I misunderstand
> the application of the interface?
>   I'd appreciate some input on this matter.  I hope to get the next
> release of t1python done before too much longer, and this is probably
> the biggest remaining question that I need to deal with.
>   (Any other feedback on t1python would be useful as well!)
>   Thanks!
> 
> 
>   -Fred
> 
> --
> Fred L. Drake, Jr.         <[EMAIL PROTECTED]>
> Corporation for National Research Initiatives
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to