通过了解jpanel中一个点的坐标,我如何获得其颜色?
绘制由BufferedImage
创建的Graphics2D
对象内的面板的内容,然后检索像素颜色:
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g2 = image.createGraphics();
_mainPanel.paint(g2);
image.getColorModel().getRGB(pixel);
g2.dispose();