Re: [Cython] 2d buffer interface with aligned data

2012-07-18 Thread Dag Sverre Seljebotn
If the image will always be 2D, you can add cdef Py_ssize_t shape[2] To your cdef class and assign self.shape to the Py_buffer. This is a bit more efficient. Dag -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. Christian Heimes wrote: Am 17.07.2012 22:55, schrieb Chris

Re: [Cython] 2d buffer interface with aligned data

2012-07-18 Thread Christian Heimes
Am 18.07.2012 07:18, schrieb Stefan Behnel: > BTW, note that your question is better suited for the Cython users mailing > list than the core developer mailing list. I'm sorry. I didn't know Cython had a user list, too. Thanks Stefan! Christian ___ cyth

Re: [Cython] 2d buffer interface with aligned data

2012-07-18 Thread Christian Heimes
Am 17.07.2012 22:55, schrieb Christian Heimes: > Either I'm doing something wrong or I found a Cython bug. I've attached > two files. The output is unexpected and looks like something is > accessing uninitialized memory: For the record: It's my fault. The shade and stripes Py_ssize_t* arrays can't

Re: [Cython] 2d buffer interface with aligned data

2012-07-17 Thread Stefan Behnel
Christian Heimes, 17.07.2012 22:55: > Am 17.07.2012 18:55, schrieb Dag Sverre Seljebotn: >> Read PEP 3118. Then implement __getbuffer__ and __releasebuffer__ in >> your cdef class (don't know if it's documented but you can see example >> in tests/run/buffer.pyx). > > The new buffer interface from

Re: [Cython] 2d buffer interface with aligned data

2012-07-17 Thread Nathaniel Smith
On Tue, Jul 17, 2012 at 9:55 PM, Christian Heimes wrote: > Am 17.07.2012 18:55, schrieb Dag Sverre Seljebotn: >> Read PEP 3118. Then implement __getbuffer__ and __releasebuffer__ in >> your cdef class (don't know if it's documented but you can see example >> in tests/run/buffer.pyx). > > The new b

Re: [Cython] 2d buffer interface with aligned data

2012-07-17 Thread Christian Heimes
Am 17.07.2012 18:55, schrieb Dag Sverre Seljebotn: > Read PEP 3118. Then implement __getbuffer__ and __releasebuffer__ in > your cdef class (don't know if it's documented but you can see example > in tests/run/buffer.pyx). The new buffer interface from PEP 3118 is only available for Python 2.6 and

Re: [Cython] 2d buffer interface with aligned data

2012-07-17 Thread Dag Sverre Seljebotn
On 07/17/2012 05:38 PM, Christian Heimes wrote: Hello, I'm the author of https://bitbucket.org/tiran/smc.freeimage , a Cython wrapper of the FreeImage and LCMS libraries. FreeImage supports a broad variety of image formats and pixel formats from standard RGB up to RGBAF and complex numbers. Now

Re: [Cython] 2d buffer interface with aligned data

2012-07-17 Thread Dag Sverre Seljebotn
On 07/17/2012 06:55 PM, Dag Sverre Seljebotn wrote: On 07/17/2012 05:38 PM, Christian Heimes wrote: Hello, I'm the author of https://bitbucket.org/tiran/smc.freeimage , a Cython wrapper of the FreeImage and LCMS libraries. FreeImage supports a broad variety of image formats and pixel formats fr

[Cython] 2d buffer interface with aligned data

2012-07-17 Thread Christian Heimes
Hello, I'm the author of https://bitbucket.org/tiran/smc.freeimage , a Cython wrapper of the FreeImage and LCMS libraries. FreeImage supports a broad variety of image formats and pixel formats from standard RGB up to RGBAF and complex numbers. Now I like to add support for buffer interface to my