980 * {@code SampleModel.getNumBands}
981 *
982 * @return the number of bands in the image.
983 */
984 public int getNumBands() {
985 return sampleModel.getNumBands();
986 }
987
988 /**
989 * Return the number of bits used to represent samples of the given band.
990 *
991 * @param band the index of the band to be queried, as an
992 * int.
993 *
994 * @return an int specifying a number of bits.
995 *
996 * @exception IllegalArgumentException if {@code band} is
997 * negative or greater than the largest band index.
998 */
999 public int getBitsPerBand(int band) {
1000 if (band < 0 | band >= getNumBands()) {
1001 throw new IllegalArgumentException("band out of range!");
1002 }
1003 return sampleModel.getSampleSize(band);
1004 }
1005
1006 /**
1007 * Returns a {@code SampleModel} based on the settings
1008 * encapsulated within this object. The width and height of the
1009 * {@code SampleModel} will be set to arbitrary values.
1010 *
1011 * @return a {@code SampleModel} with arbitrary dimensions.
1012 */
1013 public SampleModel getSampleModel() {
1014 return sampleModel;
1015 }
1016
1017 /**
1018 * Returns a {@code SampleModel} based on the settings
1019 * encapsulated within this object. The width and height of the
1020 * {@code SampleModel} will be set to the supplied values.
|
980 * {@code SampleModel.getNumBands}
981 *
982 * @return the number of bands in the image.
983 */
984 public int getNumBands() {
985 return sampleModel.getNumBands();
986 }
987
988 /**
989 * Return the number of bits used to represent samples of the given band.
990 *
991 * @param band the index of the band to be queried, as an
992 * int.
993 *
994 * @return an int specifying a number of bits.
995 *
996 * @exception IllegalArgumentException if {@code band} is
997 * negative or greater than the largest band index.
998 */
999 public int getBitsPerBand(int band) {
1000 if (band < 0 || band >= getNumBands()) {
1001 throw new IllegalArgumentException("band out of range!");
1002 }
1003 return sampleModel.getSampleSize(band);
1004 }
1005
1006 /**
1007 * Returns a {@code SampleModel} based on the settings
1008 * encapsulated within this object. The width and height of the
1009 * {@code SampleModel} will be set to arbitrary values.
1010 *
1011 * @return a {@code SampleModel} with arbitrary dimensions.
1012 */
1013 public SampleModel getSampleModel() {
1014 return sampleModel;
1015 }
1016
1017 /**
1018 * Returns a {@code SampleModel} based on the settings
1019 * encapsulated within this object. The width and height of the
1020 * {@code SampleModel} will be set to the supplied values.
|