Exemple #1
0
        private TimingManager CreateTimingManager(GifDataStream metadata, RepeatBehavior repeatBehavior)
        {
            TimingManager timingManager = new TimingManager(repeatBehavior == new RepeatBehavior() ? Animator.GetRepeatBehavior(metadata) : repeatBehavior);

            foreach (GifFrame frame in (IEnumerable <GifFrame>)metadata.Frames)
            {
                timingManager.Add(Animator.GetFrameDelay(frame));
            }
            timingManager.Completed += new EventHandler(this.TimingManagerCompleted);
            return(timingManager);
        }
 internal Animator(Stream sourceStream, Uri sourceUri, GifDataStream metadata, RepeatBehavior repeatBehavior)
 {
     _sourceStream = sourceStream;
     _sourceUri = sourceUri;
     _metadata = metadata;
     _palettes = CreatePalettes(metadata);
     _bitmap = CreateBitmap(metadata);
     var desc = metadata.Header.LogicalScreenDescriptor;
     _stride = 4 * ((desc.Width * 32 + 31) / 32);
     _previousBackBuffer = new byte[desc.Height * _stride];
     _indexStreamBuffer = CreateIndexStreamBuffer(metadata, _sourceStream);
     _timingManager = CreateTimingManager(metadata, repeatBehavior);
 }
        private TimingManager CreateTimingManager(GifDataStream metadata, RepeatBehavior repeatBehavior)
        {
            var actualRepeatBehavior = GetActualRepeatBehavior(metadata, repeatBehavior);

            var manager = new TimingManager(actualRepeatBehavior);

            foreach (var frame in metadata.Frames)
            {
                manager.Add(GetFrameDelay(frame));
            }

            manager.Completed += TimingManagerCompleted;
            return(manager);
        }
 private Animator(Stream sourceStream, Uri sourceUri, GifDataStream metadata, RepeatBehavior repeatBehavior, Image image)
 {
     _sourceStream = sourceStream;
     _sourceUri = sourceUri;
     _metadata = metadata;
     _image = image;
     _palettes = CreatePalettes(metadata);
     _bitmap = CreateBitmap(metadata);
     var desc = metadata.Header.LogicalScreenDescriptor;
     _stride = 4 * ((desc.Width * 32 + 31) / 32);
     _previousBackBuffer = new byte[desc.Height * _stride];
     _indexStreamBuffer = CreateIndexStreamBuffer(metadata, _sourceStream);
     _timingManager = CreateTimingManager(metadata, repeatBehavior);
 }
Exemple #5
0
        private Animator(Stream sourceStream, Uri sourceUri, GifDataStream metadata, RepeatBehavior repeatBehavior, Image image)
        {
            //this.\u002Ector();
            this._sourceStream = sourceStream;
            this._sourceUri    = sourceUri;
            this._metadata     = metadata;
            this._image        = image;
            this._palettes     = Animator.CreatePalettes(metadata);
            this._bitmap       = Animator.CreateBitmap(metadata);
            GifLogicalScreenDescriptor screenDescriptor = metadata.Header.LogicalScreenDescriptor;

            this._stride             = 4 * ((screenDescriptor.Width * 32 + 31) / 32);
            this._previousBackBuffer = new byte[screenDescriptor.Height * this._stride];
            this._indexStreamBuffer  = Animator.CreateIndexStreamBuffer(metadata, this._sourceStream);
            this._timingManager      = this.CreateTimingManager(metadata, repeatBehavior);
        }
        private TimingManager CreateTimingManager(GifDataStream metadata, RepeatBehavior repeatBehavior)
        {
            var actualRepeatBehavior =
                repeatBehavior == default(RepeatBehavior)
                    ? GetRepeatBehavior(metadata)
                    : repeatBehavior;

            var manager = new TimingManager(actualRepeatBehavior);
            foreach (var frame in metadata.Frames)
            {
                manager.Add(GetFrameDelay(frame));
            }

            manager.Completed += TimingManagerCompleted;
            return manager;
        }