简体   繁体   中英

How to get the colour of a applet viewer pixel in Java?

I have drawn any picture, used Graphics 2D. How do I get the colour of a pixel at x, y? getPixelColor don't work, because this method get pixel from screen, not applet viewer coordinates.

  1. Draw the picture to the Graphics of a BufferedImage
  2. Draw the image to the Graphics2D .
  3. To get the color of any pixel, call BufferedImage.getRGB(x,y) or variants (check the docs.).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM