On May 6, 2010, at 8:03 PM, Laurent Sansonetti wrote: > You're right, the Pointer class must be used. Sorry about the lack of > documentation. Here is a snippet that might work: > > # n must be defined > origins = Pointer.new(CGPoint.type, n) # this builds a pointer to n times > CGPoint > CTFrameGetLineOrigins(frame, CFRange.new(0, n), origins) > >> 2. How to access the individual CGPoints in the returned buffer? This is not >> an Objective-C / MacRuby array object. It is just an address to a buffer. >> Easy to do in C, but how to do in MacRuby? > > Using Pointer#[] you can simply dereference a given slot in the pointer, as > in C. > > n.times { |i| p origins[i] } # should print nth points > > Let me know if this works or not for you.
If it does, I can see this being a useful entry in Matt's book! - Jordan _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel