Hi guys,
After looking at the different Java lists I figured that 3D stuff has
most in common with what I'm trying to do.
I'd like to create a 2D graphics engine by writing all the graphics to a
simple memory buffer (an array of 24 bit pixels) then blitting the
result to the screen display.
However I haven't been able to find any information on doing this (I'm
guessing there's a faster way to do it then plotting pixels using the
built in 2d graphics class).
Also what's the best datatype for the frame buffers (and the
tiles/sprites graphics) is it a byte array, or something else (like a
bitset?)
Any help much appreciated
Thanks
Andrew
Sascha Ledinsky - 12 Dec 2003 16:00 GMT
try a java.awt.image.BufferedImage
BufferedImage bi = new BufferedImage(iWidth, iHeight, BufferedImage.TYPE_INT_RGB);
int[] frameBuffer = ((DataBufferInt)bufferedImage.getRaster().getDataBuffer()).getData();
now you can write your RGB values in the int-array, then draw the image with the drawImage() method...
hope this helps,
-sascha
> Hi guys,
>
[quoted text clipped - 18 lines]
>
> Andrew