Re: Fast image loading + scrolling like iPhoto
Re: Fast image loading + scrolling like iPhoto
- Subject: Re: Fast image loading + scrolling like iPhoto
- From: John Fox <email@hidden>
- Date: Wed, 05 Jan 2005 12:12:08 -0800
Hi Florian:
It just so happens I've been working on just this problem, and have had pretty good success. There are a couple of tricks I've found:
* You can't use anything like NSImageView objects that are added as subviews: there's way too much overhead. Instead, you should draw each image directly to screen using the drawing methods in NSImageRep. I use a single view with a method that calculates a grid based on a "prototype" NSRect. The prototype is scaled up and down in size using a slider, in which case the grid layout is recalculated. I then keep an array of display objects, each of which is assigned a tag object corresponding to the index of that object in the array, and each of which is responsible for drawing to the exact NSRect that is assigned to it when the grid is laid out.
* Each display object has a BOOL ivar "useFastDisplay" based on which it either draws the image using the low-res "chunky pixel" image or the full size image.
* You need to register to receive notifications when the clip view's bounds changes so that you can toggle the "useFastDisplay" ivar as above. There was a post in December about just how to do this. I found it googling "NSScroller mouseUp".
Hope this helps. If not, drop me a line and I'll be happy to share some code snippets with you and/or anyone else that wants it.
Take care,
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden