1069 return; 1070 } 1071 1072 // Backwards map from destination pixels 1073 // (dstX = updateMinX + k*updateXStep) 1074 // to source pixels (sourceX), and then 1075 // to offset and skip in passRow (srcX and srcXStep) 1076 int sourceX = 1077 (updateMinX - destinationOffset.x)*sourceXSubsampling + 1078 sourceRegion.x; 1079 int srcX = (sourceX - xStart)/xStep; 1080 1081 // Compute the step factor in the source 1082 int srcXStep = updateXStep*sourceXSubsampling/xStep; 1083 1084 byte[] byteData = null; 1085 short[] shortData = null; 1086 byte[] curr = new byte[bytesPerRow]; 1087 byte[] prior = new byte[bytesPerRow]; 1088 1089 // Create a 1-row tall Raster to hold the data 1090 WritableRaster passRow = createRaster(passWidth, 1, inputBands, 1091 eltsPerRow, 1092 bitDepth); 1093 1094 // Create an array suitable for holding one pixel 1095 int[] ps = passRow.getPixel(0, 0, (int[])null); 1096 1097 DataBuffer dataBuffer = passRow.getDataBuffer(); 1098 int type = dataBuffer.getDataType(); 1099 if (type == DataBuffer.TYPE_BYTE) { 1100 byteData = ((DataBufferByte)dataBuffer).getData(); 1101 } else { 1102 shortData = ((DataBufferUShort)dataBuffer).getData(); 1103 } 1104 1105 processPassStarted(theImage, 1106 passNum, 1107 sourceMinProgressivePass, 1108 sourceMaxProgressivePass, 1109 updateMinX, updateMinY, 1110 updateXStep, updateYStep, 1111 destinationBands); 1112 | 1069 return; 1070 } 1071 1072 // Backwards map from destination pixels 1073 // (dstX = updateMinX + k*updateXStep) 1074 // to source pixels (sourceX), and then 1075 // to offset and skip in passRow (srcX and srcXStep) 1076 int sourceX = 1077 (updateMinX - destinationOffset.x)*sourceXSubsampling + 1078 sourceRegion.x; 1079 int srcX = (sourceX - xStart)/xStep; 1080 1081 // Compute the step factor in the source 1082 int srcXStep = updateXStep*sourceXSubsampling/xStep; 1083 1084 byte[] byteData = null; 1085 short[] shortData = null; 1086 byte[] curr = new byte[bytesPerRow]; 1087 byte[] prior = new byte[bytesPerRow]; 1088 1089 WritableRaster passRow = null; 1090 try { 1091 // Create a 1-row tall Raster to hold the data 1092 passRow = createRaster(passWidth, 1, inputBands, eltsPerRow, 1093 bitDepth); 1094 } catch (Exception e) { 1095 /* 1096 * createRaster() can throw many types of Exception but according 1097 * to specification we must throw only IIOException if we face any 1098 * issue while reading an image. So at this high level we catch 1099 * the exception and wrap it around IIOException. 1100 */ 1101 throw new IIOException("Caught exception during read: ", e); 1102 } 1103 1104 // Create an array suitable for holding one pixel 1105 int[] ps = passRow.getPixel(0, 0, (int[])null); 1106 1107 DataBuffer dataBuffer = passRow.getDataBuffer(); 1108 int type = dataBuffer.getDataType(); 1109 if (type == DataBuffer.TYPE_BYTE) { 1110 byteData = ((DataBufferByte)dataBuffer).getData(); 1111 } else { 1112 shortData = ((DataBufferUShort)dataBuffer).getData(); 1113 } 1114 1115 processPassStarted(theImage, 1116 passNum, 1117 sourceMinProgressivePass, 1118 sourceMaxProgressivePass, 1119 updateMinX, updateMinY, 1120 updateXStep, updateYStep, 1121 destinationBands); 1122 |