MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getPixelData

Method getPixelData

ij/src/main/java/ij/plugin/BMP_Reader.java:274–304  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

272 }
273
274 void getPixelData() throws IOException, Exception {
275 byte[] rawData; // the raw unpacked data
276
277 // Skip to the start of the bitmap data (if we are not already there)
278 long skip = bitmapOffset - curPos;
279 if (skip > 0) {
280 is.skip(skip);
281 curPos += skip;
282 }
283
284 int len = scanLineSize;
285 if (bitsPerPixel > 8)
286 intData = new int[width * height];
287 else
288 byteData = new byte[width * height];
289 rawData = new byte[actualSizeOfBitmap];
290 int rawOffset = 0;
291 int offset = (height - 1) * width;
292 for (int i = height - 1; i >= 0; i--) {
293 int n = is.read(rawData, rawOffset, len);
294 if (n < len) throw new Exception("Scan line ended prematurely after " + n + " bytes");
295 if (bitsPerPixel==24)
296 unpack24(rawData, rawOffset, intData, offset, width);
297 else if (bitsPerPixel==32)
298 unpack32( rawData, rawOffset, intData, offset, width);
299 else // 8-bits or less
300 unpack(rawData, rawOffset, bitsPerPixel, byteData, offset, width);
301 rawOffset += len;
302 offset -= width;
303 }
304 }
305
306
307 public void read(InputStream is) throws IOException, Exception {

Callers 1

readMethod · 0.95

Calls 5

unpack24Method · 0.95
unpack32Method · 0.95
unpackMethod · 0.95
skipMethod · 0.65
readMethod · 0.65

Tested by

no test coverage detected