/** * Reads next frame image */ protected void ReadImage() { ix = ReadShort(); // (sub)image position & size iy = ReadShort(); iw = ReadShort(); ih = ReadShort(); int packed = Read(); lctFlag = (packed & 0x80) != 0; // 1 - local color table flag interlace = (packed & 0x40) != 0; // 2 - interlace flag // 3 - sort flag // 4-5 - reserved lctSize = 2 << (packed & 7); // 6-8 - local color table size if (lctFlag) { _lct = ReadColorTable(lctSize); // read table act = _lct; // make local table active } else { act = _gct; // make global table active if (bgIndex == transIndex) bgColor = 0; } int save = 0; if (transparency) { save = act[transIndex]; act[transIndex] = 0; // set transparent color if specified } if (act == null) { status = STATUS_FORMAT_ERROR; // no color table defined } if (Error()) return; DecodeImageData(); // decode pixel data Skip(); if (Error()) return; _frameCount++; // create new image to receive frame data // image = // new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE); _bitmap = new Bitmap( width, height ); image = _bitmap; SetPixels(); // transfer pixel data to image GifFrame frame = new GifFrame(_bitmap, delay) ; _frames.Add( frame ); // add image to frame list if( FrameAdded != null ) FrameAdded( this, new GifDecoderEventArgs( frame, _frames.Count, -1 ) ) ; if (transparency) { act[transIndex] = save; } ResetFrame(); }
public GifDecoderEventArgs(GifFrame frame, int frameNumber, int frameCount ) { _frame = frame; _frameNumber = frameNumber ; _frameCount = frameCount ; }