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 (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

Reply via email to