Java Code Examples for java.awt.image.Raster#getDataBuffer()
The following examples show how to use
java.awt.image.Raster#getDataBuffer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataBufferGrabber.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 6 votes |
protected void paintComponent(Graphics g) { // create an image BufferedImage bImg = new BufferedImage(SWATCH_SIZE, SWATCH_SIZE, BufferedImage.TYPE_INT_RGB); Graphics gImage = bImg.getGraphics(); gImage.setColor(Color.WHITE); gImage.fillRect(0, 0, SWATCH_SIZE, SWATCH_SIZE); // Time how long it takes to copy the managed version long managedTime = copyImage(g, bImg, 0, 0); System.out.println("Managed: " + managedTime + " ms"); // Now grab the pixel array, change the colors, re-run the test Raster raster = bImg.getRaster(); DataBufferInt dataBuffer = (DataBufferInt)raster.getDataBuffer(); int pixels[] = dataBuffer.getData(); for (int i = 0; i < pixels.length; ++i) { // Make all pixels black pixels[i] = 0; } // Time this un-managed copy long unmanagedTime = copyImage(g, bImg, SWATCH_SIZE, 0); System.out.println("Unmanaged: " + unmanagedTime + " ms"); }
Example 2
Source File: CustomCompositeTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 3
Source File: CustomCompositeTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 4
Source File: MultipleGradientPaintContext.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public final Raster getRaster(int x, int y, int w, int h) { // If working raster is big enough, reuse it. Otherwise, // build a large enough new one. Raster raster = saved; if (raster == null || raster.getWidth() < w || raster.getHeight() < h) { raster = getCachedRaster(model, w, h); saved = raster; } // Access raster internal int array. Because we use a DirectColorModel, // we know the DataBuffer is of type DataBufferInt and the SampleModel // is SinglePixelPackedSampleModel. // Adjust for initial offset in DataBuffer and also for the scanline // stride. // These calls make the DataBuffer non-acceleratable, but the // Raster is never Stable long enough to accelerate anyway... DataBufferInt rasterDB = (DataBufferInt)raster.getDataBuffer(); int[] pixels = rasterDB.getData(0); int off = rasterDB.getOffset(); int scanlineStride = ((SinglePixelPackedSampleModel) raster.getSampleModel()).getScanlineStride(); int adjust = scanlineStride - w; fillRaster(pixels, off, adjust, x, y, w, h); // delegate to subclass return raster; }
Example 5
Source File: MultipleGradientPaintContext.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public final Raster getRaster(int x, int y, int w, int h) { // If working raster is big enough, reuse it. Otherwise, // build a large enough new one. Raster raster = saved; if (raster == null || raster.getWidth() < w || raster.getHeight() < h) { raster = getCachedRaster(model, w, h); saved = raster; } // Access raster internal int array. Because we use a DirectColorModel, // we know the DataBuffer is of type DataBufferInt and the SampleModel // is SinglePixelPackedSampleModel. // Adjust for initial offset in DataBuffer and also for the scanline // stride. // These calls make the DataBuffer non-acceleratable, but the // Raster is never Stable long enough to accelerate anyway... DataBufferInt rasterDB = (DataBufferInt)raster.getDataBuffer(); int[] pixels = rasterDB.getData(0); int off = rasterDB.getOffset(); int scanlineStride = ((SinglePixelPackedSampleModel) raster.getSampleModel()).getScanlineStride(); int adjust = scanlineStride - w; fillRaster(pixels, off, adjust, x, y, w, h); // delegate to subclass return raster; }
Example 6
Source File: MultipleGradientPaintContext.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public final Raster getRaster(int x, int y, int w, int h) { // If working raster is big enough, reuse it. Otherwise, // build a large enough new one. Raster raster = saved; if (raster == null || raster.getWidth() < w || raster.getHeight() < h) { raster = getCachedRaster(model, w, h); saved = raster; } // Access raster internal int array. Because we use a DirectColorModel, // we know the DataBuffer is of type DataBufferInt and the SampleModel // is SinglePixelPackedSampleModel. // Adjust for initial offset in DataBuffer and also for the scanline // stride. // These calls make the DataBuffer non-acceleratable, but the // Raster is never Stable long enough to accelerate anyway... DataBufferInt rasterDB = (DataBufferInt)raster.getDataBuffer(); int[] pixels = rasterDB.getData(0); int off = rasterDB.getOffset(); int scanlineStride = ((SinglePixelPackedSampleModel) raster.getSampleModel()).getScanlineStride(); int adjust = scanlineStride - w; fillRaster(pixels, off, adjust, x, y, w, h); // delegate to subclass return raster; }
Example 7
Source File: MultipleGradientPaintContext.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * {@inheritDoc} */ public final Raster getRaster(int x, int y, int w, int h) { // If working raster is big enough, reuse it. Otherwise, // build a large enough new one. Raster raster = saved; if (raster == null || raster.getWidth() < w || raster.getHeight() < h) { raster = getCachedRaster(model, w, h); saved = raster; } // Access raster internal int array. Because we use a DirectColorModel, // we know the DataBuffer is of type DataBufferInt and the SampleModel // is SinglePixelPackedSampleModel. // Adjust for initial offset in DataBuffer and also for the scanline // stride. // These calls make the DataBuffer non-acceleratable, but the // Raster is never Stable long enough to accelerate anyway... DataBufferInt rasterDB = (DataBufferInt)raster.getDataBuffer(); int[] pixels = rasterDB.getData(0); int off = rasterDB.getOffset(); int scanlineStride = ((SinglePixelPackedSampleModel) raster.getSampleModel()).getScanlineStride(); int adjust = scanlineStride - w; fillRaster(pixels, off, adjust, x, y, w, h); // delegate to subclass return raster; }
Example 8
Source File: MultipleGradientPaintContext.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public final Raster getRaster(int x, int y, int w, int h) { // If working raster is big enough, reuse it. Otherwise, // build a large enough new one. Raster raster = saved; if (raster == null || raster.getWidth() < w || raster.getHeight() < h) { raster = getCachedRaster(model, w, h); saved = raster; } // Access raster internal int array. Because we use a DirectColorModel, // we know the DataBuffer is of type DataBufferInt and the SampleModel // is SinglePixelPackedSampleModel. // Adjust for initial offset in DataBuffer and also for the scanline // stride. // These calls make the DataBuffer non-acceleratable, but the // Raster is never Stable long enough to accelerate anyway... DataBufferInt rasterDB = (DataBufferInt)raster.getDataBuffer(); int[] pixels = rasterDB.getData(0); int off = rasterDB.getOffset(); int scanlineStride = ((SinglePixelPackedSampleModel) raster.getSampleModel()).getScanlineStride(); int adjust = scanlineStride - w; fillRaster(pixels, off, adjust, x, y, w, h); // delegate to subclass return raster; }
Example 9
Source File: MultipleGradientPaintContext.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public final Raster getRaster(int x, int y, int w, int h) { // If working raster is big enough, reuse it. Otherwise, // build a large enough new one. Raster raster = saved; if (raster == null || raster.getWidth() < w || raster.getHeight() < h) { raster = getCachedRaster(model, w, h); saved = raster; } // Access raster internal int array. Because we use a DirectColorModel, // we know the DataBuffer is of type DataBufferInt and the SampleModel // is SinglePixelPackedSampleModel. // Adjust for initial offset in DataBuffer and also for the scanline // stride. // These calls make the DataBuffer non-acceleratable, but the // Raster is never Stable long enough to accelerate anyway... DataBufferInt rasterDB = (DataBufferInt)raster.getDataBuffer(); int[] pixels = rasterDB.getData(0); int off = rasterDB.getOffset(); int scanlineStride = ((SinglePixelPackedSampleModel) raster.getSampleModel()).getScanlineStride(); int adjust = scanlineStride - w; fillRaster(pixels, off, adjust, x, y, w, h); // delegate to subclass return raster; }
Example 10
Source File: CustomCompositeTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 11
Source File: CustomCompositeTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 12
Source File: JavaImgConverter.java From easyCV with Apache License 2.0 | 5 votes |
/** * 24位BGR转BufferedImage * @param src -源数据 * @param width -宽度 * @param height-高度 * @return */ public static BufferedImage BGR2BufferedImage(ByteBuffer src,int width,int height) { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); Raster ra = image.getRaster(); DataBuffer out = ra.getDataBuffer(); DataBufferByte db=(DataBufferByte)out; ByteBuffer.wrap(db.getData()).put(src); return image; }
Example 13
Source File: JavaImgConverter.java From easyCV with Apache License 2.0 | 5 votes |
/** * 使用窗口显示BGR图像 * @param width * @param height * @param src */ public static void viewBGR(int width,int height,ByteBuffer src) { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); // image.setRGB(0, 0, width, height, rgbarr, 0,height); Raster ra = image.getRaster(); DataBuffer out = ra.getDataBuffer(); DataBufferByte db=(DataBufferByte)out; ByteBuffer.wrap(db.getData()).put(src); viewImage(image); }
Example 14
Source File: CustomCompositeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 15
Source File: MultipleGradientPaintContext.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public final Raster getRaster(int x, int y, int w, int h) { // If working raster is big enough, reuse it. Otherwise, // build a large enough new one. Raster raster = saved; if (raster == null || raster.getWidth() < w || raster.getHeight() < h) { raster = getCachedRaster(model, w, h); saved = raster; } // Access raster internal int array. Because we use a DirectColorModel, // we know the DataBuffer is of type DataBufferInt and the SampleModel // is SinglePixelPackedSampleModel. // Adjust for initial offset in DataBuffer and also for the scanline // stride. // These calls make the DataBuffer non-acceleratable, but the // Raster is never Stable long enough to accelerate anyway... DataBufferInt rasterDB = (DataBufferInt)raster.getDataBuffer(); int[] pixels = rasterDB.getData(0); int off = rasterDB.getOffset(); int scanlineStride = ((SinglePixelPackedSampleModel) raster.getSampleModel()).getScanlineStride(); int adjust = scanlineStride - w; fillRaster(pixels, off, adjust, x, y, w, h); // delegate to subclass return raster; }
Example 16
Source File: BlackOrOpImage.java From pdfxtk with Apache License 2.0 | 5 votes |
/** Bytewise OR of the black pixels */ private void byteLoop(Raster src0, Raster src1, WritableRaster dst, Rectangle dstRect) { int w = dst.getWidth(); int h = dst.getHeight(); DataBufferByte src0db = (DataBufferByte) src0.getDataBuffer(); DataBufferByte src1db = (DataBufferByte) src1.getDataBuffer(); DataBufferByte dstdb = (DataBufferByte) dst.getDataBuffer(); byte src0Data[] = src0db.getData(); byte src1Data[] = src1db.getData(); byte dstData[] = dstdb.getData(); MultiPixelPackedSampleModel src0sm = (MultiPixelPackedSampleModel) src0.getSampleModel(); MultiPixelPackedSampleModel src1sm = (MultiPixelPackedSampleModel) src1.getSampleModel(); MultiPixelPackedSampleModel dstsm = (MultiPixelPackedSampleModel) dst.getSampleModel(); int src0ScanlineStride = src0sm.getScanlineStride(); int src1ScanlineStride = src1sm.getScanlineStride(); int dstScanlineStride = dstsm.getScanlineStride(); int white = getWhite(); if (white == 0) { for (int offset = 0; offset < h*dstScanlineStride; offset++) { dstData[offset] = (byte) (src0Data[offset] | src1Data[offset]); } } else { for (int offset = 0; offset < h*dstScanlineStride; offset++) { dstData[offset] = (byte) (src0Data[offset] & src1Data[offset]); } } }
Example 17
Source File: MultipleGradientPaintContext.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public final Raster getRaster(int x, int y, int w, int h) { // If working raster is big enough, reuse it. Otherwise, // build a large enough new one. Raster raster = saved; if (raster == null || raster.getWidth() < w || raster.getHeight() < h) { raster = getCachedRaster(model, w, h); saved = raster; } // Access raster internal int array. Because we use a DirectColorModel, // we know the DataBuffer is of type DataBufferInt and the SampleModel // is SinglePixelPackedSampleModel. // Adjust for initial offset in DataBuffer and also for the scanline // stride. // These calls make the DataBuffer non-acceleratable, but the // Raster is never Stable long enough to accelerate anyway... DataBufferInt rasterDB = (DataBufferInt)raster.getDataBuffer(); int[] pixels = rasterDB.getData(0); int off = rasterDB.getOffset(); int scanlineStride = ((SinglePixelPackedSampleModel) raster.getSampleModel()).getScanlineStride(); int adjust = scanlineStride - w; fillRaster(pixels, off, adjust, x, y, w, h); // delegate to subclass return raster; }
Example 18
Source File: AWTImageTools.java From scifio with BSD 2-Clause "Simplified" License | 4 votes |
/** * Gets the pixel type of the given image. * * @return One of the following types: * <ul> * <li>FormatReader.INT8</li> * <li>FormatReader.UINT8</li> * <li>FormatReader.INT16</li> * <li>FormatReader.UINT16</li> * <li>FormatReader.INT32</li> * <li>FormatReader.UINT32</li> * <li>FormatReader.FLOAT</li> * <li>FormatReader.DOUBLE</li> * <li>-1 (unknown type)</li> * </ul> */ public static int getPixelType(final BufferedImage image) { final Raster raster = image.getRaster(); if (raster == null) return -1; final DataBuffer buffer = raster.getDataBuffer(); if (buffer == null) return -1; if (buffer instanceof SignedByteBuffer) { return FormatTools.INT8; } else if (buffer instanceof SignedShortBuffer) { return FormatTools.INT16; } else if (buffer instanceof UnsignedIntBuffer) { return FormatTools.UINT32; } final int type = buffer.getDataType(); final int imageType = image.getType(); switch (type) { case DataBuffer.TYPE_BYTE: return FormatTools.UINT8; case DataBuffer.TYPE_DOUBLE: return FormatTools.DOUBLE; case DataBuffer.TYPE_FLOAT: return FormatTools.FLOAT; case DataBuffer.TYPE_INT: if (imageType == BufferedImage.TYPE_INT_RGB || imageType == BufferedImage.TYPE_INT_BGR || imageType == BufferedImage.TYPE_INT_ARGB) { return FormatTools.UINT8; } if (buffer instanceof UnsignedIntBuffer) { return FormatTools.UINT32; } return FormatTools.INT32; case DataBuffer.TYPE_SHORT: return FormatTools.INT16; case DataBuffer.TYPE_USHORT: if (imageType == BufferedImage.TYPE_USHORT_555_RGB || imageType == BufferedImage.TYPE_USHORT_565_RGB) { return FormatTools.UINT8; } return FormatTools.UINT16; default: return -1; } }
Example 19
Source File: RenderableImageProducer.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * The runnable method for this class. This will produce an image using * the current RenderableImage and RenderContext and send it to all the * ImageConsumer currently registered with this class. */ public void run() { // First get the rendered image RenderedImage rdrdImage; if (rc != null) { rdrdImage = rdblImage.createRendering(rc); } else { rdrdImage = rdblImage.createDefaultRendering(); } // And its ColorModel ColorModel colorModel = rdrdImage.getColorModel(); Raster raster = rdrdImage.getData(); SampleModel sampleModel = raster.getSampleModel(); DataBuffer dataBuffer = raster.getDataBuffer(); if (colorModel == null) { colorModel = ColorModel.getRGBdefault(); } int minX = raster.getMinX(); int minY = raster.getMinY(); int width = raster.getWidth(); int height = raster.getHeight(); Enumeration<ImageConsumer> icList; ImageConsumer ic; // Set up the ImageConsumers icList = ics.elements(); while (icList.hasMoreElements()) { ic = icList.nextElement(); ic.setDimensions(width,height); ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES | ImageConsumer.SINGLEPASS | ImageConsumer.SINGLEFRAME); } // Get RGB pixels from the raster scanline by scanline and // send to consumers. int[] pix = new int[width]; int i,j; int numBands = sampleModel.getNumBands(); int[] tmpPixel = new int[numBands]; for (j = 0; j < height; j++) { for(i = 0; i < width; i++) { sampleModel.getPixel(i, j, tmpPixel, dataBuffer); pix[i] = colorModel.getDataElement(tmpPixel, 0); } // Now send the scanline to the Consumers icList = ics.elements(); while (icList.hasMoreElements()) { ic = icList.nextElement(); ic.setPixels(0, j, width, 1, colorModel, pix, 0, width); } } // Now tell the consumers we're done. icList = ics.elements(); while (icList.hasMoreElements()) { ic = icList.nextElement(); ic.imageComplete(ImageConsumer.STATICIMAGEDONE); } }
Example 20
Source File: TestImage3.java From libreveris with GNU Lesser General Public License v3.0 | 4 votes |
public static PlanarImage decodeImage (String[] rows) { // Create the DataBuffer to hold the pixel samples final int width = rows[0].length(); final int height = rows.length; // Create Raster Raster raster; if (true) { raster = Raster.createPackedRaster (DataBuffer.TYPE_INT, width, height, new int[] {0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000},// bandMasks RGBA null); } else { raster = Raster.createInterleavedRaster (DataBuffer.TYPE_BYTE, width, height, 4,// num of bands null); } // Populate the data buffer DataBuffer dataBuffer = raster.getDataBuffer(); int index = 0; for (String row : rows) { for (int x = 0; x < width; x++) { int argb = toARGB(row.charAt(x)); dataBuffer.setElem(index, argb); index++; } } // Dump // final int size = width * height; // System.out.println("DataBuffer :"); // for (int i = 0; i < size; i++) { // if (i % width == 0) { // System.out.println(); // } // System.out.print(String.format("%8x ", dataBuffer.getElem(i))); // } // System.out.println(); // Create the image BufferedImage bufferedImage = new BufferedImage (width, height, BufferedImage.TYPE_INT_ARGB); bufferedImage.setData(raster); // Dump // System.out.println("BufferedImage :"); // for (int y = 0; y < height; y++) { // System.out.println(); // for (int x = 0; x < width; x++) { // System.out.print(String.format("%8x ", bufferedImage.getRGB(x, y))); // } // } // System.out.println(); return PlanarImage.wrapRenderedImage(bufferedImage); }