Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Expected behavior of IKImageView's zoomImageToRect



I'm creating a very, very basic IKImageView in a window and I want the image to be displayed as large as is possible on the screen while maintaining proper proportions. Judging by the documentation, it seems as though passing the NSRect I get back from the main screen's visibleFrame to the IKImageView's zoomImageToRect method would scale the image appropriately, but what I'm seeing it do is reduce it for no apparent reason.

- (void) windowControllerDidLoadNib: (NSWindowController*) aController
{
	[mImage setImageWithURL: mFile];
	
	NSRect	screenGeometry	= [[NSScreen mainScreen] visibleFrame];
	NSRect	nativeGeometry;
	
	nativeGeometry.origin	= [[aController window] frame].origin;
	nativeGeometry.size	= [mImage imageSize];
	
	[mImage zoomImageToRect: screenGeometry];
	
	CGFloat zoomFactor	= mImage.zoomFactor;	
	
    	[super windowControllerDidLoadNib: aController];
}

When I run this and open a 780 x 500 image, screenGeometry's size is 1600 x 1128, and nativeGeometry's size is 780 x 500. While the unscaled image can fit quite easily within the bounds of the screen, the zoomImageToRect message results in a zoomFactor of 0.316875011, and the on screen image is much, much tinier than it should be.

I've disabled auto-resizing on the view, and I've tried adjusting the window's frame before and after the zoom to no avail. zoomImageToRect always reduces whether it needs to or not. Am I misusing this method or is it broken?


_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartz-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Bypassing ColorSync while printing (From: Nathan Duran <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.