public static async Task<GifColor[]> ReadColorTableAsync(Stream stream, int size)
 {
     int length = 3 * size;
     byte[] bytes = new byte[length];
     await stream.ReadAllAsync(bytes, 0, length).ConfigureAwait(false);
     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;
 }
        public static async Task <GifColor[]> ReadColorTableAsync(Stream stream, int size)
        {
            int length = 3 * size;

            byte[] bytes = new byte[length];
            await stream.ReadAllAsync(bytes, 0, length).ConfigureAwait(false);

            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);
        }
Exemple #3
0
        public static async Task <GifColor[]> ReadColorTableAsync(Stream stream, int size)
        {
            int count = 3 * size;

            byte[] bytes = new byte[count];
            await stream.ReadAllAsync(bytes, 0, count).ConfigureAwait(false);

            GifColor[] gifColorArray = new GifColor[size];
            for (int index = 0; index < size; ++index)
            {
                byte r = bytes[3 * index];
                byte g = bytes[3 * index + 1];
                byte b = bytes[3 * index + 2];
                gifColorArray[index] = new GifColor(r, g, b);
            }
            return(gifColorArray);
        }