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; }
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); }
public static GifColor[] ReadColorTable(Stream stream, int size) { int count = 3 * size; byte[] buffer = new byte[count]; stream.ReadAll(buffer, 0, count); GifColor[] colorArray = new GifColor[size]; for (int i = 0; i < size; i++) { byte r = buffer[3 * i]; byte g = buffer[(3 * i) + 1]; byte b = buffer[(3 * i) + 2]; colorArray[i] = new GifColor(r, g, b); } return(colorArray); }