Re: [Pyobjc-dev] Variable-length array argument
Brought to you by:
ronaldoussoren
|
From: Ronald O. <ron...@ma...> - 2009-03-24 15:31:03
|
In theorie an array.array of kind 'I' should work, although I haven't
checked if the metadata is entirely correct for this method. You'll
have the largest chance for success with a recent checkout of pyobjc-
core and pyobjc-framework-Cocoa.
Time to write a unittest for this specific case...
Ronald
On 24 Mar, 2009, at 15:13, Orestis Markou wrote:
> Hello,
>
> I'm trying to call NSBitmapImageRep getPixel:atX:y:. The issue is that
> the signature is like this:
> - (void)getPixel:(NSUInteger[])pixelData atX:(NSInteger)x y:
> (NSInteger)y
>
> And expects a pointer to an array, which is variable in length as it
> depends on the type of the bitmap representation. Here's the things
> I've tried:
>
> * Passing None: exceptions.TypeError: Need explict buffer for
> variable-length array argument
> * Passing objc.NULL: works but doesn't return anything :/
> * Passing lists/strings: exceptions.ValueError: argument 0 must be
> None or objc.NULL
> * Passing an array.array('i'): exceptions.ValueError: type mismatch
> between array.array of i and and C array of I8i12i16
> * Passing an array.array('I'): bus error
> * Passing an array.array('I'), but initialised to size 100 with
> zeroes: exceptions.SystemError: NULL result without error in
> PyObject_Call
>
> I've run out of things to try. So far as I can trace the code, I need
> to pass something that is accepted by PyObject_AsWriteBuffer, and can
> also be converted to this complex c array by PyObjC_PythonToCArray.
> Any pointers on how I can do that?
>
> Thanks,
> Orestis
> --
> or...@or...
> http://orestis.gr/
>
>
>
>
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM)
> are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly
> and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based
> development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> Pyobjc-dev mailing list
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
|