On Aug 19, 2010, at 10:56 PM, Kyle Sluder wrote: > On Thu, Aug 19, 2010 at 4:54 PM, Quincey Morris > <quinceymor...@earthlink.net> wrote: >> On Aug 19, 2010, at 12:44, Brian Postow wrote: >> >>> ah, so, the way to zoom is to leave the NSImageView on >>> NSImageScaleProportionallyUpOrDown, and then change the size of the frame! >>> That gives me scrollbars! >> >> I had to go out for a while before finishing my last post, but I wanted to >> point out that you likely *don't* want to be using NSImageView at all for >> this. The problem is that you seem to want to be doing additional drawing >> (you mentioned selection rectangles) earlier, but consider that you almost >> certainly don't want such drawing to be scaled along with the image. There >> are 3 ways to deal with this: > > It sounds as if you're conflating bounds transformation scaling with > NSImageView size-to-fit-frame scaling. It's usually the case that you > don't want to rely on a scaled bounds coordinate system to draw zoomed > UI for the precise reason you mentioned: you need to untransform any > additional drawing, including any subview drawing. It is much cleaner > and simpler to use a custom zoom factor and scale your drawing within > -drawRect:. > > As for using NSImageView size-to-fit-frame scaling, and using > NSImageView in general, as long as Brian isn't attempting to do his > adornments within a -drawRect: override of an NSImageView subclass, it > might be appropriate for simple uses. You scale the frame, not the > bounds, of the image view, so all the coordinate systems make sense, > which means you can do adornment drawing in subviews of the image > view. > > In fact, that's one common way of doing selection rectangles: use a > subview to draw your selection lasso. Another common technique, useful > when your adornment drawing needs to span multiple views (and I > believe the only way to solve this before overlapping sibling views > were made legal) is to use a borderless NSWindow. This has the > advantage that it uses Quartz Extreme to composite the selection lasso > with the window contents, plus you can do things like fade out the > lasso when the user releases the mouse (kind of like Finder in 10.6) > without having to do any complicated timer drawing in your main > content view—all the fade animation stuff remains in your lasso > window. >
I don't need to worry about multiple views. I have a toolbar with controls, and a image view with scrollbars. that's the entire window. So, the trick for selection lasso is to make a separate NSView as a subview of the NSImageView, somehow make it transparent, and then use it to select the region of the NSImageView? interesting, that wouldn't have occured to me... > Brian Postow Senior Software Engineer Acordex Imaging Systems _______________________________________________ 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