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

Method readImage

ij/src/main/java/ij/plugin/GIF_Reader.java:533–584  ·  view source on GitHub ↗

Reads next frame image

()

Source from the content-addressed store, hash-verified

531 */
532
533 private void readImage() {
534 ix = readShort(); // (sub)image position & size
535 iy = readShort();
536 iw = readShort();
537 ih = readShort();
538
539 int packed = read();
540 lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
541 interlace = (packed & 0x40) != 0; // 2 - interlace flag
542 // 3 - sort flag
543 // 4-5 - reserved
544 lctSize = 2 << (packed & 7); // 6-8 - local color table size
545
546 if (lctFlag) {
547 lct = readColorTable(lctSize); // read table
548 act = lct; // make local table active
549 } else {
550 act = gct; // make global table active
551 if (bgIndex == transIndex)
552 bgColor = 0;
553 }
554 int save = 0;
555 if (transparency) {
556 save = act[transIndex];
557 act[transIndex] = 0; // set transparent color if specified
558 }
559
560 if (act == null) {
561 status = STATUS_FORMAT_ERROR; // no color table defined
562 }
563
564 if (err()) return;
565
566 decodeImageData(); // decode pixel data
567 skip();
568
569 if (err()) return;
570
571 frameCount++;
572
573 // create new image to receive frame data
574 image = new ColorProcessor(width, height);
575
576 setPixels(); // transfer pixel data to image
577
578 frames.addElement(new GifFrame(image, delay)); // add image to frame list
579
580 if (transparency)
581 act[transIndex] = save;
582 resetFrame();
583
584 }
585
586
587 /**

Callers 1

readContentsMethod · 0.95

Calls 9

readShortMethod · 0.95
readMethod · 0.95
readColorTableMethod · 0.95
errMethod · 0.95
decodeImageDataMethod · 0.95
skipMethod · 0.95
setPixelsMethod · 0.95
resetFrameMethod · 0.95
addElementMethod · 0.45

Tested by

no test coverage detected