鼠标显示颜色
我正在尝试制作一个应用程序来显示我的鼠标指向的颜色,我不是指在我自己的应用程序中,而是在任何屏幕上的窗口中的任何位置,有点像我的鼠标指针旁边的标签,显示确切的颜色。
我是一名 Java 开发人员,但我不认为这可以在 Java 中完成,我想也许我需要某种脚本但我不知道是否会真正得到任何帮助
i am trying to make an application which would show which color my mouse is pointing to, i dont mean in my own application but anywhere in windows on any screen, kind of like a tag beside my mouse pointer which shows the exact color.
I am a Java developer but i dont think this could be done in java i am thinking maybe i need some sort of script but i have no idea any help would be really appriciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
随意选择: http://rosettacode.org/wiki/Color_of_a_screen_pixel
有一个 Java/AWT 示例, AutoHotKey 是一个简单的脚本选项。
第二个 C 示例显示了您需要的 3 个 API 调用
GetDC/GetCursorPos/GetPixel
及其支持代码,这些可以在为 Windows 编译的大多数语言中使用。Take your pick: http://rosettacode.org/wiki/Color_of_a_screen_pixel
There is a Java/AWT example, an AutoHotKey is a simple scripted option.
The second C example shows the 3 API calls you need
GetDC/GetCursorPos/GetPixel
and their support code, these can be used from most languages that compile for windows.该解决方案由两部分组成:
第 1 部分:检索颜色:
第 2 部分:获取颜色名称:
您可以从 维基百科的颜色列表。您可以根据 Wikipedia 上的数据在 Java 中创建映射。
也许您可以从几种颜色开始,并为未知颜色提供通用的十六进制表示,例如
#rrggbb
。The solution consists of two parts:
Part 1: Retrieving the color:
Part 2: Getting the color name:
You can get a list of many colors and their names from Wikipedia's List of colors. You can create a mapping in Java given the data on Wikipedia.
Perhaps you can start with a few colors, and provide a generic hex representation for unknown colors, for example
#rrggbb
.这是可运行的示例,
}
Here is the runnable example,
}