zoom question
zoom question
- Subject: zoom question
- From: <email@hidden>
- Date: Fri, 11 Jun 2010 14:39:38 +0000
- Sensitivity: Normal
Hello,
I'm working on a droplet where a user can drop an eps image and
zoom in on it. I'm running it in Leopard 10.5.8. It's working
decently, but when I zoom it looks all pixelated.
>From experimenting, I found that if I add this code to the
"- (void)zoomIn:(id)sender" function it makes it better looking
but when the image gets bigger it slows down the program.
// -------------------------------------------
NSSize imageSize = [theImage size];
imageSize.width *= 1.000001f;
imageSize.height *= 1.000001f;
[theImage setSize:imageSize];
// -------------------------------------------
Is there a better way to do this to get a clean image when zooming?
Here's the other code:
// -------------------------------------------
#import "AppController.h"
@implementation AppController
- (BOOL)application:(NSApplication *)anApplication openFile:(NSString *)droppedFolderPath {
theImage = [[NSImage alloc] initWithData:[NSData dataWithContentsOfFile:droppedFolderPath]];
[theImageView setImage:theImage];
[theImageView setFrameSize:theImage.size];
return YES;
}
- (void)zoomIn:(id)sender {
NSScrollView *scrollView = theImageView.enclosingScrollView;
if (scrollView) {
NSClipView *clipView = scrollView.contentView;
NSRect visible = scrollView.documentVisibleRect;
NSRect bounds = clipView.bounds;
bounds.size.width *= 0.7f;
bounds.size.height *= 0.7f;
bounds.origin.x = NSMidX(visible) - bounds.size.width * 0.7f;
bounds.origin.y = NSMidY(visible) - bounds.size.height * 0.7f;
[clipView setBounds:bounds];
}
}
@end
// -------------------------------------------
Thanks for your help.
Jay
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden