Hi, I have a situation where I want to update the pixel buffer (int[]) for my BufferedImage.
I get the int array with the pixel info like this: img = gc.createCompatibleImage(w, h, transparency); imgData = (DataBufferInt)img.getRaster().getDataBuffer(); pixBuffer = imgData.getData(); Now I can alter the contents of the pixBuffer, however if I want to recreate the pixBuffer with a new int[] the reference to this new pixBuffer is lost by the BufferedImage, whats the best way of recreating this reference? I currently do it like this, but im not sure its the best way: DataBufferInt buffer = new DataBufferInt(pixBuffer, pixBuffer.length); SampleModel sm = cm.createCompatibleSampleModel(width, height); WritableRaster raster = Raster.createWritableRaster(sm, buffer, null); img.setData(raster); I also tried: WritableRaster raster = img.getRaster(); raster.setElementData(0,0, pixBuffer); But that doesnt seem to work? Thanks! Martijn [Message sent by forum member 'bitshit' (bitshit)] http://forums.java.net/jive/thread.jspa?messageID=252368 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
