开发者

Drawing anywhere on screen in Mac OS X / Objective C

开发者 https://www.devze.com 2023-03-09 09:48 出处:网络
I\'m trying to create a little utility that will draw an arbitrary shape on the screen below开发者_JAVA技巧 the mouse pointer (basically like drawing a line that follows the cursor). This could be any

I'm trying to create a little utility that will draw an arbitrary shape on the screen below开发者_JAVA技巧 the mouse pointer (basically like drawing a line that follows the cursor). This could be anywhere on the screen not in a specific window.

My problem is that I can't figure out how to draw on the "screen". Is there a layer or a view object that I can use that references the overall os "view"? I've looked in NSScreen and don't see anything in there.

Any examples or ideas would be great.

Thanks.


Create a transparent overlay window over the area where you want to draw (this could be the whole screen or screens). Set the window level so it appears below the cursor. Apple has some sample code which may help.

0

精彩评论

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

关注公众号