equal
deleted
inserted
replaced
459 * @return all samples for the specified region of pixels. |
459 * @return all samples for the specified region of pixels. |
460 * @see #setPixels(int, int, int, int, int[], DataBuffer) |
460 * @see #setPixels(int, int, int, int, int[], DataBuffer) |
461 */ |
461 */ |
462 public int[] getPixels(int x, int y, int w, int h, |
462 public int[] getPixels(int x, int y, int w, int h, |
463 int iArray[], DataBuffer data) { |
463 int iArray[], DataBuffer data) { |
464 if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { |
464 int x1 = x + w; |
|
465 int y1 = y + h; |
|
466 |
|
467 if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || |
|
468 y < 0 || y >= height || h > height || y1 < 0 || y1 > height) |
|
469 { |
465 throw new ArrayIndexOutOfBoundsException |
470 throw new ArrayIndexOutOfBoundsException |
466 ("Coordinate out of bounds!"); |
471 ("Coordinate out of bounds!"); |
467 } |
472 } |
468 int pixels[]; |
473 int pixels[]; |
469 if (iArray != null) { |
474 if (iArray != null) { |
657 * @param data The DataBuffer containing the image data. |
662 * @param data The DataBuffer containing the image data. |
658 * @see #getPixels(int, int, int, int, int[], DataBuffer) |
663 * @see #getPixels(int, int, int, int, int[], DataBuffer) |
659 */ |
664 */ |
660 public void setPixels(int x, int y, int w, int h, |
665 public void setPixels(int x, int y, int w, int h, |
661 int iArray[], DataBuffer data) { |
666 int iArray[], DataBuffer data) { |
662 if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { |
667 int x1 = x + w; |
|
668 int y1 = y + h; |
|
669 |
|
670 if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || |
|
671 y < 0 || y >= height || h > height || y1 < 0 || y1 > height) |
|
672 { |
663 throw new ArrayIndexOutOfBoundsException |
673 throw new ArrayIndexOutOfBoundsException |
664 ("Coordinate out of bounds!"); |
674 ("Coordinate out of bounds!"); |
665 } |
675 } |
666 |
676 |
667 int lineOffset = y*scanlineStride + x; |
677 int lineOffset = y*scanlineStride + x; |