Graphics2D
在从 a 创建的对象内绘制面板的内容,BufferedImage
然后检索像素颜色:
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g2 = image.createGraphics();
_mainPanel.paint(g2);
image.getColorModel().getRGB(pixel);
g2.dispose();