Re: Bundled Image scaled down when displayed (drawAtPoint) - Thank you
Jens, Quincey, Thank you for all the valuable info. My image dpi is indeed higher than 72. Combining your info, I elected to use, for now: NSImage* tempImage = [NSImage imageNamed: @"image1"]; NSImageRep *rep = [tempImage bestRepresentationForDevice: nil]; int width = (int)rep.pixelsWide; int height = (int)rep.pixelsHigh; [tempImage setSize:NSMakeSize(width, height)]; [tempImage drawAtPoint:point fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; [tempImage release]; Thanks again, Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com
Bundled Image scaled down when displayed (drawAtPoint)
Hello, all! Happy 4th of July weekend! I am currently learning Cocoa/Objective C with XCode 4.0.2 and the 10.6 SDK. I had started to learn a few Cocoa bits way back when it first showed up with 10.0 preview (thanks to the student developer program) but ended up spending most of my programming time in AWT/Swing Java instead. Here is my issue: It looks like when I run the app, my bundled image is scaled down to about 75% of it is actual size. I have tried to look for a reason why my bundled image is scaled down when displayed via google searches but apparently cant find the right search terms to find an answer, and none of the sample code and apple documentation I have seen so far indicate that anything should be done in Interface Builder. Is there some kind of resolution setting in InterfaceBuilder for my Custom NSView element or MainWindow? Here is what I have in my custom NSView subclass drawRect method : *** [NSColor blackColor] setFill]; NSRectFill([self bounds]); NSString* imageName = [[NSBundle mainBundle] pathForResource:@"image1" ofType:@"png"]; NSLog(@"imageName:%@",imageName); NSImage* tempImage = [[NSImage alloc] initWithContentsOfFile:imageName]; // Draw the image in the current context. [tempImage drawAtPoint:point fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; [tempImage release]; *** Any help, pointer would be greatly appreciated. Thank you, Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com