Cool!!
My processing is over an array of int.
int[] pixels
Is there anyway to draw directly above this kind of data?
Another thing. I have done the following to draw in my out buffered image, after the processing:
BufferedImage out = new BufferedImage(imgCols, imgRows, BufferedImage.TYPE_INT_RGB);
out.setRGB(0, 0, imgCols, imgRows, pixels, 0, imgCols);
out.createGraphics().setColor(Color.GREEN);
out.createGraphics().drawLine(0,0,imgCols,imgRows);
In the file i save after this, the line color is white and i choose green.
Do you know why?
Many thx,
Nuno
The simplest way to do that is create a BufferedImage like you did and then take the DataBuffer of the BufferedImage like this:
int[] data = ((DataBufferInt) out.getRaster().getDataBuffer()).getData();
And copy your pixels to it:
System.arraycopy(pixels, 0, data, 0, pixels.length);
You have to use the same Graphics object after you set the color.
createGraphics creates a new Graphics object every time:
Graphics g = out.createGraphics();
g.setColor(Color.GREEN);
g.drawLine(0,0,imgCols,imgRows);