public static ReadDataBlocks ( Stream stream, bool discard ) : byte[] | ||
stream | Stream | |
discard | bool | |
Résultat | byte[] |
private void Read(Stream stream, IEnumerable <GifExtension> controlExtensions, bool metadataOnly) { // Note: at this point, the label (0x01) has already been read byte[] bytes = new byte[13]; stream.ReadAll(bytes, 0, bytes.Length); BlockSize = bytes[0]; if (BlockSize != 12) { throw GifHelpers.InvalidBlockSizeException("Plain Text Extension", 12, BlockSize); } Left = BitConverter.ToUInt16(bytes, 1); Top = BitConverter.ToUInt16(bytes, 3); Width = BitConverter.ToUInt16(bytes, 5); Height = BitConverter.ToUInt16(bytes, 7); CellWidth = bytes[9]; CellHeight = bytes[10]; ForegroundColorIndex = bytes[11]; BackgroundColorIndex = bytes[12]; var dataBytes = GifHelpers.ReadDataBlocks(stream, metadataOnly); Text = Encoding.ASCII.GetString(dataBytes); Extensions = controlExtensions.ToList().AsReadOnly(); }
private void Read(Stream stream) { // Note: at this point, the label (0xFE) has already been read var bytes = GifHelpers.ReadDataBlocks(stream, false); if (bytes != null) { Text = Encoding.ASCII.GetString(bytes); } }
private void Read(Stream stream) { // Note: at this point, the label (0xFF) has already been read byte[] bytes = new byte[12]; stream.ReadAll(bytes, 0, bytes.Length); BlockSize = bytes[0]; // should always be 11 if (BlockSize != 11) { throw GifHelpers.InvalidBlockSizeException("Application Extension", 11, BlockSize); } ApplicationIdentifier = Encoding.ASCII.GetString(bytes, 1, 8); byte[] authCode = new byte[3]; Array.Copy(bytes, 9, authCode, 0, 3); AuthenticationCode = authCode; Data = GifHelpers.ReadDataBlocks(stream, false); }
private void Read(Stream stream, bool metadataOnly) { LzwMinimumCodeSize = (byte)stream.ReadByte(); CompressedData = GifHelpers.ReadDataBlocks(stream, metadataOnly); }