Example #1
0
            public Player(FlicFile flic, byte[] pixelData)
            {
                if (pixelData.Length != flic.Width * flic.Height)
                {
                    throw new ArgumentOutOfRangeException(
                              "FlicFile.Player: Expected a pixel buffer " +
                              $"of size {flic.Width * flic.Height} ({flic.Width}x{flic.Height})," +
                              $" but was given a buffer of size {pixelData.Length}");
                }

                PixelData = pixelData;
                _flic     = flic;
                _frames   = flic.Chunks.OfType <FlicFrame>().ToArray();
                ApplyFrame(_frames[0]);
            }
Example #2
0
        public FlicPlayer(FlicFile flic, FlicFile.GetPixelDataFunc getPixelData)
        {
            if (flic == null)
            {
                throw new ArgumentNullException(nameof(flic));
            }
            _getPixelData = getPixelData ?? throw new ArgumentNullException(nameof(getPixelData));

            var pixelData = _getPixelData();

            if (pixelData.Length != flic.Width * flic.Height)
            {
                throw new ArgumentOutOfRangeException(
                          "FlicFile.Player: Expected a pixel buffer " +
                          $"of size {flic.Width * flic.Height} ({flic.Width}x{flic.Height})," +
                          $" but was given a buffer of size {pixelData.Length}");
            }

            _flic   = flic;
            _frames = flic.Chunks.OfType <FlicFrame>().ToArray();
            ApplyFrame(_frames[0]);
        }