Re: drawing on top of a NSMovieView?
Re: drawing on top of a NSMovieView?
- Subject: Re: drawing on top of a NSMovieView?
- From: Scott Thompson <email@hidden>
- Date: Thu, 15 Apr 2004 07:27:15 -0500
On Apr 14, 2004, at 11:47 PM, Steve Christensen wrote:
I have a window containing a NSMovieView plus another NSView on top of
it that draws a variety of items (text, graphics, etc.). All is well
in the world until I have the move start playing, and then the view in
front of the movie gets "erased" as the movie plays.
Is there a recommended way to be able to redraw the top NSView as each
frame in the NSMovieView is displayed? I see that, for example, iDVD
handles that correctly with their animated themes, but don't have a
good idea about how to go about it myself.
I can think of a couple of ways to go about that. One would be to
install a "drawing complete proc" on the movie using
SetMovieDrawingCompleteProc. This proc is called every time the movie
finishes drawing a frame and you could call "setNeedsDisplay" in your
front view every time it's called.
Rather than having two overlapping views, the way I handle it in my
application is putting the movie and the other images all into the same
view. I create a new offscreen GWorld using QTNewGWorldFromPtr and I
create a CGImageRef that shares the same memory space using
CGImageCreate. Then I set the Quicktime Movie to play in the GWorld
and install a drawing complete proc on the movie. When the movie
complete proc fires, I send a "setNeedsDisplay" to my view. The view
knows that it has to draw the movie so it draws the CGImage (which
copies the move frame into my view) and then draws whatever other items
might intersect that rect over the movie's frame.
Other Quicktime samples that draw into the movie view do so by creating
a custom decompressor component that is, for all intents and purposes,
a subclass of the standard decompressor component that the movie uses.
The component then calls it's "superclass" to draw the movie frame and
then adds whatever other information it might care to on top of it.
Finally, there are some samples that actually use OpenGL routines to
composite complex QuickTime information together. There were some very
interesting WWDC sessions related to that topic either last year or the
year before. The one I'm thinking of combined both the techniques I
mentioned (custom decompressor and drawing complete proc) along with
high-speed compositing through OpenGL (which allowed the computer to
offload the compositing operation to the CPU on the video card). You
could watch them if you happen to have access to the DVDs from those
sessions.
Scott
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.