diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs
index 4c9ba6a41..226d45132 100644
--- a/src/ImageSharp/Configuration.cs
+++ b/src/ImageSharp/Configuration.cs
@@ -8,7 +8,6 @@ namespace ImageSharp
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
- using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
@@ -18,17 +17,12 @@ namespace ImageSharp
///
/// Provides initialization code which allows extending the library.
///
- public sealed partial class Configuration
+ public sealed class Configuration
{
///
/// A lazily initialized configuration default instance.
///
- private static readonly Lazy Lazy = new Lazy(() => CreateDefaultInstance());
-
- ///
- /// An object that can be used to synchronize access to the .
- ///
- private readonly object syncRoot = new object();
+ private static readonly Lazy Lazy = new Lazy(CreateDefaultInstance);
///
/// The list of supported keyed to mime types.
diff --git a/src/ImageSharp/Formats/Bmp/BmpConfigurationModule.cs b/src/ImageSharp/Formats/Bmp/BmpConfigurationModule.cs
index 2553f1454..4534f2636 100644
--- a/src/ImageSharp/Formats/Bmp/BmpConfigurationModule.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpConfigurationModule.cs
@@ -1,16 +1,10 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Formats
{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
-
///
/// Registers the image encoders, decoders and mime type detectors for the bmp format.
///
@@ -24,4 +18,4 @@ namespace ImageSharp.Formats
config.AddImageFormatDetector(new BmpImageFormatDetector());
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Bmp/BmpFormat.cs b/src/ImageSharp/Formats/Bmp/BmpFormat.cs
index 4f32e2875..fb65f34d7 100644
--- a/src/ImageSharp/Formats/Bmp/BmpFormat.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpFormat.cs
@@ -5,11 +5,7 @@
namespace ImageSharp.Formats
{
- using System;
using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
///
/// Registers the image encoders, decoders and mime type detectors for the jpeg format.
@@ -28,4 +24,4 @@ namespace ImageSharp.Formats
///
public IEnumerable FileExtensions => BmpConstants.FileExtensions;
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs b/src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs
index 4f1054b09..96ab92f25 100644
--- a/src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -6,10 +6,6 @@
namespace ImageSharp.Formats
{
using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
///
/// Detects bmp file headers
@@ -32,9 +28,10 @@ namespace ImageSharp.Formats
private bool IsSupportedFileFormat(ReadOnlySpan header)
{
+ // TODO: This should be in constants
return header.Length >= this.HeaderSize &&
header[0] == 0x42 && // B
header[1] == 0x4D; // M
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Gif/GifConfigurationModule.cs b/src/ImageSharp/Formats/Gif/GifConfigurationModule.cs
index 0640cb234..4e810ffad 100644
--- a/src/ImageSharp/Formats/Gif/GifConfigurationModule.cs
+++ b/src/ImageSharp/Formats/Gif/GifConfigurationModule.cs
@@ -1,16 +1,10 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Formats
{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
-
///
/// Registers the image encoders, decoders and mime type detectors for the gif format.
///
@@ -25,4 +19,4 @@ namespace ImageSharp.Formats
config.AddImageFormatDetector(new GifImageFormatDetector());
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Gif/GifConstants.cs b/src/ImageSharp/Formats/Gif/GifConstants.cs
index 7b215b773..9bec6c48f 100644
--- a/src/ImageSharp/Formats/Gif/GifConstants.cs
+++ b/src/ImageSharp/Formats/Gif/GifConstants.cs
@@ -103,4 +103,4 @@ namespace ImageSharp.Formats
///
public static readonly IEnumerable FileExtensions = new[] { "gif" };
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Gif/GifFormat.cs b/src/ImageSharp/Formats/Gif/GifFormat.cs
index 5aa667ea9..ea7b72d32 100644
--- a/src/ImageSharp/Formats/Gif/GifFormat.cs
+++ b/src/ImageSharp/Formats/Gif/GifFormat.cs
@@ -5,11 +5,7 @@
namespace ImageSharp.Formats
{
- using System;
using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
///
/// Registers the image encoders, decoders and mime type detectors for the jpeg format.
@@ -28,4 +24,4 @@ namespace ImageSharp.Formats
///
public IEnumerable FileExtensions => GifConstants.FileExtensions;
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Gif/GifImageFormatDetector.cs b/src/ImageSharp/Formats/Gif/GifImageFormatDetector.cs
index 2aee86795..5a6dfe198 100644
--- a/src/ImageSharp/Formats/Gif/GifImageFormatDetector.cs
+++ b/src/ImageSharp/Formats/Gif/GifImageFormatDetector.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -6,10 +6,6 @@
namespace ImageSharp.Formats
{
using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
///
/// Detects gif file headers
@@ -32,6 +28,7 @@ namespace ImageSharp.Formats
private bool IsSupportedFileFormat(ReadOnlySpan header)
{
+ // TODO: This should be in constants
return header.Length >= this.HeaderSize &&
header[0] == 0x47 && // G
header[1] == 0x49 && // I
@@ -41,4 +38,4 @@ namespace ImageSharp.Formats
header[5] == 0x61; // a
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/IImageFormat.cs b/src/ImageSharp/Formats/IImageFormat.cs
index 8643e2f4c..d6ddc0b0b 100644
--- a/src/ImageSharp/Formats/IImageFormat.cs
+++ b/src/ImageSharp/Formats/IImageFormat.cs
@@ -5,11 +5,7 @@
namespace ImageSharp.Formats
{
- using System;
using System.Collections.Generic;
- using System.IO;
-
- using ImageSharp.PixelFormats;
///
/// Describes an image format.
@@ -36,4 +32,4 @@ namespace ImageSharp.Formats
///
IEnumerable FileExtensions { get; }
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Jpeg/JpegConfigurationModule.cs b/src/ImageSharp/Formats/Jpeg/JpegConfigurationModule.cs
index 64c7af357..8fe4a35a0 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegConfigurationModule.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegConfigurationModule.cs
@@ -1,16 +1,10 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Formats
{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
-
///
/// Registers the image encoders, decoders and mime type detectors for the jpeg format.
///
diff --git a/src/ImageSharp/Formats/Jpeg/JpegFormat.cs b/src/ImageSharp/Formats/Jpeg/JpegFormat.cs
index 86b624fc8..23cd5d875 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegFormat.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegFormat.cs
@@ -5,11 +5,7 @@
namespace ImageSharp.Formats
{
- using System;
using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
///
/// Registers the image encoders, decoders and mime type detectors for the jpeg format.
@@ -28,4 +24,4 @@ namespace ImageSharp.Formats
///
public IEnumerable FileExtensions => JpegConstants.FileExtensions;
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Jpeg/JpegImageFormatDetector.cs b/src/ImageSharp/Formats/Jpeg/JpegImageFormatDetector.cs
index 82f810625..8d6923c8d 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegImageFormatDetector.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegImageFormatDetector.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -6,10 +6,6 @@
namespace ImageSharp.Formats
{
using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
///
/// Detects Jpeg file headers
@@ -43,6 +39,7 @@ namespace ImageSharp.Formats
/// The
private bool IsJfif(ReadOnlySpan header)
{
+ // TODO: This should be in constants
bool isJfif =
header[6] == 0x4A && // J
header[7] == 0x46 && // F
@@ -60,6 +57,7 @@ namespace ImageSharp.Formats
/// The
private bool IsExif(ReadOnlySpan header)
{
+ // TODO: This should be in constants
bool isExif =
header[6] == 0x45 && // E
header[7] == 0x78 && // X
@@ -78,6 +76,7 @@ namespace ImageSharp.Formats
/// The
private bool IsJpeg(ReadOnlySpan header)
{
+ // TODO: This should be in constants
bool isJpg =
header[0] == 0xFF && // 255
header[1] == 0xD8; // 216
@@ -85,4 +84,4 @@ namespace ImageSharp.Formats
return isJpg;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Png/PngConfigurationModule.cs b/src/ImageSharp/Formats/Png/PngConfigurationModule.cs
index 47fe8b136..a3813c500 100644
--- a/src/ImageSharp/Formats/Png/PngConfigurationModule.cs
+++ b/src/ImageSharp/Formats/Png/PngConfigurationModule.cs
@@ -5,12 +5,6 @@
namespace ImageSharp.Formats
{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
-
///
/// Registers the image encoders, decoders and mime type detectors for the png format.
///
@@ -24,4 +18,4 @@ namespace ImageSharp.Formats
host.AddImageFormatDetector(new PngImageFormatDetector());
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Png/PngConstants.cs b/src/ImageSharp/Formats/Png/PngConstants.cs
index 8c10ad960..84e76a341 100644
--- a/src/ImageSharp/Formats/Png/PngConstants.cs
+++ b/src/ImageSharp/Formats/Png/PngConstants.cs
@@ -2,6 +2,7 @@
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
+
namespace ImageSharp.Formats
{
using System.Collections.Generic;
@@ -27,4 +28,4 @@ namespace ImageSharp.Formats
///
public static readonly IEnumerable FileExtensions = new[] { "png" };
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Png/PngFormat.cs b/src/ImageSharp/Formats/Png/PngFormat.cs
index 60ba30605..551b4a8c7 100644
--- a/src/ImageSharp/Formats/Png/PngFormat.cs
+++ b/src/ImageSharp/Formats/Png/PngFormat.cs
@@ -5,11 +5,7 @@
namespace ImageSharp.Formats
{
- using System;
using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
///
/// Registers the image encoders, decoders and mime type detectors for the jpeg format.
@@ -28,4 +24,4 @@ namespace ImageSharp.Formats
///
public IEnumerable FileExtensions => PngConstants.FileExtensions;
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Png/PngImageFormatDetector.cs b/src/ImageSharp/Formats/Png/PngImageFormatDetector.cs
index 6183ef449..a9327983b 100644
--- a/src/ImageSharp/Formats/Png/PngImageFormatDetector.cs
+++ b/src/ImageSharp/Formats/Png/PngImageFormatDetector.cs
@@ -6,10 +6,6 @@
namespace ImageSharp.Formats
{
using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using ImageSharp.PixelFormats;
///
/// Detects png file headers
@@ -32,6 +28,7 @@ namespace ImageSharp.Formats
private bool IsSupportedFileFormat(ReadOnlySpan header)
{
+ // TODO: This should be in constants
return header.Length >= this.HeaderSize &&
header[0] == 0x89 &&
header[1] == 0x50 && // P
@@ -43,4 +40,4 @@ namespace ImageSharp.Formats
header[7] == 0x0A; // LF
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/IConfigurationModule.cs b/src/ImageSharp/IConfigurationModule.cs
index d37e0042b..95b92ed05 100644
--- a/src/ImageSharp/IConfigurationModule.cs
+++ b/src/ImageSharp/IConfigurationModule.cs
@@ -5,10 +5,6 @@
namespace ImageSharp
{
- using System;
- using System.Collections.Generic;
- using System.Text;
-
///
/// Represents an interface that can register image encoders, decoders and image format detectors.
///
diff --git a/src/ImageSharp/Image/Image.Decode.cs b/src/ImageSharp/Image/Image.Decode.cs
index 2408ec3aa..101310706 100644
--- a/src/ImageSharp/Image/Image.Decode.cs
+++ b/src/ImageSharp/Image/Image.Decode.cs
@@ -5,7 +5,6 @@
namespace ImageSharp
{
- using System.Buffers;
using System.IO;
using System.Linq;
using Formats;
diff --git a/src/ImageSharp/Image/Image.FromStream.cs b/src/ImageSharp/Image/Image.FromStream.cs
index 7493d66fc..29d93ae85 100644
--- a/src/ImageSharp/Image/Image.FromStream.cs
+++ b/src/ImageSharp/Image/Image.FromStream.cs
@@ -8,7 +8,6 @@ namespace ImageSharp
using System;
using System.Collections.Generic;
using System.IO;
- using System.Linq;
using System.Text;
using Formats;
@@ -190,7 +189,6 @@ namespace ImageSharp
where TPixel : struct, IPixel
{
config = config ?? Configuration.Default;
- format = null;
(Image img, IImageFormat format) data = WithSeekableStream(stream, s => Decode(s, config));
format = data.format;
diff --git a/src/ImageSharp/Image/Image{TPixel}.cs b/src/ImageSharp/Image/Image{TPixel}.cs
index 9af788327..5e8bcab31 100644
--- a/src/ImageSharp/Image/Image{TPixel}.cs
+++ b/src/ImageSharp/Image/Image{TPixel}.cs
@@ -9,7 +9,6 @@ namespace ImageSharp
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
- using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/ImageSharp/ImageFormats.cs b/src/ImageSharp/ImageFormats.cs
index fb67fb714..f79191eae 100644
--- a/src/ImageSharp/ImageFormats.cs
+++ b/src/ImageSharp/ImageFormats.cs
@@ -5,11 +5,7 @@
namespace ImageSharp
{
- using System;
- using System.Collections.Generic;
- using System.IO;
using ImageSharp.Formats;
- using ImageSharp.PixelFormats;
///
/// The static collection of all the default image formats
@@ -36,4 +32,4 @@ namespace ImageSharp
///
public static readonly IImageFormat Bitmap = new BmpFormat();
}
-}
+}
\ No newline at end of file