List of usage examples for java.awt.image DirectColorModel createCompatibleSampleModel
public SampleModel createCompatibleSampleModel(int w, int h)
From source file:de.mfo.jsurf.grid.RotationGrid.java
static BufferedImage createBufferedImageFromRGB(ImgBuffer ib) { int w = ib.width; int h = ib.height; DirectColorModel colormodel = new DirectColorModel(24, 0xff0000, 0xff00, 0xff); SampleModel sampleModel = colormodel.createCompatibleSampleModel(w, h); DataBufferInt data = new DataBufferInt(ib.rgbBuffer, w * h); WritableRaster raster = WritableRaster.createWritableRaster(sampleModel, data, new Point(0, 0)); return new BufferedImage(colormodel, raster, false, null); }