⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 samplemodel.java

📁 JAVA基本类源代码,大家可以学习学习!
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
     *     * @throws NullPointerException if iArray or data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates are     * not in bounds, or if iArray is too small to hold the input.     */    public void setPixel(int x, int y, int iArray[], DataBuffer data) {	for (int i=0; i<numBands; i++)	    setSample(x, y, i, iArray[i], data);    }    /**     * Sets a pixel in the DataBuffer using a float array of samples for input.     * 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.     * @param fArray 	The input samples in a float array.     * @param data 	The DataBuffer containing the image data.     * @see #getPixel(int, int, float[], DataBuffer)     *     * @throws NullPointerException if fArray or data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates are     * not in bounds, or if fArray is too small to hold the input.     */    public void setPixel(int x, int y, float fArray[], DataBuffer data) {	for (int i=0; i<numBands; i++)	    setSample(x, y, i, fArray[i], data);    }    /**     * Sets a pixel in the DataBuffer using a double array of samples      * for input.     * @param x 	The X coordinate of the pixel location.     * @param y 	The Y coordinate of the pixel location.     * @param dArray 	The input samples in a double array.     * @param data 	The DataBuffer containing the image data.     * @see #getPixel(int, int, double[], DataBuffer)     *     * @throws NullPointerException if dArray or data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates are     * not in bounds, or if fArray is too small to hold the input.     */    public void setPixel(int x, int y, double dArray[], DataBuffer data) {	for (int i=0; i<numBands; i++)	    setSample(x, y, i, dArray[i], data);    }    /**     * Sets all samples for a rectangle of pixels from an int array containing     * one sample per array element.     * ArrayIndexOutOfBoundsException may be thrown if the coordinates are     * not in bounds.     * @param x 	The X coordinate of the upper left pixel location.     * @param y 	The Y coordinate of the upper left pixel location.     * @param w 	The width of the pixel rectangle.     * @param h 	The height of the pixel rectangle.     * @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)     *     * @throws NullPointerException if iArray or data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates are     * not in bounds, or if iArray is too small to hold the input.     */    public void setPixels(int x, int y, int w, int h,                          int iArray[], DataBuffer data) {	int Offset=0;	for (int i=y; i<(y+h); i++) {	    for (int j=x; j<(x+w); j++) {		for (int k=0; k<numBands; k++) {		    setSample(j, i, k, iArray[Offset++], data);		}	    }	}    }    /**     * Sets all samples for a rectangle of pixels from a float array containing     * one sample per array element.     * ArrayIndexOutOfBoundsException may be thrown if the coordinates are     * not in bounds.     * @param x 	The X coordinate of the upper left pixel location.     * @param y 	The Y coordinate of the upper left pixel location.     * @param w 	The width of the pixel rectangle.     * @param h 	The height of the pixel rectangle.     * @param fArray 	The input samples in a float array.     * @param data 	The DataBuffer containing the image data.     * @see #getPixels(int, int, int, int, float[], DataBuffer)     *     * @throws NullPointerException if fArray or data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates are     * not in bounds, or if fArray is too small to hold the input.     */    public void setPixels(int x, int y, int w, int h,                          float fArray[], DataBuffer data) {	int Offset=0;	for (int i=y; i<(y+h); i++) {	    for (int j=x; j<(x+w); j++) {		for(int k=0; k<numBands; k++) {		    setSample(j, i, k, fArray[Offset++], data);		}	    }	}    }    /**     * Sets all samples for a rectangle of pixels from a double array      * containing one sample per array element.     * ArrayIndexOutOfBoundsException may be thrown if the coordinates are     * not in bounds.     * @param x 	The X coordinate of the upper left pixel location.     * @param y 	The Y coordinate of the upper left pixel location.     * @param w 	The width of the pixel rectangle.     * @param h 	The height of the pixel rectangle.     * @param dArray 	The input samples in a double array.     * @param data 	The DataBuffer containing the image data.     * @see #getPixels(int, int, int, int, double[], DataBuffer)     *     * @throws NullPointerException if dArray or data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates are     * not in bounds, or if dArray is too small to hold the input.     */    public void setPixels(int x, int y, int w, int h,                          double dArray[], DataBuffer data) {	int Offset=0;	for (int i=y; i<(y+h); i++) {	    for (int j=x; j<(x+w); j++) {		for (int k=0; k<numBands; k++) {		    setSample(j, i, k, dArray[Offset++], data);		}	    }	}    }    /**     * Sets a sample in the specified band for the pixel located at (x,y)     * in the DataBuffer using an int for input.     * 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.     * @param b 	The band to set.     * @param s 	The input sample as an int.     * @param data 	The DataBuffer containing the image data.     * @see #getSample(int, int, int,  DataBuffer)     *     * @throws NullPointerException if data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates or     * the band index are not in bounds.     */    public abstract void setSample(int x, int y, int b,                                   int s,                                   DataBuffer data);    /**     * Sets a sample in the specified band for the pixel located at (x,y)     * in the DataBuffer using a float for input.     * 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.     * @param b 	The band to set.     * @param s 	The input sample as a float.     * @param data 	The DataBuffer containing the image data.     * @see #getSample(int, int, int, DataBuffer)     *     * @throws NullPointerException if data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates or     * the band index are not in bounds.     */    public void setSample(int x, int y, int b,			  float s ,			  DataBuffer data) {	int sample = (int)s;	setSample(x, y, b, sample, data);    }    /**     * Sets a sample in the specified band for the pixel located at (x,y)     * in the DataBuffer using a double for input.     * 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.     * @param b 	The band to set.     * @param s 	The input sample as a double.     * @param data 	The DataBuffer containing the image data.     * @see #getSample(int, int, int, DataBuffer)     *     * @throws NullPointerException if data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates or     * the band index are not in bounds.     */    public void setSample(int x, int y, int b,			  double s,			  DataBuffer data) {	int sample = (int)s;	setSample(x, y, b, sample, data);    }    /**     * Sets the samples in the specified band for the specified rectangle     * of pixels from an int array containing one sample per array element.     * ArrayIndexOutOfBoundsException may be thrown if the coordinates are     * not in bounds.     * @param x 	The X coordinate of the upper left pixel location.     * @param y 	The Y coordinate of the upper left pixel location.     * @param w 	The width of the pixel rectangle.     * @param h 	The height of the pixel rectangle.     * @param b 	The band to set.     * @param iArray 	The input samples in an int array.     * @param data      The DataBuffer containing the image data.     * @see #getSamples(int, int, int, int, int, int[], DataBuffer)     *     * @throws NullPointerException if iArray or data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates or     * the band index are not in bounds, or if iArray is too small to     * hold the input.     */    public void setSamples(int x, int y, int w, int h, int b,                           int iArray[], DataBuffer data) {	int Offset=0;	for (int i=y; i<(y+h); i++) {	    for (int j=x; j<(x+w); j++) {		setSample(j, i, b, iArray[Offset++], data);	    }	}    }    /**     * Sets the samples in the specified band for the specified rectangle     * of pixels from a float array containing one sample per array element.     * ArrayIndexOutOfBoundsException may be thrown if the coordinates are     * not in bounds.     * @param x 	The X coordinate of the upper left pixel location.     * @param y 	The Y coordinate of the upper left pixel location.     * @param w 	The width of the pixel rectangle.     * @param h 	The height of the pixel rectangle.     * @param b 	The band to set.     * @param fArray 	The input samples in a float array.     * @param data 	The DataBuffer containing the image data.     * @see #getSamples(int, int, int, int, int, float[], DataBuffer)     *     * @throws NullPointerException if fArray or data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates or     * the band index are not in bounds, or if fArray is too small to     * hold the input.     */    public void setSamples(int x, int y, int w, int h, int b,                           float fArray[], DataBuffer data) {	int Offset=0;	for (int i=y; i<(y+h); i++) {	    for (int j=x; j<(x+w); j++) {		setSample(j, i, b, fArray[Offset++], data);	    }	}    }    /**     * Sets the samples in the specified band for the specified rectangle     * of pixels from a double array containing one sample per array element.     * ArrayIndexOutOfBoundsException may be thrown if the coordinates are     * not in bounds.     * @param x 	The X coordinate of the upper left pixel location.     * @param y 	The Y coordinate of the upper left pixel location.     * @param w 	The width of the pixel rectangle.     * @param h 	The height of the pixel rectangle.     * @param b 	The band to set.     * @param dArray 	The input samples in a double array.     * @param data 	The DataBuffer containing the image data.     * @see #getSamples(int, int, int, int, int, double[], DataBuffer)     *     * @throws NullPointerException if dArray or data is null.     * @throws ArrayIndexOutOfBoundsException if the coordinates or     * the band index are not in bounds, or if dArray is too small to     * hold the input.     */    public void setSamples(int x, int y, int w, int h, int b,                           double dArray[], DataBuffer data) {	int Offset=0;	for (int i=y; i<(y+h); i++) {	    for (int j=x; j<(x+w); j++) {		setSample(j, i, b, dArray[Offset++], data);	    }	}    }    /**     *  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.     */    public abstract int[] getSampleSize();    /** Returns the size in bits of samples for the specified band.      *  @param band the specified band     *  @return the size of the samples of the specified band.         */    public abstract int getSampleSize(int band);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -