Example #1
0
        public static GifColor[] ReadColorTable(Stream stream, int size)
        {
            int length = 3 * size;

            byte[] bytes = new byte[length];
            stream.ReadAll(bytes, 0, length);
            GifColor[] colorTable = new GifColor[size];
            for (int i = 0; i < size; i++)
            {
                byte r = bytes[3 * i];
                byte g = bytes[3 * i + 1];
                byte b = bytes[3 * i + 2];
                colorTable[i] = new GifColor(r, g, b);
            }
            return(colorTable);
        }
Example #2
0
        public static GifColor[] ReadColorTable(Stream stream, int size)
        {
            var length = 3 * size;
            var bytes  = new byte[length];

            stream.ReadAll(bytes, 0, length);
            var colorTable = new GifColor[size];

            for (var i = 0; i < size; i++)
            {
                var r = bytes[3 * i];
                var g = bytes[3 * i + 1];
                var b = bytes[3 * i + 2];
                colorTable[i] = new GifColor(r, g, b);
            }

            return(colorTable);
        }