From: Jonathan P. <jp...@dc...> - 2006-02-28 23:45:48
|
On 28 Feb 2006, at 22:39, Mario Pehle (Sorceforge) wrote: > I try to connect Core Image via RubyCocoa to Ruby. To write > processed images to hard disk, in need an image representation. In > one step I have to specify a CGRect as the region, which should be > taken for further steps. The CGRect is a struct defined in > CGGeometry (have a look at http://developer.apple.com/documentation/ > GraphicsImaging/Reference/CGGeometry/Reference/reference.html) > > In the sources of RubyCocoa I found a way to deal with enums, but > not with structs. Is this still implemented? And if "yes", how I > can make use of it? I don't think Core Image is properly supported yet in RubyCocoa (please correct me if I'm wrong). I seem to remember somebody else having a go at getting it to work a while back... I think arbitrary structs are not supported. However, since CGRect is structurally the same as an NSRect you can probably get away with this (untested): --- objc/ocdata_conv.m (revision 38) +++ objc/ocdata_conv.m (local) @@ -68,8 +68,15 @@ else if (strcmp(octype_str, @encode(NSRange)) == 0) { oct = _PRIV_C_NSRANGE; } - } - else if (octype_str[0] == '^') { + } else if (octype_str[0] == '{') { + if (strcmp(octype_str, @encode(CGRect)) == 0) { + oct = _PRIV_C_NSRECT; + } else if (strcmp(octype_str, @encode(CGPoint)) == 0) { + oct = _PRIV_C_NSPOINT; + } else if (strcmp(octype_str, @encode(CGSize)) == 0) { + oct = _PRIV_C_NSSIZE; + } + } else if (octype_str[0] == '^') { if (strcmp(octype_str, "^@") == 0) oct = _PRIV_C_ID_PTR; else |