< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 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) 1997, 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
*** 27,37 **** import java.awt.image.Raster; import java.awt.image.WritableRaster; import java.awt.image.RasterFormatException; import java.awt.image.SampleModel; import java.awt.image.SinglePixelPackedSampleModel; - import java.awt.image.DataBuffer; import java.awt.image.DataBufferInt; import java.awt.Rectangle; import java.awt.Point; /** --- 27,36 ----
*** 108,118 **** * @param origin The Point that specified the origin. */ public IntegerComponentRaster(SampleModel sampleModel, Point origin) { this(sampleModel, ! sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin, --- 107,117 ---- * @param origin The Point that specified the origin. */ public IntegerComponentRaster(SampleModel sampleModel, Point origin) { this(sampleModel, ! (DataBufferInt)sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin,
*** 128,138 **** * @param sampleModel The SampleModel that specifies the layout. * @param dataBuffer The DataBufferInt that contains the image data. * @param origin The Point that specifies the origin. */ public IntegerComponentRaster(SampleModel sampleModel, ! DataBuffer dataBuffer, Point origin) { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, --- 127,137 ---- * @param sampleModel The SampleModel that specifies the layout. * @param dataBuffer The DataBufferInt that contains the image data. * @param origin The Point that specifies the origin. */ public IntegerComponentRaster(SampleModel sampleModel, ! DataBufferInt dataBuffer, Point origin) { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y,
*** 159,186 **** * @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 IntegerComponentRaster(SampleModel sampleModel, ! DataBuffer dataBuffer, Rectangle aRegion, Point origin, ! IntegerComponentRaster parent){ super(sampleModel,dataBuffer,aRegion,origin,parent); this.maxX = minX + width; this.maxY = minY + height; ! if (!(dataBuffer instanceof DataBufferInt)) { ! throw new RasterFormatException("IntegerComponentRasters must have" + ! "integer DataBuffers"); ! } ! DataBufferInt dbi = (DataBufferInt)dataBuffer; ! if (dbi.getNumBanks() != 1) { throw new RasterFormatException("DataBuffer for IntegerComponentRasters"+ " must only have 1 bank."); } ! this.data = stealData(dbi, 0); if (sampleModel instanceof SinglePixelPackedSampleModel) { SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel)sampleModel; int[] boffsets = sppsm.getBitOffsets(); --- 158,181 ---- * @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 IntegerComponentRaster(SampleModel sampleModel, ! DataBufferInt dataBuffer, Rectangle aRegion, Point origin, ! IntegerComponentRaster parent) { super(sampleModel,dataBuffer,aRegion,origin,parent); this.maxX = minX + width; this.maxY = minY + height; ! ! if (dataBuffer.getNumBanks() != 1) { throw new RasterFormatException("DataBuffer for IntegerComponentRasters"+ " must only have 1 bank."); } ! this.data = stealData(dataBuffer, 0); if (sampleModel instanceof SinglePixelPackedSampleModel) { SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel)sampleModel; int[] boffsets = sppsm.getBitOffsets();
*** 195,205 **** : IntegerComponentRaster.TYPE_INT_8BIT_SAMPLES); this.scanlineStride = sppsm.getScanlineStride(); this.pixelStride = 1; this.dataOffsets = new int[1]; ! this.dataOffsets[0] = dbi.getOffset(); this.bandOffset = this.dataOffsets[0]; int xOffset = aRegion.x - origin.x; int yOffset = aRegion.y - origin.y; dataOffsets[0] += xOffset+yOffset*scanlineStride; this.numDataElems = sppsm.getNumDataElements(); --- 190,200 ---- : IntegerComponentRaster.TYPE_INT_8BIT_SAMPLES); this.scanlineStride = sppsm.getScanlineStride(); this.pixelStride = 1; this.dataOffsets = new int[1]; ! this.dataOffsets[0] = dataBuffer.getOffset(); this.bandOffset = this.dataOffsets[0]; int xOffset = aRegion.x - origin.x; int yOffset = aRegion.y - origin.y; dataOffsets[0] += xOffset+yOffset*scanlineStride; this.numDataElems = sppsm.getNumDataElements();
*** 567,577 **** int deltaX = x0 - x; int deltaY = y0 - y; return new IntegerComponentRaster(sm, ! dataBuffer, new Rectangle(x0,y0,width,height), new Point(sampleModelTranslateX+deltaX, sampleModelTranslateY+deltaY), this); } --- 562,572 ---- int deltaX = x0 - x; int deltaY = y0 - y; return new IntegerComponentRaster(sm, ! (DataBufferInt)dataBuffer, new Rectangle(x0,y0,width,height), new Point(sampleModelTranslateX+deltaX, sampleModelTranslateY+deltaY), this); }
< prev index next >