aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifBlock.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifBlock.cs')
-rw-r--r--Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifBlock.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifBlock.cs b/Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifBlock.cs
new file mode 100644
index 000000000..331e7bd8f
--- /dev/null
+++ b/Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifBlock.cs
@@ -0,0 +1,28 @@
+using System.Collections.Generic;
+using System.IO;
+
+namespace Tango.AnimatedGif.Decoding
+{
+ internal abstract class GifBlock
+ {
+ internal static GifBlock ReadBlock(Stream stream, IEnumerable<GifExtension> controlExtensions, bool metadataOnly)
+ {
+ int blockId = stream.ReadByte();
+ if (blockId < 0)
+ throw GifHelpers.UnexpectedEndOfStreamException();
+ switch (blockId)
+ {
+ case GifExtension.ExtensionIntroducer:
+ return GifExtension.ReadExtension(stream, controlExtensions, metadataOnly);
+ case GifFrame.ImageSeparator:
+ return GifFrame.ReadFrame(stream, controlExtensions, metadataOnly);
+ case GifTrailer.TrailerByte:
+ return GifTrailer.ReadTrailer();
+ default:
+ throw GifHelpers.UnknownBlockTypeException(blockId);
+ }
+ }
+
+ internal abstract GifBlockKind Kind { get; }
+ }
+}