< prev index next >

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

Print this page

        

*** 109,124 **** * Constructs a SampleModel with the specified parameters. * @param dataType The data type of the DataBuffer storing the pixel data. * @param w The width (in pixels) of the region of image data. * @param h The height (in pixels) of the region of image data. * @param numBands The number of bands of the image data. ! * @throws IllegalArgumentException if <code>w</code> or <code>h</code> * is not greater than 0 ! * @throws IllegalArgumentException if the product of <code>w</code> ! * and <code>h</code> is greater than ! * <code>Integer.MAX_VALUE</code> ! * @throws IllegalArgumentException if <code>dataType</code> is not * one of the supported data types */ public SampleModel(int dataType, int w, int h, int numBands) { long size = (long)w * h; --- 109,124 ---- * Constructs a SampleModel with the specified parameters. * @param dataType The data type of the DataBuffer storing the pixel data. * @param w The width (in pixels) of the region of image data. * @param h The height (in pixels) of the region of image data. * @param numBands The number of bands of the image data. ! * @throws IllegalArgumentException if {@code w} or {@code h} * is not greater than 0 ! * @throws IllegalArgumentException if the product of {@code w} ! * and {@code h} is greater than ! * {@code Integer.MAX_VALUE} ! * @throws IllegalArgumentException if {@code dataType} is not * one of the supported data types */ public SampleModel(int dataType, int w, int h, int numBands) { long size = (long)w * h;
*** 149,175 **** this.numBands = numBands; } /** Returns the width in pixels. * @return the width in pixels of the region of image data ! * that this <code>SampleModel</code> describes. */ public final int getWidth() { return width; } /** Returns the height in pixels. * @return the height in pixels of the region of image data ! * that this <code>SampleModel</code> describes. */ public final int getHeight() { return height; } /** Returns the total number of bands of image data. * @return the number of bands of image data that this ! * <code>SampleModel</code> describes. */ public final int getNumBands() { return numBands; } --- 149,175 ---- this.numBands = numBands; } /** Returns the width in pixels. * @return the width in pixels of the region of image data ! * that this {@code SampleModel} describes. */ public final int getWidth() { return width; } /** Returns the height in pixels. * @return the height in pixels of the region of image data ! * that this {@code SampleModel} describes. */ public final int getHeight() { return height; } /** Returns the total number of bands of image data. * @return the number of bands of image data that this ! * {@code SampleModel} describes. */ public final int getNumBands() { return numBands; }
*** 259,271 **** * thus increasing efficiency for data transfers. Generally, obj * should be passed in as null, so that the Object will be created * automatically and will be of the right primitive data type. * <p> * The following code illustrates transferring data for one pixel from ! * DataBuffer <code>db1</code>, whose storage layout is described by ! * SampleModel <code>sm1</code>, to DataBuffer <code>db2</code>, whose ! * storage layout is described by SampleModel <code>sm2</code>. * The transfer will generally be more efficient than using * getPixel/setPixel. * <pre> * SampleModel sm1, sm2; * DataBuffer db1, db2; --- 259,271 ---- * thus increasing efficiency for data transfers. Generally, obj * should be passed in as null, so that the Object will be created * automatically and will be of the right primitive data type. * <p> * The following code illustrates transferring data for one pixel from ! * DataBuffer {@code db1}, whose storage layout is described by ! * SampleModel {@code sm1}, to DataBuffer {@code db2}, whose ! * storage layout is described by SampleModel {@code sm2}. * The transfer will generally be more efficient than using * getPixel/setPixel. * <pre> * SampleModel sm1, sm2; * DataBuffer db1, db2;
*** 310,322 **** * should be passed in as null, so that the Object will be created * automatically and will be of the right primitive data type. * <p> * The following code illustrates transferring data for a rectangular * region of pixels from ! * DataBuffer <code>db1</code>, whose storage layout is described by ! * SampleModel <code>sm1</code>, to DataBuffer <code>db2</code>, whose ! * storage layout is described by SampleModel <code>sm2</code>. * The transfer will generally be more efficient than using * getPixels/setPixels. * <pre> * SampleModel sm1, sm2; * DataBuffer db1, db2; --- 310,322 ---- * should be passed in as null, so that the Object will be created * automatically and will be of the right primitive data type. * <p> * The following code illustrates transferring data for a rectangular * region of pixels from ! * DataBuffer {@code db1}, whose storage layout is described by ! * SampleModel {@code sm1}, to DataBuffer {@code db2}, whose ! * storage layout is described by SampleModel {@code sm2}. * The transfer will generally be more efficient than using * getPixels/setPixels. * <pre> * SampleModel sm1, sm2; * DataBuffer db1, db2;
*** 496,508 **** * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. Data in the array * may be in a packed format, thus increasing efficiency for data * transfers. * <p> * The following code illustrates transferring data for one pixel from ! * DataBuffer <code>db1</code>, whose storage layout is described by ! * SampleModel <code>sm1</code>, to DataBuffer <code>db2</code>, whose ! * storage layout is described by SampleModel <code>sm2</code>. * The transfer will generally be more efficient than using * getPixel/setPixel. * <pre> * SampleModel sm1, sm2; * DataBuffer db1, db2; --- 496,508 ---- * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. Data in the array * may be in a packed format, thus increasing efficiency for data * transfers. * <p> * The following code illustrates transferring data for one pixel from ! * DataBuffer {@code db1}, whose storage layout is described by ! * SampleModel {@code sm1}, to DataBuffer {@code db2}, whose ! * storage layout is described by SampleModel {@code sm2}. * The transfer will generally be more efficient than using * getPixel/setPixel. * <pre> * SampleModel sm1, sm2; * DataBuffer db1, db2;
*** 543,555 **** * may be in a packed format, thus increasing efficiency for data * transfers. * <p> * The following code illustrates transferring data for a rectangular * region of pixels from ! * DataBuffer <code>db1</code>, whose storage layout is described by ! * SampleModel <code>sm1</code>, to DataBuffer <code>db2</code>, whose ! * storage layout is described by SampleModel <code>sm2</code>. * The transfer will generally be more efficient than using * getPixels/setPixels. * <pre> * SampleModel sm1, sm2; * DataBuffer db1, db2; --- 543,555 ---- * may be in a packed format, thus increasing efficiency for data * transfers. * <p> * The following code illustrates transferring data for a rectangular * region of pixels from ! * DataBuffer {@code db1}, whose storage layout is described by ! * SampleModel {@code sm1}, to DataBuffer {@code db2}, whose ! * storage layout is described by SampleModel {@code sm2}. * The transfer will generally be more efficient than using * getPixels/setPixels. * <pre> * SampleModel sm1, sm2; * DataBuffer db1, db2;
*** 1296,1306 **** /** * Sets a sample in the specified band for the pixel located at (x,y) * in the DataBuffer using a float for input. * The default implementation of this method casts the input * float sample to an int and then calls the ! * <code>setSample(int, int, int, DataBuffer)</code> method using * that int value. * ArrayIndexOutOfBoundsException may be thrown if the coordinates are * not in bounds. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. --- 1296,1306 ---- /** * Sets a sample in the specified band for the pixel located at (x,y) * in the DataBuffer using a float for input. * The default implementation of this method casts the input * float sample to an int and then calls the ! * {@code setSample(int, int, int, DataBuffer)} method using * that int value. * ArrayIndexOutOfBoundsException may be thrown if the coordinates are * not in bounds. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location.
*** 1324,1334 **** /** * Sets a sample in the specified band for the pixel located at (x,y) * in the DataBuffer using a double for input. * The default implementation of this method casts the input * double sample to an int and then calls the ! * <code>setSample(int, int, int, DataBuffer)</code> method using * that int value. * ArrayIndexOutOfBoundsException may be thrown if the coordinates are * not in bounds. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. --- 1324,1334 ---- /** * Sets a sample in the specified band for the pixel located at (x,y) * in the DataBuffer using a double for input. * The default implementation of this method casts the input * double sample to an int and then calls the ! * {@code setSample(int, int, int, DataBuffer)} method using * that int value. * ArrayIndexOutOfBoundsException may be thrown if the coordinates are * not in bounds. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location.
*** 1467,1497 **** /** * Creates a SampleModel which describes data in this SampleModel's * format, but with a different width and height. * @param w the width of the image data * @param h the height of the image data ! * @return a <code>SampleModel</code> describing the same image ! * data as this <code>SampleModel</code>, but with a * different size. */ public abstract SampleModel createCompatibleSampleModel(int w, int h); /** * Creates a new SampleModel * with a subset of the bands of this * SampleModel. ! * @param bands the subset of bands of this <code>SampleModel</code> ! * @return a <code>SampleModel</code> with a subset of bands of this ! * <code>SampleModel</code>. */ public abstract SampleModel createSubsetSampleModel(int bands[]); /** * Creates a DataBuffer that corresponds to this SampleModel. * The DataBuffer's width and height will match this SampleModel's. ! * @return a <code>DataBuffer</code> corresponding to this ! * <code>SampleModel</code>. */ public abstract DataBuffer createDataBuffer(); /** Returns the size in bits of samples for all bands. * @return the size of samples for all bands. --- 1467,1497 ---- /** * Creates a SampleModel which describes data in this SampleModel's * format, but with a different width and height. * @param w the width of the image data * @param h the height of the image data ! * @return a {@code SampleModel} describing the same image ! * data as this {@code SampleModel}, but with a * different size. */ public abstract SampleModel createCompatibleSampleModel(int w, int h); /** * Creates a new SampleModel * with a subset of the bands of this * SampleModel. ! * @param bands the subset of bands of this {@code SampleModel} ! * @return a {@code SampleModel} with a subset of bands of this ! * {@code SampleModel}. */ public abstract SampleModel createSubsetSampleModel(int bands[]); /** * Creates a DataBuffer that corresponds to this SampleModel. * The DataBuffer's width and height will match this SampleModel's. ! * @return a {@code DataBuffer} corresponding to this ! * {@code SampleModel}. */ public abstract DataBuffer createDataBuffer(); /** Returns the size in bits of samples for all bands. * @return the size of samples for all bands.
< prev index next >