是否可以将 CIBumpDistortion 过滤器注入到 Mac OS X (Snow Leopard) 上屏幕的特定区域?

发布于 2024-09-26 19:17:52 字数 488 浏览 0 评论 0原文

我想使用 CIBumpDistortion 暂时扭曲鼠标下方的区域,以增加鼠标指针的可见性。

目前,我有一个透明背景的 NSWindow ,它漂浮在指针下方,并显示一个十字线,当您移动鼠标时该十字线会淡入,当您停止时该十字线会淡出。这工作正常,但凹凸扭曲会让我的应用很棒,而不是足够好

我尝试使用 CGDisplayCaptureWithOptions(display, kCGCaptureNoFill) ,但这会降低性能并导致鼠标指针卡顿。

这是我想要实现的目标的图像

请注意,我想要扭曲的区域不在我自己的 NSWindow 内,因此我认为我不能仅对 CIImage 应用转换并显示它(除非你们中的聪明人告诉我,您可以从屏幕的任意区域复制位图?)

提前致谢!

I want to temporarily distort the area under the mouse using a CIBumpDistortion to increase the visibility of the mouse pointer.

At the moment, I have a transparent-background NSWindow that floats around under the pointer and shows a cross-hair that fades in when you move the mouse, and out when you stop. This is working okay, but a Bump Distortion would make my app awesome instead of good enough.

I tried to use CGDisplayCaptureWithOptions(display, kCGCaptureNoFill), but that reduces the performance to a crawl and makes the mouse pointer stutter.

Here's an image of approximately what I'm trying to achieve.

Note, the area I want to distort is not inside my own NSWindow, so I don't think I can just apply a transformation to a CIImage and display that (unless one of you clever folks shows me that you can copy a bitmap from an arbitrary area of the screen?)

Thanks in advance!

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

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

发布评论

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

评论(1

各自安好 2024-10-03 19:17:52

请注意,我想要扭曲的区域不在我自己的 NSWindow 内,所以我认为我不能只对 CIImage 应用转换并显示它(除非你们中的一个聪明人向我展示您可以复制来自屏幕任意区域的位图?)

可以做!

获取窗口的 windowNumber,并使用 CGWindowList 创建其下所有内容的 CGImage 屏幕截图。然后,从 CGImage 创建一个 CIImage,通过过滤器运行它,并将输出图像设置为窗口显示的图像。

如果您仅在鼠标移动或屏幕在光标周围区域重绘时执行此操作(您可以为后者注册屏幕刷新回调),则可以非常有效地执行此操作。

Note, the area I want to distort is not inside my own NSWindow, so I don't think I can just apply a transformation to a CIImage and display that (unless one of you clever folks shows me that you can copy a bitmap from an arbitrary area of the screen?)

Can do!

Get your window's windowNumber, and use CGWindowList to create a CGImage screenshot of everything under it. Then, create a CIImage from the CGImage, run it through the filter, and set the output image as what your window displays.

Providing you only do this when the mouse moves or the screen redraws in the area around the cursor (you can register a screen refresh callback for the latter), you can do this quite effficiently.

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