views:

65

answers:

2

All,

How can I use (NS)Views from other applications as Layers in my CA app. I.e. I'd like to display a Keynote presentation as Layer in my CA app.

I found the iChatTheatre API which looks promising - however I'd need the oposite. An API to get the contents from an app - not to provide it.

Any pointers?

Thanks.

A: 

Take a look at the "Son of Grab" sample.
It shows you how to use the CGWindow*() API that was introduced with Mac OS X 10.5
The API allows you to get the content of a whole window, so you have to find a way to get the portions of the window you are interested in.

weichsel
The code looks good. Taking care of the portions of the window is not a problem at the moment. I'm currently interested in keynote fullscreen content at the moment.This also seems to be fast enough to cope with non-static content.
Udo Schneider
A: 

I don't believe there's a public way to do what you're talking about. Your best approach is probably to reverse-engineer the iChat AV system (the receiving side) and see if you can replicate it. Some initial work has been done by the ICP project. It's very sketchy, but it's a start.

Another approach is the QuickLook API, which has the advantage of not having to run the source application. So far Apple hasn't made the reading side of that API available either. Ciarán Walsh did some handy reverse engineering on QL a couple of years ago, and I've played with that approach, but it is somewhat klunky. You can generate the panel as Ciarán explains, but put it off screen. You can then copy the contents into an NSImage using NSBitmapImageRep -initWithFocusedViewRect:. Unfortunately you can wind up with some funky visual artifacts in this (like scroll bars in some cases), but for some applications it can be effective.

Rob Napier
The QL stuff looks very promising. Thanks.I was using NSView -dataWithPDFInsideRect: to get a somewhat scalable represenation up to now ... but you do some visual "features" as well.I still wonder how to deal with non-static content however ...
Udo Schneider