I have an IKIMageView inside of a scroll view that can be zoomed. I would like 
to be able to capture the visible portion of the image to an NSImage.

I've tried the following code example to create an image rep and then use that 
to create a new NSImage. I've tried it on the scroll view, the scroll clip view 
and the image view iself and none of them give me the portion of the image 
visible in the image view.  The scroll view and clip view return an all white 
image, and the image view seems to return nothing.

[view lockFocus];
NSBitmapImageRep *bits = [[NSBitmapImageRep alloc] initWithFocusedViewRect: 
[view bounds]];
[view unlockFocus];

I know the image view has a valid image because I can ask for it and construct 
a new image from the CGImageRef, but that is the original, full size image, not 
the visible scaled portion.

Thanks in advance for any suggestions.


_______________________________________________

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