Re: NSImageView and ZoomFactors
Re: NSImageView and ZoomFactors
- Subject: Re: NSImageView and ZoomFactors
- From: Quincey Morris <email@hidden>
- Date: Thu, 19 Aug 2010 21:01:42 -0700
On Aug 19, 2010, at 19:56, Kyle Sluder wrote:
> 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'm not disputing the substance of any of this, and I may have taken too short a shortcut in what I said, but the difficulty in this discussion is that there are too many possible places where the scaling can be handled, so it's hard to be technically specific until the approach has first been chosen. It's certainly true that if you can move all of the non-scaled drawing to a different view then NSImageView is perfectly fine, although there's still manual work to be done because there are basically two required scaling modes.
> FWIW, I believe overlapping drawing became supported on 10.5, not 10.6.
10.6 has been out long enough that I can't keep tabs on what was new when, and I plead guilty to being too lazy to have checked.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden