I could have sworn I saw a working example of IKImageView at one of the traveling "Leopard Technology Preview" seminars a while back, but after spending an entire weekend attempting to accomplish some incredibly basic tasks with it, I'm beginning to wonder if the lack of sample code in /Developer/Examples is indicative of the fact that it's not quite ready for prime-time.

The first problem I have is with the zoomImageToRect method, which the documentation claims "Zooms the image so that it fits in the specified rectangle." It does not state whose coordinate system this rectangle should be defined in, and in my testing all it ever actually does is scale the image down regardless of how big a rectangle you pass into it. I can give a 780 x 500px image the rect of the entire screen and my image is still scaled down to a zoomFactor of 0.316875011. Since the image fits inside the screen's bounds quite well without any scaling, I would expect zoomImageToRect to leave me with a zoomFactor of 1.0, but it doesn't. Clearly the documentation is inaccurate here. What is this method supposed to do?

My second problem is with zooming animation in general. Messaging setImageZoomFactor in the manner described in the following document:

http://developer.apple.com/documentation/GraphicsImaging/Conceptual/ImageKitProgrammingGuide/ImageViews/chapter_3_section_5.html#/ /apple_ref/doc/uid/TP40004907-CH4-DontLinkElementID_33

results in terrible visual performance. The animation that is drawn in response to an increase in zoom factor is anchored at the center of the image, but once this animation is complete, the view abruptly changes it's mind and the image visibly jumps in the window as its origin is repositioned to window 0, 0.

Seeing that an alternative method--setImageZoomFactor: centerPoint:-- seemed to offer a solution to this jumping origin, I decided to give it a whirl. The documentation defines "centerPoint" as "The point that specifies the origin of the zoom factor", but again it neglects to mention whose coordinate system this origin should be in (or why a variable which is supposed to define an origin would ever be given a name with the word "center" in it in the first place).

If I calculate the *actual* center point of the image--in either the image's or the view's coordinate system--it still jumps around like crazy. If I calculate where the image's origin point *should* be after the zoom in (i.e. beyond the lower left corner of the window content) it still jumps around like crazy. If I supply NSZeroPoint, then and only then does the zoom in animation draw as though it were anchored at the lower left hand corner with no jumping afterward. Unfortunately, this does not hold true for zooming out; when I do that, the animation still draws as though it were anchored at the origin, but after completion it abruptly re-centers itself in the view. So it can center itself then, it just can't do it when I actually want it to.

I thought that maybe it would work better if I embedded my IKImageView in an NSScrollerView so things could move around more freely, but I found that doing this actually causes all of the zoom methods to do nothing whatsoever--the image never changes no matter what I set it to.

I really hope that I'm doing something embarrassingly stupid here, but a search turned up this message from last year which suggests I'm not the only one who's seen this poor behavior:

http://lists.apple.com/archives/cocoa-dev/2007/Nov/msg00837.html

I've tried every conceivable option in the nib file, and nothing I do makes any difference. The only thing I can come up with at this point is that I'm supposed to manually resize the view frame in response to zooming if I want it to draw itself correctly, but this strikes me as being somewhat silly. Is anybody actually using this thing successfully? I tried the Quartz list and found no takers.

Thanks kids.


_______________________________________________

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