スポイトツールなアレ

NSResponderのサブクラスXを作って、WindowのinitialFirstResponderにXのインスタンスを設定。

で、Xでは、awakeFromNibのときに、[window setAcceptsMouseMovedEvents: YES]をする必要あり。ここでwindowはWindowのインスタンス。

また、mouseMoved: 中に、[NSEvent mouseLocation]でスクリーン上での座標を取得、そいつをNSReadPixcel()に渡して、その点のNSColorを取得。

で、こうするとWindow上以外の点では問題なく色を取得できるけど、Window上にマウスポインタを移動すると落ちる。

以上、テキトーなメモ。


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img localsrc="" alt="">