Bridger,
Because ibtool runs from the command line, it is executed without a connection to the window server so it can be run remotely in non- graphical login sessions. This environment might exist, for example, on a build server with nobody logged in at the console.

You'll need to find another way to crop your image. This post by Ken Ferry might help:
http://www.cocoabuilder.com/archive/message/cocoa/2008/8/5/214909

-Joey


On Jan 29, 2009, at 3:54 PM, Bridger Maxwell wrote:

It turns out the error is completely different from what I thought it was (isn't it always?). It turns out Xcode was omitting part of the output from IBTool. When I tried to compile my xib from Terminal, I got this error:

Description: ibtool encountered an error while loading the ibplugin from /Users/bridger/Development/Mercury/MercuryStation/build/Debug/ SCMercury.framework/Versions/A/Resources/SCThemes.ibplugin. Error: Error Domain=com.apple.InterfaceBuilder Code=-1 UserInfo=0x6e9e90 "Interface Builder could not load the 'Themes' plug-in because an exception
was raised.

Exception name: NSInternalInconsistencyException
Reason: Error (1002) creating CGSWindow"

I Googled around a bit, and I know it has something to do with drawing. In
fact, I have narrowed it down to these lines of code:

   NSImage * canvas = [[NSImage alloc] initWithSize: canvas_size];

   [canvas lockFocus];

...

   [canvas unlockFocus];


This is a vital part of my plugin though. I use this in an NSImage category which crops an NSImage. Why does lockFocus cause IB compilation errors, and
can how can I fix it?


Also, here is the NSImage category in its entirety. I actually took it from
someone else on this list a while back.


- (NSImage *) imageFromRect: (NSRect) rect

{

   NSAffineTransform * xform = [NSAffineTransform transform];

    // translate reference frame to map rectangle 'rect' into first
quadrant

   [xform translateXBy: -rect.origin.x

                   yBy: -rect.origin.y];



   NSSize canvas_size = [xform transformSize: rect.size];

    NSImage * canvas = [[NSImage alloc] initWithSize: canvas_size];

   [canvas lockFocus];

    [xform concat];



   // Get NSImageRep of image

   NSImageRep * rep = [self bestRepresentationForDevice: nil];


   [rep drawAtPoint: NSZeroPoint];



   [canvas unlockFocus];

   return [canvas autorelease];

return nil;

}


Thank You,

Bridger Maxwell
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hagedorn%40apple.com

This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to