What is the difference between making a Buffered Image, and drawing on its pixels using:
private BufferedImage img;
private int[] pixels;
pixels = ((DataBufferInt) img.getRaster().getDataBuffer());
And just using a Image for the
img
Variable And using img's graphics to do:
img.getGraphics().drawImage(/*image*/, x, y, observer);
EDIT:
This is for game development!!
Advantages of going via the Graphics methods:
drawImageAdvantages of going down to the pixel buffer level:
drawImage, because you don't get the hardware acceleration)If it's just regular in-game rendering of a screen, I'd say the Graphics route is probably best. If you're doing something fancy like on-the-fly image generation, then the pixel buffer route can be worth exploring.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With