Scaling an NSMovie proportionally
Scaling an NSMovie proportionally
- Subject: Scaling an NSMovie proportionally
- From: Chris Gehlker <email@hidden>
- Date: Sat, 15 Dec 2001 23:27:10 -0700
I've received some off list questions on this. I thought I'd answer
everybody at once.
This is not as simple as it sounds. You can get close if the NSMovieView
covers most off the area of a setAspectRatioed window. But this isn't really
accurate because setAspectRatio works on the whole window frame, not just
the content area. (I think this is a misfeature of setAspectRatio:).
The best way to do it is to derive a class from NSMovieView and override
movieRect: to keep the movie proportional. This works great for upsizing.
Downsizing leaves artifacts all over the screen. There are only two ways to
deal with this that I have found. 1) Draw over the artifacts a la the
QuickTime player. 2) Implement a drawRect: method in your derived class and
sending NSMovieView a drawRect: from there after calling something like
NSEraseRect: to clean up the frame. This latter method seems to work fine
despite the explicit advise in the NSView docs *not* to send drawRect: to
super.
Anybody else have any advise in this area?
--
Many individuals have, like uncut diamonds, shining qualities beneath a
rough exterior. - Juvenal, poet (c. 60-140)