PerlObjCBridge: calls to NSMakeSize_ (and NSMakeRect_) not working?
PerlObjCBridge: calls to NSMakeSize_ (and NSMakeRect_) not working?
- Subject: PerlObjCBridge: calls to NSMakeSize_ (and NSMakeRect_) not working?
- From: Stephen Sample <email@hidden>
- Date: Mon, 3 Oct 2005 11:38:26 -0400
I'm working on an image processing app in Perl that reads the file
metadata for a large collection of images, cleans it up in various
ways, and consolidates the data into a SQL store. I also need to
generate various sizes of thumbnails programmatically, but all the
standard Perl ways of doing this (like PerlMagick/ImageMagick) are
seriously slow, so I'm working on porting the scaling code to use
Core Image through the PerlObjCBridge.
I can load the frameworks, and setting up the scale transforms seems
to work, but when it comes time to set up the NSImage and render the
scaled image down to a bitmap, I'm getting rather strange errors from
PerlObjCBridge. I'm trying to create an empty image at the correct
size, lock focus on it, and create the NSBitmapImageRep from there,
but creating the NSSize for the initWithSize call is failing.
This may just be a matter of my not understanding PerlObjCBridge well
enough (or the error messages, for that matter), but I can't figure
out what is wrong with the code (or rather, how to fix it). The
relevant section (with the lines which throw errors outdented for
visibility) is:
# create an NSCIImageRep object for use in drawing
my $scaledNSCIImageRep = NSCIImageRep->imageRepWithCIImage_
($scaledCIImageData);
# create an empty NSImage to draw into
my $scaledNSImage = NSImage->initWithSize_(NSSize->NSMakeSize_
($finalImageWidth,$finalImageHeight));
# use the NSCIImageRep object to back the NSImage
$scaledNSImage->addRepresentation_($scaledNSCIImageRep);
# lock the focus on the NSImage and initialize a bitmap rep
from it (using the NSCIImageRep data)
$scaledNSImage->lockFocus;
my $scaledNSBitmapImageRep = NSBitmapImageRep-
>initWithFocusedViewRect_(NSRect->NSMakeRect_(0, 0,
$finalImageWidth, $finalImageHeight));
$scaledNSImage->unlockFocus;
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
**** ERROR **** PerlObjCBridge: error sending message NSMakeSize: at /
System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level/
PerlObjCBridge.pm line 230.
and if I use initWithSize_(NSMakeSize_($finalImageWidth,
$finalImageHeight)), I get
PerlObjCBridge::AUTOLOAD: reference package 171 and subroutine
package NSSize do not match. at /System/Library/Perl/Extras/5.8.6/
darwin-thread-multi-2level/PerlObjCBridge.pm line 188.
(in this case, 171 is the value of $finalImageWidth, in case that
wasn't clear).
I've tried turning on tracing with PerlObjCBridge::setTracing(), but
that didn't clarify the problem.
Thanks in advance for any suggestions.
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