如何检测屏幕是否具有在 Cocoa 中渲染的预定义位图区域?
首先,标题可能会产生误导,因为我不知道如何正确地提出我的问题,因为英语不是我的母语。
要点是:我有一个位图,一个图标,是从桌面的屏幕截图中提取的。我想检查当前的屏幕状态(即渲染我当前运行的所有应用程序)是否有该图标(位图中)可见?
问题是,Cocoa 中的方法是什么?
提前致谢。
编辑:
我的目标是编写一个宏应用程序,当屏幕上或打开的应用程序(可能隐藏)发生某些事情时,它会执行某些操作。
First off, the title may be misleading, cos I don't know how to formulate my question properly since english isn't my native lang.
The point is: I have a bitmap, an icon, that has been extracted from a desktop's screenshot. And I want to check if current screen state (that's rendering all apps I run at the moment) has that icon (in the bitmap) visible?
And the question is, what is the approach in Cocoa?
Thanks in advance.
Edit:
My goal is to write a macro application that will do something when something happens on the screen or in open app (possibly hidden).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用检查视图甚至任何对象是否可见
来检查 alpha (alpha = 1 可见 alpha = 0 隐藏
或者您可以像这样检查隐藏对象:
并检查对象是否已取消隐藏:
You can check if a view or even any object is visible using
To check the alpha (alpha = 1 is visible alpha = 0 is hidden
Or you can check for hidden objects like this:
And check if object have been unhidden: