MSIT.NGif.GifEncoder.AddFrame C# (CSharp) Метод

AddFrame() публичный Метод

public AddFrame ( Image im ) : bool
im Image
Результат bool
        public bool AddFrame(Image im)
        {
            if ((im == null) || !_started)
                return false;
            bool ok = true;
            try {
                if (!_sizeSet)
                    // use first frame's size
                    SetSize(im.Width, im.Height);
                _image = im;
                GetImagePixels(); // convert to correct format if necessary
                AnalyzePixels(); // build color table & map pixels
                if (_firstFrame) {
                    WriteLSD(); // logical screen descriptior
                    WritePalette(); // global color table
                    if (_repeat >= 0)
                        // use NS app extension to indicate reps
                        WriteNetscapeExt();
                }
                WriteGraphicCtrlExt(); // write graphic control extension
                WriteImageDesc(); // image descriptor
                if (!_firstFrame)
                    WritePalette(); // local color table
                WritePixels(); // encode and write pixel data
                _firstFrame = false;
            } catch (IOException) {
                ok = false;
            }

            return ok;
        }

Usage Example

Пример #1
0
 public static void OutputGIF(Bitmap f, String fn)
 {
     GifEncoder gif = new GifEncoder();
     gif.SetQuality(4);
     gif.Start(fn);
     gif.AddFrame(f);
     gif.Finish();
 }
All Usage Examples Of MSIT.NGif.GifEncoder::AddFrame