001: /*
002: * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package sun.awt.image;
027:
028: import java.awt.image.Raster;
029: import java.awt.image.WritableRaster;
030: import java.awt.image.RasterFormatException;
031: import java.awt.image.SampleModel;
032: import java.awt.image.SinglePixelPackedSampleModel;
033: import java.awt.image.DataBuffer;
034: import java.awt.image.DataBufferInt;
035: import java.awt.Rectangle;
036: import java.awt.Point;
037:
038: /**
039: * This class defines a Raster with pixels consisting of one or more 32-bit
040: * data elements stored in close proximity to each other in a integer array.
041: * The bit precision per data element is that
042: * of the data type (that is, the bit precision for this raster is 32).
043: * There is only one pixel stride and one scanline stride for all
044: * bands. For a given pixel, all samples fit in N data elements and these
045: * N data elements hold samples for only one pixel. This type of Raster
046: * can be used with a PackedColorModel.
047: * <p>
048: * For example, if there is only one data element per pixel, a
049: * SinglePixelPackedSampleModel can be used to represent multiple
050: * bands with a PackedColorModel (including a DirectColorModel) for
051: * color interpretation.
052: *
053: * @version 10 Feb 1997
054: */
055: public class IntegerComponentRaster extends SunWritableRaster {
056:
057: static final int TYPE_CUSTOM = 0;
058: static final int TYPE_BYTE_SAMPLES = 1;
059: static final int TYPE_USHORT_SAMPLES = 2;
060: static final int TYPE_INT_SAMPLES = 3;
061: static final int TYPE_BYTE_BANDED_SAMPLES = 4;
062: static final int TYPE_USHORT_BANDED_SAMPLES = 5;
063: static final int TYPE_INT_BANDED_SAMPLES = 6;
064: static final int TYPE_BYTE_PACKED_SAMPLES = 7;
065: static final int TYPE_USHORT_PACKED_SAMPLES = 8;
066: static final int TYPE_INT_PACKED_SAMPLES = 9;
067: static final int TYPE_INT_8BIT_SAMPLES = 10;
068: static final int TYPE_BYTE_BINARY_SAMPLES = 11;
069:
070: /** private band offset for use by native code */
071: protected int bandOffset;
072:
073: /** Data offsets for each band of image data. */
074: protected int[] dataOffsets;
075:
076: /** Scanline stride of the image data contained in this Raster. */
077: protected int scanlineStride;
078:
079: /** Pixel stride of the image data contained in this Raster. */
080: protected int pixelStride;
081:
082: /** The image data array. */
083: protected int[] data;
084:
085: /** The number of data elements required to store a pixel. */
086: protected int numDataElems;
087:
088: int type;
089:
090: /** A cached copy of minX + width for use in bounds checks. */
091: private int maxX;
092:
093: /** A cached copy of minY + height for use in bounds checks. */
094: private int maxY;
095:
096: static private native void initIDs();
097:
098: static {
099: /* ensure that the necessary native libraries are loaded */
100: NativeLibLoader.loadLibraries();
101: initIDs();
102: }
103:
104: /**
105: * Constructs a IntegerComponentRaster with the given SampleModel.
106: * The Raster's upper left corner is origin and it is the same
107: * size as the SampleModel. A DataBuffer large enough to describe the
108: * Raster is automatically created. SampleModel must be of type
109: * SinglePixelPackedSampleModel.
110: * @param sampleModel The SampleModel that specifies the layout.
111: * @param origin The Point that specified the origin.
112: */
113: public IntegerComponentRaster(SampleModel sampleModel, Point origin) {
114: this (sampleModel, sampleModel.createDataBuffer(),
115: new Rectangle(origin.x, origin.y, sampleModel
116: .getWidth(), sampleModel.getHeight()), origin,
117: null);
118: }
119:
120: /**
121: * Constructs a IntegerComponentRaster with the given SampleModel
122: * and DataBuffer. The Raster's upper left corner is origin and
123: * it is the same sizes the SampleModel. The DataBuffer is not
124: * initialized and must be a DataBufferInt compatible with SampleModel.
125: * SampleModel must be of type SinglePixelPackedSampleModel.
126: * @param sampleModel The SampleModel that specifies the layout.
127: * @param dataBuffer The DataBufferInt that contains the image data.
128: * @param origin The Point that specifies the origin.
129: */
130: public IntegerComponentRaster(SampleModel sampleModel,
131: DataBuffer dataBuffer, Point origin) {
132: this (sampleModel, dataBuffer, new Rectangle(origin.x, origin.y,
133: sampleModel.getWidth(), sampleModel.getHeight()),
134: origin, null);
135: }
136:
137: /**
138: * Constructs a IntegerComponentRaster with the given SampleModel,
139: * DataBuffer, and parent. DataBuffer must be a DataBufferInt and
140: * SampleModel must be of type SinglePixelPackedSampleModel.
141: * When translated into the base Raster's
142: * coordinate system, aRegion must be contained by the base Raster.
143: * Origin is the coodinate in the new Raster's coordinate system of
144: * the origin of the base Raster. (The base Raster is the Raster's
145: * ancestor which has no parent.)
146: *
147: * Note that this constructor should generally be called by other
148: * constructors or create methods, it should not be used directly.
149: * @param sampleModel The SampleModel that specifies the layout.
150: * @param dataBuffer The DataBufferInt that contains the image data.
151: * @param aRegion The Rectangle that specifies the image area.
152: * @param origin The Point that specifies the origin.
153: * @param parent The parent (if any) of this raster.
154: */
155: public IntegerComponentRaster(SampleModel sampleModel,
156: DataBuffer dataBuffer, Rectangle aRegion, Point origin,
157: IntegerComponentRaster parent) {
158: super (sampleModel, dataBuffer, aRegion, origin, parent);
159: this .maxX = minX + width;
160: this .maxY = minY + height;
161: if (!(dataBuffer instanceof DataBufferInt)) {
162: throw new RasterFormatException(
163: "IntegerComponentRasters must have"
164: + "integer DataBuffers");
165: }
166: DataBufferInt dbi = (DataBufferInt) dataBuffer;
167: if (dbi.getNumBanks() != 1) {
168: throw new RasterFormatException(
169: "DataBuffer for IntegerComponentRasters"
170: + " must only have 1 bank.");
171: }
172: this .data = stealData(dbi, 0);
173:
174: if (sampleModel instanceof SinglePixelPackedSampleModel) {
175: SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel) sampleModel;
176: int[] boffsets = sppsm.getBitOffsets();
177: boolean notByteBoundary = false;
178: for (int i = 1; i < boffsets.length; i++) {
179: if ((boffsets[i] % 8) != 0) {
180: notByteBoundary = true;
181: }
182: }
183: this .type = (notByteBoundary ? IntegerComponentRaster.TYPE_INT_PACKED_SAMPLES
184: : IntegerComponentRaster.TYPE_INT_8BIT_SAMPLES);
185:
186: this .scanlineStride = sppsm.getScanlineStride();
187: this .pixelStride = 1;
188: this .dataOffsets = new int[1];
189: this .dataOffsets[0] = dbi.getOffset();
190: this .bandOffset = this .dataOffsets[0];
191: int xOffset = aRegion.x - origin.x;
192: int yOffset = aRegion.y - origin.y;
193: dataOffsets[0] += xOffset + yOffset * scanlineStride;
194: this .numDataElems = sppsm.getNumDataElements();
195: } else {
196: throw new RasterFormatException(
197: "IntegerComponentRasters must have"
198: + " SinglePixelPackedSampleModel");
199: }
200:
201: verify(false);
202: }
203:
204: /**
205: * Returns a copy of the data offsets array. For each band the data offset
206: * is the index into the band's data array, of the first sample of the
207: * band.
208: */
209: public int[] getDataOffsets() {
210: return (int[]) dataOffsets.clone();
211: }
212:
213: /**
214: * Returns data offset for the specified band. The data offset
215: * is the index into the data array in which the first sample
216: * of the first scanline is stored.
217: */
218: public int getDataOffset(int band) {
219: return dataOffsets[band];
220: }
221:
222: /**
223: * Returns the scanline stride -- the number of data array elements between
224: * a given sample and the sample in the same column of the next row.
225: */
226: public int getScanlineStride() {
227: return scanlineStride;
228: }
229:
230: /**
231: * Returns pixel stride -- the number of data array elements between two
232: * samples for the same band on the same scanline.
233: */
234: public int getPixelStride() {
235: return pixelStride;
236: }
237:
238: /**
239: * Returns a reference to the data array.
240: */
241: public int[] getDataStorage() {
242: return data;
243: }
244:
245: /**
246: * Returns the data elements for all bands at the specified
247: * location.
248: * An ArrayIndexOutOfBounds exception will be thrown at runtime
249: * if the pixel coordinate is out of bounds.
250: * A ClassCastException will be thrown if the input object is non null
251: * and references anything other than an array of transferType.
252: * @param x The X coordinate of the pixel location.
253: * @param y The Y coordinate of the pixel location.
254: * @param outData An object reference to an array of type defined by
255: * getTransferType() and length getNumDataElements().
256: * If null an array of appropriate type and size will be
257: * allocated.
258: * @return An object reference to an array of type defined by
259: * getTransferType() with the request pixel data.
260: */
261: public Object getDataElements(int x, int y, Object obj) {
262: if ((x < this .minX) || (y < this .minY) || (x >= this .maxX)
263: || (y >= this .maxY)) {
264: throw new ArrayIndexOutOfBoundsException(
265: "Coordinate out of bounds!");
266: }
267: int outData[];
268: if (obj == null) {
269: outData = new int[numDataElements];
270: } else {
271: outData = (int[]) obj;
272: }
273: int off = (y - minY) * scanlineStride + (x - minX)
274: * pixelStride;
275: for (int band = 0; band < numDataElements; band++) {
276: outData[band] = data[dataOffsets[band] + off];
277: }
278:
279: return outData;
280: }
281:
282: /**
283: * Returns an array of data elements from the specified rectangular
284: * region.
285: * An ArrayIndexOutOfBounds exception will be thrown at runtime
286: * if the pixel coordinates are out of bounds.
287: * A ClassCastException will be thrown if the input object is non null
288: * and references anything other than an array of transferType.
289: <pre>
290: * int[] bandData = (int[])raster.getDataElements(x, y, w, h, null);
291: * int numDataElements = raster.getNumDataElements();
292: * int[] pixel = new int[numDataElements];
293: * // To find a data element at location (x2, y2)
294: * System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements,
295: * pixel, 0, numDataElements);
296: * </pre>
297: * @param x The X coordinate of the upper left pixel location.
298: * @param y The Y coordinate of the upper left pixel location.
299: * @param width Width of the pixel rectangle.
300: * @param height Height of the pixel rectangle.
301: * @param outData An object reference to an array of type defined by
302: * getTransferType() and length w*h*getNumDataElements().
303: * If null an array of appropriate type and size will be
304: * allocated.
305: * @return An object reference to an array of type defined by
306: * getTransferType() with the request pixel data.
307: */
308: public Object getDataElements(int x, int y, int w, int h, Object obj) {
309: if ((x < this .minX) || (y < this .minY) || (x + w > this .maxX)
310: || (y + h > this .maxY)) {
311: throw new ArrayIndexOutOfBoundsException(
312: "Coordinate out of bounds!");
313: }
314: int outData[];
315: if (obj instanceof int[]) {
316: outData = (int[]) obj;
317: } else {
318: outData = new int[numDataElements * w * h];
319: }
320: int yoff = (y - minY) * scanlineStride + (x - minX)
321: * pixelStride;
322: int xoff;
323: int off = 0;
324: int xstart;
325: int ystart;
326:
327: for (ystart = 0; ystart < h; ystart++, yoff += scanlineStride) {
328: xoff = yoff;
329: for (xstart = 0; xstart < w; xstart++, xoff += pixelStride) {
330: for (int c = 0; c < numDataElements; c++) {
331: outData[off++] = data[dataOffsets[c] + xoff];
332: }
333: }
334: }
335:
336: return outData;
337: }
338:
339: /**
340: * Stores the data elements for all bands at the specified location.
341: * An ArrayIndexOutOfBounds exception will be thrown at runtime
342: * if the pixel coordinate is out of bounds.
343: * A ClassCastException will be thrown if the input object is non null
344: * and references anything other than an array of transferType.
345: * @param x The X coordinate of the pixel location.
346: * @param y The Y coordinate of the pixel location.
347: * @param inData An object reference to an array of type defined by
348: * getTransferType() and length getNumDataElements()
349: * containing the pixel data to place at x,y.
350: */
351: public void setDataElements(int x, int y, Object obj) {
352: if ((x < this .minX) || (y < this .minY) || (x >= this .maxX)
353: || (y >= this .maxY)) {
354: throw new ArrayIndexOutOfBoundsException(
355: "Coordinate out of bounds!");
356: }
357: int inData[] = (int[]) obj;
358:
359: int off = (y - minY) * scanlineStride + (x - minX)
360: * pixelStride;
361:
362: for (int i = 0; i < numDataElements; i++) {
363: data[dataOffsets[i] + off] = inData[i];
364: }
365:
366: markDirty();
367: }
368:
369: /**
370: * Stores the Raster data at the specified location.
371: * The transferType of the inputRaster must match this raster.
372: * An ArrayIndexOutOfBoundsException will be thrown at runtime
373: * if the pixel coordinates are out of bounds.
374: * @param x The X coordinate of the pixel location.
375: * @param y The Y coordinate of the pixel location.
376: * @param inRaster Raster of data to place at x,y location.
377: */
378: public void setDataElements(int x, int y, Raster inRaster) {
379: int dstOffX = x + inRaster.getMinX();
380: int dstOffY = y + inRaster.getMinY();
381: int width = inRaster.getWidth();
382: int height = inRaster.getHeight();
383: if ((dstOffX < this .minX) || (dstOffY < this .minY)
384: || (dstOffX + width > this .maxX)
385: || (dstOffY + height > this .maxY)) {
386: throw new ArrayIndexOutOfBoundsException(
387: "Coordinate out of bounds!");
388: }
389: setDataElements(dstOffX, dstOffY, width, height, inRaster);
390: }
391:
392: /**
393: * Stores the Raster data at the specified location.
394: * @param dstX The absolute X coordinate of the destination pixel
395: * that will receive a copy of the upper-left pixel of the
396: * inRaster
397: * @param dstY The absolute Y coordinate of the destination pixel
398: * that will receive a copy of the upper-left pixel of the
399: * inRaster
400: * @param width The number of pixels to store horizontally
401: * @param height The number of pixels to store vertically
402: * @param inRaster Raster of data to place at x,y location.
403: */
404: private void setDataElements(int dstX, int dstY, int width,
405: int height, Raster inRaster) {
406: // Assume bounds checking has been performed previously
407: if (width <= 0 || height <= 0) {
408: return;
409: }
410:
411: // Write inRaster (minX, minY) to (dstX, dstY)
412:
413: int srcOffX = inRaster.getMinX();
414: int srcOffY = inRaster.getMinY();
415: int tdata[] = null;
416:
417: if (inRaster instanceof IntegerComponentRaster
418: && (pixelStride == 1) && (numDataElements == 1)) {
419: IntegerComponentRaster ict = (IntegerComponentRaster) inRaster;
420: if (ict.getNumDataElements() != 1) {
421: throw new ArrayIndexOutOfBoundsException(
422: "Number of bands" + " does not match");
423: }
424:
425: // Extract the raster parameters
426: tdata = ict.getDataStorage();
427: int tss = ict.getScanlineStride();
428: int toff = ict.getDataOffset(0);
429:
430: int srcOffset = toff;
431:
432: int dstOffset = dataOffsets[0] + (dstY - minY)
433: * scanlineStride + (dstX - minX);
434:
435: // Fastest case. We can copy scanlines
436: if (ict.getPixelStride() == pixelStride) {
437: width *= pixelStride;
438:
439: // Loop through all of the scanlines and copy the data
440: for (int startY = 0; startY < height; startY++) {
441: System.arraycopy(tdata, srcOffset, data, dstOffset,
442: width);
443: srcOffset += tss;
444: dstOffset += scanlineStride;
445: }
446: markDirty();
447: return;
448: }
449: }
450:
451: Object odata = null;
452: for (int startY = 0; startY < height; startY++) {
453: odata = inRaster.getDataElements(srcOffX, srcOffY + startY,
454: width, 1, odata);
455: setDataElements(dstX, dstY + startY, width, 1, odata);
456: }
457: }
458:
459: /**
460: * Stores an array of data elements into the specified rectangular
461: * region.
462: * An ArrayIndexOutOfBounds exception will be thrown at runtime
463: * if the pixel coordinates are out of bounds.
464: * A ClassCastException will be thrown if the input object is non null
465: * and references anything other than an array of transferType.
466: * The data elements in the
467: * data array are assumed to be packed. That is, a data element
468: * for the nth band at location (x2, y2) would be found at:
469: * <pre>
470: * inData[((y2-y)*w + (x2-x))*numDataElements + n]
471: * </pre>
472: * @param x The X coordinate of the upper left pixel location.
473: * @param y The Y coordinate of the upper left pixel location.
474: * @param w Width of the pixel rectangle.
475: * @param h Height of the pixel rectangle.
476: * @param inData An object reference to an array of type defined by
477: * getTransferType() and length w*h*getNumDataElements()
478: * containing the pixel data to place between x,y and
479: * x+h, y+h.
480: */
481: public void setDataElements(int x, int y, int w, int h, Object obj) {
482: if ((x < this .minX) || (y < this .minY) || (x + w > this .maxX)
483: || (y + h > this .maxY)) {
484: throw new ArrayIndexOutOfBoundsException(
485: "Coordinate out of bounds!");
486: }
487: int inData[] = (int[]) obj;
488:
489: int yoff = (y - minY) * scanlineStride + (x - minX)
490: * pixelStride;
491: int xoff;
492: int off = 0;
493: int xstart;
494: int ystart;
495:
496: for (ystart = 0; ystart < h; ystart++, yoff += scanlineStride) {
497: xoff = yoff;
498: for (xstart = 0; xstart < w; xstart++, xoff += pixelStride) {
499: for (int c = 0; c < numDataElements; c++) {
500: data[dataOffsets[c] + xoff] = inData[off++];
501: }
502: }
503: }
504:
505: markDirty();
506: }
507:
508: /**
509: * Creates a subraster given a region of the raster. The x and y
510: * coordinates specify the horizontal and vertical offsets
511: * from the upper-left corner of this raster to the upper-left corner
512: * of the subraster. A subset of the bands of the parent Raster may
513: * be specified. If this is null, then all the bands are present in the
514: * subRaster. A translation to the subRaster may also be specified.
515: * Note that the subraster will reference the same
516: * DataBuffer as the parent raster, but using different offsets.
517: * @param x X offset.
518: * @param y Y offset.
519: * @param width Width (in pixels) of the subraster.
520: * @param height Height (in pixels) of the subraster.
521: * @param x0 Translated X origin of the subraster.
522: * @param y0 Translated Y origin of the subraster.
523: * @param bandList Array of band indices.
524: * @exception RasterFormatException
525: * if the specified bounding box is outside of the parent raster.
526: */
527: public WritableRaster createWritableChild(int x, int y, int width,
528: int height, int x0, int y0, int bandList[]) {
529: if (x < this .minX) {
530: throw new RasterFormatException("x lies outside raster");
531: }
532: if (y < this .minY) {
533: throw new RasterFormatException("y lies outside raster");
534: }
535: if ((x + width < x) || (x + width > this .minX + this .width)) {
536: throw new RasterFormatException(
537: "(x + width) is outside raster");
538: }
539: if ((y + height < y) || (y + height > this .minY + this .height)) {
540: throw new RasterFormatException(
541: "(y + height) is outside raster");
542: }
543:
544: SampleModel sm;
545:
546: if (bandList != null)
547: sm = sampleModel.createSubsetSampleModel(bandList);
548: else
549: sm = sampleModel;
550:
551: int deltaX = x0 - x;
552: int deltaY = y0 - y;
553:
554: return new IntegerComponentRaster(sm, dataBuffer,
555: new Rectangle(x0, y0, width, height), new Point(
556: sampleModelTranslateX + deltaX,
557: sampleModelTranslateY + deltaY), this );
558: }
559:
560: /**
561: * Creates a subraster given a region of the raster. The x and y
562: * coordinates specify the horizontal and vertical offsets
563: * from the upper-left corner of this raster to the upper-left corner
564: * of the subraster. A subset of the bands of the parent raster may
565: * be specified. If this is null, then all the bands are present in the
566: * subRaster. Note that the subraster will reference the same
567: * DataBuffer as the parent raster, but using different offsets.
568: * @param x X offset.
569: * @param y Y offset.
570: * @param width Width (in pixels) of the subraster.
571: * @param height Height (in pixels) of the subraster.
572: * @param x0 Translated X origin of the subRaster.
573: * @param y0 Translated Y origin of the subRaster.
574: * @param bandList Array of band indices.
575: * @exception RasterFormatException
576: * if the specified bounding box is outside of the parent raster.
577: */
578: public Raster createChild(int x, int y, int width, int height,
579: int x0, int y0, int bandList[]) {
580: return createWritableChild(x, y, width, height, x0, y0,
581: bandList);
582: }
583:
584: /**
585: * Creates a raster with the same band layout but using a different
586: * width and height, and with new zeroed data arrays.
587: */
588: public WritableRaster createCompatibleWritableRaster(int w, int h) {
589: if (w <= 0 || h <= 0) {
590: throw new RasterFormatException("negative "
591: + ((w <= 0) ? "width" : "height"));
592: }
593:
594: SampleModel sm = sampleModel.createCompatibleSampleModel(w, h);
595:
596: return new IntegerComponentRaster(sm, new Point(0, 0));
597: }
598:
599: /**
600: * Creates a raster with the same data layout and the same
601: * width and height, and with new zeroed data arrays. If
602: * the raster is a subraster, this will call
603: * createCompatibleRaster(width, height).
604: */
605: public WritableRaster createCompatibleWritableRaster() {
606: return createCompatibleWritableRaster(width, height);
607: }
608:
609: /**
610: * Verify that the layout parameters are consistent with
611: * the data. If strictCheck
612: * is false, this method will check for ArrayIndexOutOfBounds conditions. If
613: * strictCheck is true, this method will check for additional error
614: * conditions such as line wraparound (width of a line greater than
615: * the scanline stride).
616: * @return String Error string, if the layout is incompatible with
617: * the data. Otherwise returns null.
618: */
619: private void verify(boolean strictCheck) {
620: if (dataOffsets[0] < 0) {
621: throw new RasterFormatException("Data offset ("
622: + dataOffsets[0] + ") must be >= 0");
623: }
624:
625: int maxSize = 0;
626: int size;
627:
628: for (int i = 0; i < numDataElements; i++) {
629: size = (height - 1) * scanlineStride + (width - 1)
630: * pixelStride + dataOffsets[i];
631: if (size > maxSize) {
632: maxSize = size;
633: }
634: }
635: if (data.length < maxSize) {
636: throw new RasterFormatException(
637: "Data array too small (should be " + maxSize
638: + " but is " + data.length + " )");
639: }
640: }
641:
642: public String toString() {
643: return new String("IntegerComponentRaster: width = " + width
644: + " height = " + height + " #Bands = " + numBands
645: + " #DataElements " + numDataElements + " xOff = "
646: + sampleModelTranslateX + " yOff = "
647: + sampleModelTranslateY + " dataOffset[0] "
648: + dataOffsets[0]);
649: }
650:
651: // /**
652: // * For debugging... prints a region of a one-band IntegerComponentRaster
653: // */
654: // public void print(int x, int y, int w, int h) {
655: // // REMIND: Only works for 1 band!
656: // System.out.println(this);
657: // int offset = dataOffsets[0] + y*scanlineStride + x*pixelStride;
658: // int off;
659: // for (int yoff=0; yoff < h; yoff++, offset += scanlineStride) {
660: // off = offset;
661: // System.out.print("Line "+(sampleModelTranslateY+y+yoff)+": ");
662: // for (int xoff = 0; xoff < w; xoff++, off+= pixelStride) {
663: // System.out.print(Integer.toHexString(data[off])+" ");
664: // }
665: // System.out.println("");
666: // }
667: // }
668:
669: }
|