好的,所以我有:
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle screenRectangle = new Rectangle(screenSize);
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(screenRectangle)
int w = image.getWidth(null);
int h = image.getHeight(null);
int[] rgbs = new int[w*h];
image.getRGB(0, 0, w, h, rgbs, 0, w);
// find your pixel in the rgbs array
for(int y=0;y<h;y++) {
for(int x=0;x<w;x++) {
if(rgbs[(y*w) + x] == mypixel) { // mypixel
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
}
}
有人可以向我解释一下,或者给我一个 mypixel 可能是什么的例子吗?答案可能很明显,但我有点困惑。提前致谢