• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PerlObjCBridge: calls to NSMakeSize_ (and NSMakeRect_) not working?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PerlObjCBridge: calls to NSMakeSize_ (and NSMakeRect_) not working?


  • Subject: Re: PerlObjCBridge: calls to NSMakeSize_ (and NSMakeRect_) not working?
  • From: Stephen Sample <email@hidden>
  • Date: Mon, 3 Oct 2005 15:23:48 -0400


On Oct 3, 2005, at 2:08 PM, Sherm Pendley wrote:

On Oct 3, 2005, at 11:38 AM, Stephen Sample wrote:


If I use initWithSize_(NSSize->NSMakeSize_($finalImageWidth, $finalImageHeight)) to create the NSImage, I get the error message:

**** ERROR **** PerlObjCBridge: sendObjcMessage: Can't get class object for class name NSSize


This paragraph from the end of "man PerlObjCBridge" seems rather relevant:


Access to functions, variables, and other non-object- oriented con-
structs exported by libraries containing Objective-C is not currently
supported.

You're right, I'd missed that. Charming.

So looking at the PerlObjCBridge.pm code, it looks like I could do this within the context of PerlObjCBridge by creating an XSUB that handles the struct stuff. Ugh, but at least it's somewhere to start.

Thanks in advance for any suggestions.

My obviously biased suggestion: You might think about using CamelBones instead of PerlObjCBridge. Not only are NSPoint, NSRange, NSRect, and NSSize structures supported, they're toll-free bridged, so all you have to do is pass a reference to a hash with the appropriate keys:


my $scaledNSImage = NSImage->initWithSize({ width=> $finalImageWidth, height=> $finalImageHeight});

Naturally, the standard NSMakeSize() and other functions are supported too. Have a look at:

<http://camelbones.sourceforge.net/documentation/reference/ structs/index.html>

I'd been shying away from loading extra frameworks, but not for any particularly good reason. I'll give it a try.


A quick hack of the code--mostly to strip off trailing underscores, and to remove explicit module loading code which isn't needed under CamelBones--looks promising, though I am getting an error on the lockFocus call. But that's more than I had before ;-)

Thanks for the pointers!


Ta -Stephen


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >PerlObjCBridge: calls to NSMakeSize_ (and NSMakeRect_) not working? (From: Stephen Sample <email@hidden>)
 >Re: PerlObjCBridge: calls to NSMakeSize_ (and NSMakeRect_) not working? (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: Cannot Save Britney Spears
  • Next by Date: Re: Single instance of properties window
  • Previous by thread: Re: PerlObjCBridge: calls to NSMakeSize_ (and NSMakeRect_) not working?
  • Next by thread: NSIndexSet: how is this supposed to work?
  • Index(es):
    • Date
    • Thread