How do I detect if a screen has predefined bitmap area rendered in 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 lan开发者_如何转开发g.
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).
You can check if a view or even any object is visible using
if (object.superview)
To check the alpha (alpha = 1 is visible alpha = 0 is hidden
if (object.alpha == 1)
Or you can check for hidden objects like this:
if (object.hidden)
And check if object have been unhidden:
if (!object.hidden)
精彩评论