This is because Cocoa cache the first representation it draws and then redraw the cached version.

Disabling the cache for your image should do the trick:

[_img setCacheMode:NSImageCacheNever];

Le 5 avr. 08 à 20:26, Mike R. Manzano a écrit :

I did try that at first, but the image becomes pixelated when you make the window larger. What I'm trying now is to do an initial scale of the image to some large dimensions, and then doing what you suggested. Maybe it will look fine if the only scaling it has to do is in the downwards direction.

Mike


On Apr 5, 2008, at 11:17 AM, Jean-Daniel Dupas wrote:


Le 5 avr. 08 à 19:53, Mike R. Manzano a écrit :
Hi everyone,

I have a window with a custom content view. The content view loads in a PDF image to be used as the window's background. I'd like the image to scale smoothly when the window is resized, so I set the source image to scale when resized (scalesWhenResized returns YES), and in my -drawRect: method, I'm setting the size of the image to the bounds of the view. This works exactly as I intended, except that it's really slow.

Is there a better way to do this that's much, much faster?

Thanks,

Mike


Do not manually resize your image and use -[NSImage drawInRect:fromRect:operation:fraction:] passing [self bounds] as first argument, and let the system resize the image as needed

You can also replace your custom view by a NSImageView.






_______________________________________________

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/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]


_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to