1171 int iArray[], DataBuffer data) {
1172 // Bounds check for 'b' will be performed automatically
1173 if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
1174 throw new ArrayIndexOutOfBoundsException
1175 ("Coordinate out of bounds!");
1176 }
1177 int lineOffset = y*scanlineStride + x*pixelStride + bandOffsets[b];
1178 int srcOffset = 0;
1179
1180 for (int i = 0; i < h; i++) {
1181 int sampleOffset = lineOffset;
1182 for (int j = 0; j < w; j++) {
1183 data.setElem(bankIndices[b], sampleOffset, iArray[srcOffset++]);
1184 sampleOffset += pixelStride;
1185 }
1186 lineOffset += scanlineStride;
1187 }
1188 }
1189
1190 public boolean equals(Object o) {
1191 if ((o == null) || !(o instanceof ComponentSampleModel)) {
1192 return false;
1193 }
1194
1195 ComponentSampleModel that = (ComponentSampleModel)o;
1196 return this.width == that.width &&
1197 this.height == that.height &&
1198 this.numBands == that.numBands &&
1199 this.dataType == that.dataType &&
1200 Arrays.equals(this.bandOffsets, that.bandOffsets) &&
1201 Arrays.equals(this.bankIndices, that.bankIndices) &&
1202 this.numBands == that.numBands &&
1203 this.numBanks == that.numBanks &&
1204 this.scanlineStride == that.scanlineStride &&
1205 this.pixelStride == that.pixelStride;
1206 }
1207
1208 // If we implement equals() we must also implement hashCode
1209 public int hashCode() {
1210 int hash = 0;
1211 hash = width;
|
1171 int iArray[], DataBuffer data) {
1172 // Bounds check for 'b' will be performed automatically
1173 if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
1174 throw new ArrayIndexOutOfBoundsException
1175 ("Coordinate out of bounds!");
1176 }
1177 int lineOffset = y*scanlineStride + x*pixelStride + bandOffsets[b];
1178 int srcOffset = 0;
1179
1180 for (int i = 0; i < h; i++) {
1181 int sampleOffset = lineOffset;
1182 for (int j = 0; j < w; j++) {
1183 data.setElem(bankIndices[b], sampleOffset, iArray[srcOffset++]);
1184 sampleOffset += pixelStride;
1185 }
1186 lineOffset += scanlineStride;
1187 }
1188 }
1189
1190 public boolean equals(Object o) {
1191 if ((o == null) || (o.getClass() != getClass())) {
1192 return false;
1193 }
1194
1195 ComponentSampleModel that = (ComponentSampleModel)o;
1196 return this.width == that.width &&
1197 this.height == that.height &&
1198 this.numBands == that.numBands &&
1199 this.dataType == that.dataType &&
1200 Arrays.equals(this.bandOffsets, that.bandOffsets) &&
1201 Arrays.equals(this.bankIndices, that.bankIndices) &&
1202 this.numBands == that.numBands &&
1203 this.numBanks == that.numBanks &&
1204 this.scanlineStride == that.scanlineStride &&
1205 this.pixelStride == that.pixelStride;
1206 }
1207
1208 // If we implement equals() we must also implement hashCode
1209 public int hashCode() {
1210 int hash = 0;
1211 hash = width;
|