< prev index next >

src/java.desktop/share/classes/java/awt/image/BandedSampleModel.java

Print this page

        

*** 104,115 **** * one of the supported data types */ public BandedSampleModel(int dataType, int w, int h, int scanlineStride, ! int bankIndices[], ! int bandOffsets[]) { super(dataType, w, h, 1,scanlineStride, bankIndices, bandOffsets); } /** --- 104,115 ---- * one of the supported data types */ public BandedSampleModel(int dataType, int w, int h, int scanlineStride, ! int[] bankIndices, ! int[] bandOffsets) { super(dataType, w, h, 1,scanlineStride, bankIndices, bandOffsets); } /**
*** 155,171 **** * @throws RasterFormatException if the number of bands is greater than * the number of banks in this sample model. * @throws IllegalArgumentException if {@code dataType} is not * one of the supported data types */ ! public SampleModel createSubsetSampleModel(int bands[]) { if (bands.length > bankIndices.length) throw new RasterFormatException("There are only " + bankIndices.length + " bands"); ! int newBankIndices[] = new int[bands.length]; ! int newBandOffsets[] = new int[bands.length]; for (int i=0; i<bands.length; i++) { newBankIndices[i] = bankIndices[bands[i]]; newBandOffsets[i] = bandOffsets[bands[i]]; } --- 155,171 ---- * @throws RasterFormatException if the number of bands is greater than * the number of banks in this sample model. * @throws IllegalArgumentException if {@code dataType} is not * one of the supported data types */ ! public SampleModel createSubsetSampleModel(int[] bands) { if (bands.length > bankIndices.length) throw new RasterFormatException("There are only " + bankIndices.length + " bands"); ! int[] newBankIndices = new int[bands.length]; ! int[] newBandOffsets = new int[bands.length]; for (int i=0; i<bands.length; i++) { newBankIndices[i] = bankIndices[bands[i]]; newBandOffsets[i] = bandOffsets[bands[i]]; }
*** 394,404 **** * @param iArray If non-null, returns the samples in this array * @param data The DataBuffer containing the image data * @return the samples for the specified pixel. * @see #setPixel(int, int, int[], DataBuffer) */ ! public int[] getPixel(int x, int y, int iArray[], DataBuffer data) { if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } --- 394,404 ---- * @param iArray If non-null, returns the samples in this array * @param data The DataBuffer containing the image data * @return the samples for the specified pixel. * @see #setPixel(int, int, int[], DataBuffer) */ ! public int[] getPixel(int x, int y, int[] iArray, DataBuffer data) { if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); }
*** 431,441 **** * @param data The DataBuffer containing the image data * @return the samples for the pixels within the specified region. * @see #setPixels(int, int, int, int, int[], DataBuffer) */ public int[] getPixels(int x, int y, int w, int h, ! int iArray[], DataBuffer data) { int x1 = x + w; int y1 = y + h; if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || y < 0 || y >= height || h > height || y1 < 0 || y1 > height) --- 431,441 ---- * @param data The DataBuffer containing the image data * @return the samples for the pixels within the specified region. * @see #setPixels(int, int, int, int, int[], DataBuffer) */ public int[] getPixels(int x, int y, int w, int h, ! int[] iArray, DataBuffer data) { int x1 = x + w; int y1 = y + h; if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
*** 555,571 **** * @return the samples in the specified band for the pixels within * the specified region. * @see #setSamples(int, int, int, int, int, int[], DataBuffer) */ public int[] getSamples(int x, int y, int w, int h, int b, ! int iArray[], DataBuffer data) { // Bounds check for 'b' will be performed automatically if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } ! int samples[]; if (iArray != null) { samples = iArray; } else { samples = new int [w*h]; } --- 555,571 ---- * @return the samples in the specified band for the pixels within * the specified region. * @see #setSamples(int, int, int, int, int, int[], DataBuffer) */ public int[] getSamples(int x, int y, int w, int h, int b, ! int[] iArray, DataBuffer data) { // Bounds check for 'b' will be performed automatically if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } ! int[] samples; if (iArray != null) { samples = iArray; } else { samples = new int [w*h]; }
*** 692,702 **** * @param y The Y coordinate of the pixel location * @param iArray The input samples in an int array * @param data The DataBuffer containing the image data * @see #getPixel(int, int, int[], DataBuffer) */ ! public void setPixel(int x, int y, int iArray[], DataBuffer data) { if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } int pixelOffset = y*scanlineStride + x; --- 692,702 ---- * @param y The Y coordinate of the pixel location * @param iArray The input samples in an int array * @param data The DataBuffer containing the image data * @see #getPixel(int, int, int[], DataBuffer) */ ! public void setPixel(int x, int y, int[] iArray, DataBuffer data) { if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } int pixelOffset = y*scanlineStride + x;
*** 718,728 **** * @param iArray The input samples in an int array * @param data The DataBuffer containing the image data * @see #getPixels(int, int, int, int, int[], DataBuffer) */ public void setPixels(int x, int y, int w, int h, ! int iArray[], DataBuffer data) { int x1 = x + w; int y1 = y + h; if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || y < 0 || y >= height || h > height || y1 < 0 || y1 > height) --- 718,728 ---- * @param iArray The input samples in an int array * @param data The DataBuffer containing the image data * @see #getPixels(int, int, int, int, int[], DataBuffer) */ public void setPixels(int x, int y, int w, int h, ! int[] iArray, DataBuffer data) { int x1 = x + w; int y1 = y + h; if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
*** 831,841 **** * @param iArray The input sample array * @param data The DataBuffer containing the image data * @see #getSamples(int, int, int, int, int, int[], DataBuffer) */ public void setSamples(int x, int y, int w, int h, int b, ! int iArray[], DataBuffer data) { // Bounds check for 'b' will be performed automatically if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } --- 831,841 ---- * @param iArray The input sample array * @param data The DataBuffer containing the image data * @see #getSamples(int, int, int, int, int, int[], DataBuffer) */ public void setSamples(int x, int y, int w, int h, int b, ! int[] iArray, DataBuffer data) { // Bounds check for 'b' will be performed automatically if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); }
< prev index next >