From: Duncan M. <du...@on...> - 2009-04-27 09:56:21
|
Thank you very much - timely and practical. Duncan On 27 Apr 2009, at 10:51, Allison Newman wrote: > Hi Duncan, > > I don't know about anyone else, but here's what I do when I want to > use NSData: > > rect = [0, 0, image_params.width_pt, > image_params.height_pt].pack('L_*') > data = NSData.alloc.initWithBytes_length(rect, 16) > > Of course there are probably a few zillion other ways of achieving > the same aim. Hope that helps. > > Alli > > On Monday, April 27, 2009, at 11:05AM, "Duncan McGregor" <du...@on... > > wrote: >> Sorry to have to ask this, but Sourceforge's mailing list search is >> so >> bad that I can't find an answer even if it exists. >> >> I'm trying to put a CGRect into an NSData >> >> rect_pt = CGRectMake(0, 0, image_params.width_pt, >> image_params.height_pt) >> data = NSData.alloc.initWithBytes_length(rect_pt, 16) >> >> ArgumentError: Expected either String/Array/ObjcPtr for argument #0 >> (but got OSX::CGRect). >> >> How do I create the ObjcPtr from a CGRect? >> >> Thanks in anticipation >> >> Duncan McGregor >> www.VelOCRaptor.com - Simple Mac OCR >> >> PS - Is there a better way of creating an NSData from a structure? |