From: Allison N. <dem...@ma...> - 2009-04-27 09:52:09
|
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? > > >------------------------------------------------------------------------------ >Crystal Reports - New Free Runtime and 30 Day Trial >Check out the new simplified licensign option that enables unlimited >royalty-free distribution of the report engine for externally facing >server and web deployment. >http://p.sf.net/sfu/businessobjects >_______________________________________________ >Rubycocoa-talk mailing list >Rub...@li... >https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk > > |