< prev index next >

src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 29,39 **** import java.awt.image.RasterFormatException; import java.awt.image.SampleModel; import java.awt.image.ComponentSampleModel; import java.awt.image.PixelInterleavedSampleModel; import java.awt.image.SinglePixelPackedSampleModel; - import java.awt.image.DataBuffer; import java.awt.image.DataBufferByte; import java.awt.Rectangle; import java.awt.Point; /** --- 29,38 ----
*** 85,95 **** * @param sampleModel The SampleModel that specifies the layout. * @param origin The Point that specified the origin. */ public ByteInterleavedRaster(SampleModel sampleModel, Point origin) { this(sampleModel, ! sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin, --- 84,94 ---- * @param sampleModel The SampleModel that specifies the layout. * @param origin The Point that specified the origin. */ public ByteInterleavedRaster(SampleModel sampleModel, Point origin) { this(sampleModel, ! (DataBufferByte) sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin,
*** 102,117 **** * it is the same size as the SampleModel. The DataBuffer is not * initialized and must be a DataBufferByte compatible with SampleModel. * SampleModel must be of type SinglePixelPackedSampleModel * or InterleavedSampleModel. * @param sampleModel The SampleModel that specifies the layout. ! * @param dataBuffer The DataBufferShort that contains the image data. * @param origin The Point that specifies the origin. */ public ByteInterleavedRaster(SampleModel sampleModel, ! DataBuffer dataBuffer, ! Point origin) { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.getWidth(), --- 101,117 ---- * it is the same size as the SampleModel. The DataBuffer is not * initialized and must be a DataBufferByte compatible with SampleModel. * SampleModel must be of type SinglePixelPackedSampleModel * or InterleavedSampleModel. * @param sampleModel The SampleModel that specifies the layout. ! * @param dataBuffer The DataBufferByte that contains the image data. * @param origin The Point that specifies the origin. */ public ByteInterleavedRaster(SampleModel sampleModel, ! DataBufferByte dataBuffer, ! Point origin) ! { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.getWidth(),
*** 176,206 **** * ancestor which has no parent.) * * Note that this constructor should generally be called by other * constructors or create methods, it should not be used directly. * @param sampleModel The SampleModel that specifies the layout. ! * @param dataBuffer The DataBufferShort that contains the image data. * @param aRegion The Rectangle that specifies the image area. * @param origin The Point that specifies the origin. * @param parent The parent (if any) of this raster. */ public ByteInterleavedRaster(SampleModel sampleModel, ! DataBuffer dataBuffer, Rectangle aRegion, Point origin, ! ByteInterleavedRaster parent) { super(sampleModel, dataBuffer, aRegion, origin, parent); this.maxX = minX + width; this.maxY = minY + height; ! if (!(dataBuffer instanceof DataBufferByte)) { ! throw new RasterFormatException("ByteInterleavedRasters must have " + ! "byte DataBuffers"); ! } ! ! DataBufferByte dbb = (DataBufferByte)dataBuffer; ! this.data = stealData(dbb, 0); int xOffset = aRegion.x - origin.x; int yOffset = aRegion.y - origin.y; if (sampleModel instanceof PixelInterleavedSampleModel || (sampleModel instanceof ComponentSampleModel && --- 176,201 ---- * ancestor which has no parent.) * * Note that this constructor should generally be called by other * constructors or create methods, it should not be used directly. * @param sampleModel The SampleModel that specifies the layout. ! * @param dataBuffer The DataBufferByte that contains the image data. * @param aRegion The Rectangle that specifies the image area. * @param origin The Point that specifies the origin. * @param parent The parent (if any) of this raster. */ public ByteInterleavedRaster(SampleModel sampleModel, ! DataBufferByte dataBuffer, Rectangle aRegion, Point origin, ! ByteInterleavedRaster parent) ! { super(sampleModel, dataBuffer, aRegion, origin, parent); this.maxX = minX + width; this.maxY = minY + height; ! this.data = stealData(dataBuffer, 0); int xOffset = aRegion.x - origin.x; int yOffset = aRegion.y - origin.y; if (sampleModel instanceof PixelInterleavedSampleModel || (sampleModel instanceof ComponentSampleModel &&
*** 219,229 **** this.bitMasks = sppsm.getBitMasks(); this.bitOffsets = sppsm.getBitOffsets(); this.scanlineStride = sppsm.getScanlineStride(); this.pixelStride = 1; this.dataOffsets = new int[1]; ! this.dataOffsets[0] = dbb.getOffset(); dataOffsets[0] += xOffset*pixelStride+yOffset*scanlineStride; } else { throw new RasterFormatException("ByteInterleavedRasters must " + "have PixelInterleavedSampleModel, SinglePixelPackedSampleModel"+ " or interleaved ComponentSampleModel. Sample model is " + --- 214,224 ---- this.bitMasks = sppsm.getBitMasks(); this.bitOffsets = sppsm.getBitOffsets(); this.scanlineStride = sppsm.getScanlineStride(); this.pixelStride = 1; this.dataOffsets = new int[1]; ! this.dataOffsets[0] = dataBuffer.getOffset(); dataOffsets[0] += xOffset*pixelStride+yOffset*scanlineStride; } else { throw new RasterFormatException("ByteInterleavedRasters must " + "have PixelInterleavedSampleModel, SinglePixelPackedSampleModel"+ " or interleaved ComponentSampleModel. Sample model is " +
*** 1257,1267 **** int deltaX = x0 - x; int deltaY = y0 - y; return new ByteInterleavedRaster(sm, ! dataBuffer, new Rectangle(x0, y0, width, height), new Point(sampleModelTranslateX+deltaX, sampleModelTranslateY+deltaY), this); } --- 1252,1262 ---- int deltaX = x0 - x; int deltaY = y0 - y; return new ByteInterleavedRaster(sm, ! (DataBufferByte) dataBuffer, new Rectangle(x0, y0, width, height), new Point(sampleModelTranslateX+deltaX, sampleModelTranslateY+deltaY), this); }
< prev index next >