开发者

Using views from other apps as CoreAnimation Layer

开发者 https://www.devze.com 2022-12-15 08:40 出处:网络
All, How can I use (NS)Views from other applica开发者_Go百科tions as Layers in my CA app. I.e. I\'d like to display a Keynote presentation as Layer in my CA app.

All,

How can I use (NS)Views from other applica开发者_Go百科tions 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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消