From: Axel M. R. <ax...@me...> - 2007-07-10 09:27:54
|
Hi, I want to use the function elementAtIndex_associatedPoints from OSX::NSBezierPathElement, to get to the coordinates in a curve. However, this function requires an C array to (NSPoint *) to fill in its data. I'm just a newbie with Ruby, and it appears there are no such things as pointers, but there must be a way to use this function, right? What I tried so far, with curve being an NSBezierPathElement: ####### a = OSX::NSPoint.new b = OSX::NSPoint.new c = OSX::NSPoint.new elementCoords=[a,b,c] element=curve.elementAtIndex_associatedPoints(0,elementCoords) pnt=elementCoords[0] if pnt != nil px=pnt.x py=pnt.y end ####### The idea being, that I get the coordinate from pnt. however, when I examine a, a coordinate is never filled in, instead it stays at (0.0,0.0) I also tried to pack the array of structs with elementCoords=[a,b,c].pack('PPP') but get a lot of errors for that action. How am I supposed to make this work? The whole story about ObjCPtr is far too vague for me. Axel -- _____________________________ Axel M. Roest | AXEL Development & Support bv in...@ax... | Macintosh developer & UNIX sysadmin http://www.axel.nu | XOIP: 084-8749988 |