在 macOS 上的其他进程窗口中绘图?

发布于 2024-08-15 07:53:32 字数 192 浏览 1 评论 0原文

是否可以使用 Cocoa 或其他库在 MacOSX 上的其他进程窗口中进行绘制?
如果有,有样品吗?或者快速总结一下我必须做什么?
(我需要至少支持 OSX 10.5)

共享内存当然是一个可能的解决方案,但我更喜欢直接绘制以避免同步开销和代码重复(用例包括 一个生产者和n 个客户)。

Is it possible to draw in other processes windows on MacOSX using Cocoa or other libraries?
If yes, are there any samples? Alternatively a quick summary of what i'd have to do?
(I need to support at least OSX 10.5)

Shared memory is of course a possible solution, but i'd prefer direct drawing to avoid synchronization overhead and code duplication (the use-case consists of one producer and n clients).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦幻之岛 2024-08-22 07:53:32

这是 Mac OS X: Can 的副本一个进程渲染到另一个进程的窗口?
简短回答:如果您只需要支持 >=10.6,您可以使用 IOSurface API。
有关此帖子的详细信息:需要IOSurface 和 IOSurface 方面的帮助OpenGL for max os x Snow leopard 应用程序

如果您可以提供有关您尝试实现的目标的更多详细信息,可能还有其他一些解决方案。 (例如,将要渲染的内容合成到 CGWindowListCreateImage)

编辑:
在我看来,完成你想要的事情的最简单方法是使用某种共享内存。
您可以使用 mmap 并在您的应用程序之间共享绘图代码。

编辑2:
我刚刚看到你想避免共享内存。但为什么?

This is a duplicate of Mac OS X: Can one process render to another process’s window?
Short answer: If you only need to support >=10.6, you could probably use the IOSurface API.
Details about that in this post: Need help with IOSurface & OpenGL for max os x snow leopard application

If you can provide more details about what you try to achieve, there might be some other solutions. (e.g. Compositing the things you intend to render onto an image from CGWindowListCreateImage)

Edit:
To me it seems that the easiest way to accomplish what you want is to use some sort of shared memory.
You could map the data to visualize into memory with mmap and share the drawing code between your applications.

Edit2:
I just saw that you want to avoid shared memory. But why?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文