Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the most useful type of java.awt.image.BufferedImage for off-screen rendering? [closed]

I am creating a buffered image that is going to be a snapshot of a JComponent (via paint()) and rendered inside an ImageIcon. There are a large amount of types in the BufferedImage(int width, int height, int imageType) constructor, but which one should I use?

I am sure that any of them would work, but which ones are better than the others? How should I pick one? And Why?

like image 713
shemnon Avatar asked Nov 07 '08 03:11

shemnon


1 Answers

See GraphicsConfiguration.createCompatibleImage(int, int) for a helper to create a BufferedImage of a "good" type among the many available types.

How to get your hands on a GraphicsConfiguration instance to make this call? It depends on where your code is executing. See the many methods for getting your hands on a GraphicsConfiguration via methods like getGraphicsConfiguration() or getDeviceConfiguration().

like image 166
John M Avatar answered Oct 26 '22 22:10

John M