1 7 8 17 18 19 package java.awt.image; 20 import java.awt.Rectangle ; 21 import java.awt.Point ; 22 23 import sun.awt.image.ByteInterleavedRaster; 24 import sun.awt.image.ShortInterleavedRaster; 25 import sun.awt.image.IntegerInterleavedRaster; 26 import sun.awt.image.ByteBandedRaster; 27 import sun.awt.image.ShortBandedRaster; 28 import sun.awt.image.BytePackedRaster; 29 import sun.awt.image.SunWritableRaster; 30 31 108 public class Raster { 109 110 114 protected SampleModel sampleModel; 115 116 117 protected DataBuffer dataBuffer; 118 119 120 protected int minX; 121 122 123 protected int minY; 124 125 126 protected int width; 127 128 129 protected int height; 130 131 135 protected int sampleModelTranslateX; 136 137 141 protected int sampleModelTranslateY; 142 143 144 protected int numBands; 145 146 147 protected int numDataElements; 148 149 150 protected Raster parent; 151 152 static private native void initIDs(); 153 static { 154 ColorModel.loadLibraries(); 155 initIDs(); 156 } 157 158 186 public static WritableRaster createInterleavedRaster(int dataType, 187 int w, int h, 188 int bands, 189 Point location) { 190 int[] bandOffsets = new int[bands]; 191 for (int i = 0; i < bands; i++) { 192 bandOffsets[i] = i; 193 } 194 return createInterleavedRaster(dataType, w, h, w*bands, bands, 195 bandOffsets, location); 196 } 197 198 235 public static WritableRaster createInterleavedRaster(int dataType, 236 int w, int h, 237 int scanlineStride, 238 int pixelStride, 239 int bandOffsets[], 240 Point location) { 241 DataBuffer d; 242 int bands = bandOffsets.length; 243 244 int maxBandOff = bandOffsets[0]; 245 for (int i=1; i < bands; i++) { 246 if (bandOffsets[i] > maxBandOff) { 247 maxBandOff = bandOffsets[i]; 248 } 249 } 250 int size = maxBandOff + scanlineStride*(h-1) + pixelStride*(w-1) + 1; 251 switch(dataType) { 252 case DataBuffer.TYPE_BYTE: 253 d = new DataBufferByte (size); 254 break; 255 256 case DataBuffer.TYPE_USHORT: 257 d = new DataBufferUShort (size); 258 break; 259 260 default: 261 throw new IllegalArgumentException ("Unsupported data type " + 262 dataType); 263 } 264 265 SunWritableRaster raster = (SunWritableRaster) 266 createInterleavedRaster(d, w, h, scanlineStride, 267 pixelStride, bandOffsets, location); 268 raster.setStolen(false); 269 return raster; 270 } 271 272 298 public static WritableRaster createBandedRaster(int dataType, 299 int w, int h, 300 int bands, 301 Point location) { 302 if (bands < 1) { 303 throw new ArrayIndexOutOfBoundsException ("Number of bands ("+ 304 bands+") must"+ 305 " be greater than 0"); 306 } 307 int[] bankIndices = new int[bands]; 308 int[] bandOffsets = new int[bands]; 309 for (int i = 0; i < bands; i++) { 310 bankIndices[i] = i; 311 bandOffsets[i] = 0; 312 } 313 314 return createBandedRaster(dataType, w, h, w, 315 bankIndices, bandOffsets, 316 location); 317 } 318 319 355 public static WritableRaster createBandedRaster(int dataType, 356 int w, int h, 357 int scanlineStride, 358 int bankIndices[], 359 int bandOffsets[], 360 Point location) { 361 DataBuffer d; 362 int bands = bandOffsets.length; 363 364 if (bankIndices == null) { 365 throw new 366 ArrayIndexOutOfBoundsException ("Bank indices array is null"); 367 } 368 if (bandOffsets == null) { 369 throw new 370 ArrayIndexOutOfBoundsException ("Band offsets array is null"); 371 } 372 373 int maxBank = bankIndices[0]; 375 int maxBandOff = bandOffsets[0]; 376 for (int i = 1; i < bands; i++) { 377 if (bankIndices[i] > maxBank) { 378 maxBank = bankIndices[i]; 379 } 380 if (bandOffsets[i] > maxBandOff) { 381 maxBandOff = bandOffsets[i]; 382 } 383 } 384 int banks = maxBank + 1; 385 int size = maxBandOff + scanlineStride*(h-1) + (w-1) + 1; 386 387 switch(dataType) { 388 case DataBuffer.TYPE_BYTE: 389 d = new DataBufferByte (size, banks); 390 break; 391 392 case DataBuffer.TYPE_USHORT: 393 d = new DataBufferUShort (size, banks); 394 break; 395 396 case DataBuffer.TYPE_INT: 397 d = new DataBufferInt (size, banks); 398 break; 399 400 default: 401 throw new IllegalArgumentException ("Unsupported data type " + 402 dataType); 403 } 404 405 SunWritableRaster raster = (SunWritableRaster) 406 createBandedRaster(d, w, h, scanlineStride, 407 bankIndices, bandOffsets, location); 408 raster.setStolen(false); 409 return raster; 410 } 411 412 442 public static WritableRaster createPackedRaster(int dataType, 443 int w, int h, 444 int bandMasks[], 445 Point location) { 446 DataBuffer d; 447 448 switch(dataType) { 449 case DataBuffer.TYPE_BYTE: 450 d = new DataBufferByte (w*h); 451 break; 452 453 case DataBuffer.TYPE_USHORT: 454 d = new DataBufferUShort (w*h); 455 break; 456 457 case DataBuffer.TYPE_INT: 458 d = new DataBufferInt (w*h); 459 break; 460 461 default: 462 throw new IllegalArgumentException ("Unsupported data type " + 463 dataType); 464 } 465 466 SunWritableRaster raster = (SunWritableRaster) 467 createPackedRaster(d, w, h, w, bandMasks, location); 468 raster.setStolen(false); 469 return raster; 470 } 471 472 516 public static WritableRaster createPackedRaster(int dataType, 517 int w, int h, 518 int bands, 519 int bitsPerBand, 520 Point location) { 521 DataBuffer d; 522 523 if (bands <= 0) { 524 throw new IllegalArgumentException ("Number of bands ("+bands+ 525 ") must be greater than 0"); 526 } 527 528 if (bitsPerBand <= 0) { 529 throw new IllegalArgumentException ("Bits per band ("+bitsPerBand+ 530 ") must be greater than 0"); 531 } 532 533 if (bands != 1) { 534 int[] masks = new int[bands]; 535 int mask = (1 << bitsPerBand) - 1; 536 int shift = (bands-1)*bitsPerBand; 537 538 539 if (shift+bitsPerBand > DataBuffer.getDataTypeSize(dataType)) { 540 throw new IllegalArgumentException ("bitsPerBand("+ 541 bitsPerBand+") * bands is "+ 542 " greater than data type "+ 543 "size."); 544 } 545 switch(dataType) { 546 case DataBuffer.TYPE_BYTE: 547 case DataBuffer.TYPE_USHORT: 548 case DataBuffer.TYPE_INT: 549 break; 550 default: 551 throw new IllegalArgumentException ("Unsupported data type " + 552 dataType); 553 } 554 555 for (int i = 0; i < bands; i++) { 556 masks[i] = mask << shift; 557 shift = shift - bitsPerBand; 558 } 559 560 return createPackedRaster(dataType, w, h, masks, location); 561 } 562 else { 563 double fw = w; 564 switch(dataType) { 565 case DataBuffer.TYPE_BYTE: 566 d = new DataBufferByte ((int)(Math.ceil(fw/(8/bitsPerBand)))*h); 567 break; 568 569 case DataBuffer.TYPE_USHORT: 570 d = new DataBufferUShort ((int)(Math.ceil(fw/(16/bitsPerBand)))*h); 571 break; 572 573 case DataBuffer.TYPE_INT: 574 d = new DataBufferInt ((int)(Math.ceil(fw/(32/bitsPerBand)))*h); 575 break; 576 577 default: 578 throw new IllegalArgumentException ("Unsupported data type " + 579 dataType); 580 } 581 582 SunWritableRaster raster = (SunWritableRaster) 583 createPackedRaster(d, w, h, bitsPerBand, location); 584 raster.setStolen(false); 585 return raster; 586 } 587 } 588 589 624 public static WritableRaster createInterleavedRaster(DataBuffer dataBuffer, 625 int w, int h, 626 int scanlineStride, 627 int pixelStride, 628 int bandOffsets[], 629 Point location) { 630 if (dataBuffer == null) { 631 throw new NullPointerException ("DataBuffer cannot be null"); 632 } 633 if (location == null) { 634 location = new Point (0, 0); 635 } 636 int dataType = dataBuffer.getDataType(); 637 638 PixelInterleavedSampleModel csm = 639 new PixelInterleavedSampleModel (dataType, w, h, 640 pixelStride, 641 scanlineStride, 642 bandOffsets); 643 switch(dataType) { 644 case DataBuffer.TYPE_BYTE: 645 return new ByteInterleavedRaster(csm, dataBuffer, location); 646 647 case DataBuffer.TYPE_USHORT: 648 return new ShortInterleavedRaster(csm, dataBuffer, location); 649 650 default: 651 throw new IllegalArgumentException ("Unsupported data type " + 652 dataType); 653 } 654 } 655 656 686 public static WritableRaster createBandedRaster(DataBuffer dataBuffer, 687 int w, int h, 688 int scanlineStride, 689 int bankIndices[], 690 int bandOffsets[], 691 Point location) { 692 if (dataBuffer == null) { 693 throw new NullPointerException ("DataBuffer cannot be null"); 694 } 695 if (location == null) { 696 location = new Point (0,0); 697 } 698 int dataType = dataBuffer.getDataType(); 699 700 int bands = bankIndices.length; 701 if (bandOffsets.length != bands) { 702 throw new IllegalArgumentException ( 703 "bankIndices.length != bandOffsets.length"); 704 } 705 706 BandedSampleModel bsm = 707 new BandedSampleModel (dataType, w, h, 708 scanlineStride, 709 bankIndices, bandOffsets); 710 711 switch(dataType) { 712 case DataBuffer.TYPE_BYTE: 713 return new ByteBandedRaster(bsm, dataBuffer, location); 714 715 case DataBuffer.TYPE_USHORT: 716 return new ShortBandedRaster(bsm, dataBuffer, location); 717 718 case DataBuffer.TYPE_INT: 719 return new SunWritableRaster(bsm, dataBuffer, location); 720 721 default: 722 throw new IllegalArgumentException ("Unsupported data type " + 723 dataType); 724 } 725 } 726 727 757 public static WritableRaster createPackedRaster(DataBuffer dataBuffer, 758 int w, int h, 759 int scanlineStride, 760 int bandMasks[], 761 Point location) { 762 if (dataBuffer == null) { 763 throw new NullPointerException ("DataBuffer cannot be null"); 764 } 765 if (location == null) { 766 location = new Point (0,0); 767 } 768 int dataType = dataBuffer.getDataType(); 769 770 SinglePixelPackedSampleModel sppsm = 771 new SinglePixelPackedSampleModel (dataType, w, h, scanlineStride, 772 bandMasks); 773 774 switch(dataType) { 775 case DataBuffer.TYPE_BYTE: 776 return new ByteInterleavedRaster(sppsm, dataBuffer, location); 777 778 case DataBuffer.TYPE_USHORT: 779 return new ShortInterleavedRaster(sppsm, dataBuffer, location); 780 781 case DataBuffer.TYPE_INT: 782 return new IntegerInterleavedRaster(sppsm, dataBuffer, location); 783 784 default: 785 throw new IllegalArgumentException ("Unsupported data type " + 786 dataType); 787 } 788 } 789 790 818 public static WritableRaster createPackedRaster(DataBuffer dataBuffer, 819 int w, int h, 820 int bitsPerPixel, 821 Point location) { 822 if (dataBuffer == null) { 823 throw new NullPointerException ("DataBuffer cannot be null"); 824 } 825 if (location == null) { 826 location = new Point (0,0); 827 } 828 int dataType = dataBuffer.getDataType(); 829 830 if (dataType != DataBuffer.TYPE_BYTE && 831 dataType != DataBuffer.TYPE_USHORT && 832 dataType != DataBuffer.TYPE_INT) { 833 throw new IllegalArgumentException ("Unsupported data type " + 834 dataType); 835 } 836 837 if (dataBuffer.getNumBanks() != 1) { 838 throw new 839 RasterFormatException ("DataBuffer for packed Rasters"+ 840 " must only have 1 bank."); 841 } 842 843 MultiPixelPackedSampleModel mppsm = 844 new MultiPixelPackedSampleModel (dataType, w, h, bitsPerPixel); 845 846 if (dataType == DataBuffer.TYPE_BYTE && 847 (bitsPerPixel == 1 || bitsPerPixel == 2 || bitsPerPixel == 4)) { 848 return new BytePackedRaster(mppsm, dataBuffer, location); 849 } else { 850 return new SunWritableRaster(mppsm, dataBuffer, location); 851 } 852 } 853 854 855 876 public static Raster createRaster(SampleModel sm, 877 DataBuffer db, 878 Point location) { 879 if ((sm == null) || (db == null)) { 880 throw new NullPointerException ("SampleModel and DataBuffer cannot be null"); 881 } 882 883 if (location == null) { 884 location = new Point (0,0); 885 } 886 int dataType = sm.getDataType(); 887 888 if (sm instanceof PixelInterleavedSampleModel ) { 889 switch(dataType) { 890 case DataBuffer.TYPE_BYTE: 891 return new ByteInterleavedRaster(sm, db, location); 892 893 case DataBuffer.TYPE_USHORT: 894 return new ShortInterleavedRaster(sm, db, location); 895 } 896 } else if (sm instanceof SinglePixelPackedSampleModel ) { 897 switch(dataType) { 898 case DataBuffer.TYPE_BYTE: 899 return new ByteInterleavedRaster(sm, db, location); 900 901 case DataBuffer.TYPE_USHORT: 902 return new ShortInterleavedRaster(sm, db, location); 903 904 case DataBuffer.TYPE_INT: 905 return new IntegerInterleavedRaster(sm, db, location); 906 } 907 } else if (sm instanceof MultiPixelPackedSampleModel && 908 dataType == DataBuffer.TYPE_BYTE && 909 sm.getSampleSize(0) < 8) { 910 return new BytePackedRaster(sm, db, location); 911 } 912 913 915 return new Raster (sm,db,location); 916 } 917 918 932 public static WritableRaster createWritableRaster(SampleModel sm, 933 Point location) { 934 if (location == null) { 935 location = new Point (0,0); 936 } 937 938 SunWritableRaster raster = (SunWritableRaster) 939 createWritableRaster(sm, sm.createDataBuffer(), location); 940 raster.setStolen(false); 941 return raster; 942 } 943 944 965 public static WritableRaster createWritableRaster(SampleModel sm, 966 DataBuffer db, 967 Point location) { 968 if ((sm == null) || (db == null)) { 969 throw new NullPointerException ("SampleModel and DataBuffer cannot be null"); 970 } 971 if (location == null) { 972 location = new Point (0,0); 973 } 974 975 int dataType = sm.getDataType(); 976 977 if (sm instanceof PixelInterleavedSampleModel ) { 978 switch(dataType) { 979 case DataBuffer.TYPE_BYTE: 980 return new ByteInterleavedRaster(sm, db, location); 981 982 case DataBuffer.TYPE_USHORT: 983 return new ShortInterleavedRaster(sm, db, location); 984 } 985 } else if (sm instanceof SinglePixelPackedSampleModel ) { 986 switch(dataType) { 987 case DataBuffer.TYPE_BYTE: 988 return new ByteInterleavedRaster(sm, db, location); 989 990 case DataBuffer.TYPE_USHORT: 991 return new ShortInterleavedRaster(sm, db, location); 992 993 case DataBuffer.TYPE_INT: 994 return new IntegerInterleavedRaster(sm, db, location); 995 } 996 } else if (sm instanceof MultiPixelPackedSampleModel && 997 dataType == DataBuffer.TYPE_BYTE && 998 sm.getSampleSize(0) < 8) { 999 return new BytePackedRaster(sm, db, location); 1000 } 1001 1002 1004 return new SunWritableRaster(sm,db,location); 1005 } 1006 1007 1021 protected Raster(SampleModel sampleModel, 1022 Point origin) { 1023 this(sampleModel, 1024 sampleModel.createDataBuffer(), 1025 new Rectangle (origin.x, 1026 origin.y, 1027 sampleModel.getWidth(), 1028 sampleModel.getHeight()), 1029 origin, 1030 null); 1031 } 1032 1033 1048 protected Raster(SampleModel sampleModel, 1049 DataBuffer dataBuffer, 1050 Point origin) { 1051 this(sampleModel, 1052 dataBuffer, 1053 new Rectangle (origin.x, 1054 origin.y, 1055 sampleModel.getWidth(), 1056 sampleModel.getHeight()), 1057 origin, 1058 null); 1059 } 1060 1061 1087 protected Raster(SampleModel sampleModel, 1088 DataBuffer dataBuffer, 1089 Rectangle aRegion, 1090 Point sampleModelTranslate, 1091 Raster parent) { 1092 1093 if ((sampleModel == null) || (dataBuffer == null) || 1094 (aRegion == null) || (sampleModelTranslate == null)) { 1095 throw new NullPointerException ("SampleModel, dataBuffer, aRegion and " + 1096 "sampleModelTranslate cannot be null"); 1097 } 1098 this.sampleModel = sampleModel; 1099 this.dataBuffer = dataBuffer; 1100 minX = aRegion.x; 1101 minY = aRegion.y; 1102 width = aRegion.width; 1103 height = aRegion.height; 1104 if (width <= 0 || height <= 0) { 1105 throw new RasterFormatException ("negative or zero " + 1106 ((width <= 0) ? "width" : "height")); 1107 } 1108 if ((minX + width) < minX) { 1109 throw new RasterFormatException ( 1110 "overflow condition for X coordinates of Raster"); 1111 } 1112 if ((minY + height) < minY) { 1113 throw new RasterFormatException ( 1114 "overflow condition for Y coordinates of Raster"); 1115 } 1116 1117 sampleModelTranslateX = sampleModelTranslate.x; 1118 sampleModelTranslateY = sampleModelTranslate.y; 1119 1120 numBands = sampleModel.getNumBands(); 1121 numDataElements = sampleModel.getNumDataElements(); 1122 this.parent = parent; 1123 } 1124 1125 1126 1130 public Raster getParent() { 1131 return parent; 1132 } 1133 1134 1142 final public int getSampleModelTranslateX() { 1143 return sampleModelTranslateX; 1144 } 1145 1146 1154 final public int getSampleModelTranslateY() { 1155 return sampleModelTranslateY; 1156 } 1157 1158 1164 public WritableRaster createCompatibleWritableRaster() { 1165 return new SunWritableRaster(sampleModel, new Point (0,0)); 1166 } 1167 1168 1178 public WritableRaster createCompatibleWritableRaster(int w, int h) { 1179 if (w <= 0 || h <=0) { 1180 throw new RasterFormatException ("negative " + 1181 ((w <= 0) ? "width" : "height")); 1182 } 1183 1184 SampleModel sm = sampleModel.createCompatibleSampleModel(w,h); 1185 1186 return new SunWritableRaster(sm, new Point (0,0)); 1187 } 1188 1189 1204 public WritableRaster createCompatibleWritableRaster(Rectangle rect) { 1205 if (rect == null) { 1206 throw new NullPointerException ("Rect cannot be null"); 1207 } 1208 return createCompatibleWritableRaster(rect.x, rect.y, 1209 rect.width, rect.height); 1210 } 1211 1212 1228 public WritableRaster createCompatibleWritableRaster(int x, int y, 1229 int w, int h) { 1230 WritableRaster ret = createCompatibleWritableRaster(w, h); 1231 return ret.createWritableChild(0,0,w,h,x,y,null); 1232 } 1233 1234 1250 public Raster createTranslatedChild(int childMinX, int childMinY) { 1251 return createChild(minX,minY,width,height, 1252 childMinX,childMinY,null); 1253 } 1254 1255 1303 public Raster createChild(int parentX, int parentY, 1304 int width, int height, 1305 int childMinX, int childMinY, 1306 int bandList[]) { 1307 if (parentX < this.minX) { 1308 throw new RasterFormatException ("parentX lies outside raster"); 1309 } 1310 if (parentY < this.minY) { 1311 throw new RasterFormatException ("parentY lies outside raster"); 1312 } 1313 if ((parentX + width < parentX) || 1314 (parentX + width > this.width + this.minX)) { 1315 throw new RasterFormatException ("(parentX + width) is outside raster"); 1316 } 1317 if ((parentY + height < parentY) || 1318 (parentY + height > this.height + this.minY)) { 1319 throw new RasterFormatException ("(parentY + height) is outside raster"); 1320 } 1321 1322 SampleModel subSampleModel; 1323 if (bandList == null) { 1329 subSampleModel = sampleModel; 1330 } else { 1331 subSampleModel = sampleModel.createSubsetSampleModel(bandList); 1332 } 1333 1334 int deltaX = childMinX - parentX; 1335 int deltaY = childMinY - parentY; 1336 1337 return new Raster (subSampleModel, getDataBuffer(), 1341 new Rectangle (childMinX, childMinY, width, height), 1342 new Point (sampleModelTranslateX + deltaX, 1343 sampleModelTranslateY + deltaY), this); 1344 } 1345 1346 1351 public Rectangle getBounds() { 1352 return new Rectangle (minX, minY, width, height); 1353 } 1354 1355 1358 final public int getMinX() { 1359 return minX; 1360 } 1361 1362 1365 final public int getMinY() { 1366 return minY; 1367 } 1368 1369 1372 final public int getWidth() { 1373 return width; 1374 } 1375 1376 1379 final public int getHeight() { 1380 return height; 1381 } 1382 1383 1386 final public int getNumBands() { 1387 return numBands; 1388 } 1389 1390 1401 final public int getNumDataElements() { 1402 return sampleModel.getNumDataElements(); 1403 } 1404 1405 1417 final public int getTransferType() { 1418 return sampleModel.getTransferType(); 1419 } 1420 1421 1424 public DataBuffer getDataBuffer() { 1425 return dataBuffer; 1426 } 1427 1428 1431 public SampleModel getSampleModel() { 1432 return sampleModel; 1433 } 1434 1435 1459 public Object getDataElements(int x, int y, Object outData) { 1460 return sampleModel.getDataElements(x - sampleModelTranslateX, 1461 y - sampleModelTranslateY, 1462 outData, dataBuffer); 1463 } 1464 1465 1492 public Object getDataElements(int x, int y, int w, int h, Object outData) { 1493 return sampleModel.getDataElements(x - sampleModelTranslateX, 1494 y - sampleModelTranslateY, 1495 w, h, outData, dataBuffer); 1496 } 1497 1498 1510 public int[] getPixel(int x, int y, int iArray[]) { 1511 return sampleModel.getPixel(x - sampleModelTranslateX, 1512 y - sampleModelTranslateY, 1513 iArray, dataBuffer); 1514 } 1515 1516 1529 public float[] getPixel(int x, int y, float fArray[]) { 1530 return sampleModel.getPixel(x - sampleModelTranslateX, 1531 y - sampleModelTranslateY, 1532 fArray, dataBuffer); 1533 } 1534 1535 1547 public double[] getPixel(int x, int y, double dArray[]) { 1548 return sampleModel.getPixel(x - sampleModelTranslateX, 1549 y - sampleModelTranslateY, 1550 dArray, dataBuffer); 1551 } 1552 1553 1568 public int[] getPixels(int x, int y, int w, int h, int iArray[]) { 1569 return sampleModel.getPixels(x - sampleModelTranslateX, 1570 y - sampleModelTranslateY, w, h, 1571 iArray, dataBuffer); 1572 } 1573 1574 1589 public float[] getPixels(int x, int y, int w, int h, 1590 float fArray[]) { 1591 return sampleModel.getPixels(x - sampleModelTranslateX, 1592 y - sampleModelTranslateY, w, h, 1593 fArray, dataBuffer); 1594 } 1595 1596 1611 public double[] getPixels(int x, int y, int w, int h, 1612 double dArray[]) { 1613 return sampleModel.getPixels(x - sampleModelTranslateX, 1614 y - sampleModelTranslateY, 1615 w, h, dArray, dataBuffer); 1616 } 1617 1618 1619 1633 public int getSample(int x, int y, int b) { 1634 return sampleModel.getSample(x - sampleModelTranslateX, 1635 y - sampleModelTranslateY, b, 1636 dataBuffer); 1637 } 1638 1639 1653 public float getSampleFloat(int x, int y, int b) { 1654 return sampleModel.getSampleFloat(x - sampleModelTranslateX, 1655 y - sampleModelTranslateY, b, 1656 dataBuffer); 1657 } 1658 1659 1673 public double getSampleDouble(int x, int y, int b) { 1674 return sampleModel.getSampleDouble(x - sampleModelTranslateX, 1675 y - sampleModelTranslateY, 1676 b, dataBuffer); 1677 } 1678 1679 1697 public int[] getSamples(int x, int y, int w, int h, int b, 1698 int iArray[]) { 1699 return sampleModel.getSamples(x - sampleModelTranslateX, 1700 y - sampleModelTranslateY, 1701 w, h, b, iArray, 1702 dataBuffer); 1703 } 1704 1705 1723 public float[] getSamples(int x, int y, int w, int h, int b, 1724 float fArray[]) { 1725 return sampleModel.getSamples(x - sampleModelTranslateX, 1726 y - sampleModelTranslateY, 1727 w, h, b, fArray, dataBuffer); 1728 } 1729 1730 1748 public double[] getSamples(int x, int y, int w, int h, int b, 1749 double dArray[]) { 1750 return sampleModel.getSamples(x - sampleModelTranslateX, 1751 y - sampleModelTranslateY, 1752 w, h, b, dArray, dataBuffer); 1753 } 1754 1755} 1756 | Popular Tags |