|
|
@ -21,7 +21,7 @@ namespace ImageSharp |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// A lazily initialized configuration default instance.
|
|
|
/// A lazily initialized configuration default instance.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
private static readonly Lazy<Configuration> Lazy = new Lazy<Configuration>(() => new Configuration(true)); |
|
|
private static readonly Lazy<Configuration> Lazy = new Lazy<Configuration>(() => CreateDefaultInstance()); |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// An object that can be used to synchronize access to the <see cref="Configuration"/>.
|
|
|
/// An object that can be used to synchronize access to the <see cref="Configuration"/>.
|
|
|
@ -33,30 +33,6 @@ namespace ImageSharp |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
private readonly List<IImageFormat> imageFormatsList = new List<IImageFormat>(); |
|
|
private readonly List<IImageFormat> imageFormatsList = new List<IImageFormat>(); |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Initializes a new instance of the <see cref="Configuration"/> class.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Configuration() |
|
|
|
|
|
: this(false) |
|
|
|
|
|
{ |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Initializes a new instance of the <see cref="Configuration" /> class.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="autoloadWellknownFormats">if set to <c>true</c> [autoload wellknown formats].</param>
|
|
|
|
|
|
internal Configuration(bool autoloadWellknownFormats) |
|
|
|
|
|
{ |
|
|
|
|
|
if (autoloadWellknownFormats) |
|
|
|
|
|
{ |
|
|
|
|
|
// lets try auto loading the known image formats
|
|
|
|
|
|
this.TryAddImageFormat("ImageSharp.Formats.PngFormat, ImageSharp.Formats.Png"); |
|
|
|
|
|
this.TryAddImageFormat("ImageSharp.Formats.JpegFormat, ImageSharp.Formats.Jpeg"); |
|
|
|
|
|
this.TryAddImageFormat("ImageSharp.Formats.GifFormat, ImageSharp.Formats.Gif"); |
|
|
|
|
|
this.TryAddImageFormat("ImageSharp.Formats.BmpFormat, ImageSharp.Formats.Bmp"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Gets the default <see cref="Configuration"/> instance.
|
|
|
/// Gets the default <see cref="Configuration"/> instance.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
@ -93,6 +69,22 @@ namespace ImageSharp |
|
|
this.AddImageFormatLocked(format); |
|
|
this.AddImageFormatLocked(format); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Creates the default instance, with Png, Jpeg, Gif and Bmp preregisterd (if they have been referenced)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>The default configuration of <see cref="Configuration"/> </returns>
|
|
|
|
|
|
internal static Configuration CreateDefaultInstance() |
|
|
|
|
|
{ |
|
|
|
|
|
Configuration config = new Configuration(); |
|
|
|
|
|
|
|
|
|
|
|
// lets try auto loading the known image formats
|
|
|
|
|
|
config.TryAddImageFormat("ImageSharp.Formats.PngFormat, ImageSharp.Formats.Png"); |
|
|
|
|
|
config.TryAddImageFormat("ImageSharp.Formats.JpegFormat, ImageSharp.Formats.Jpeg"); |
|
|
|
|
|
config.TryAddImageFormat("ImageSharp.Formats.GifFormat, ImageSharp.Formats.Gif"); |
|
|
|
|
|
config.TryAddImageFormat("ImageSharp.Formats.BmpFormat, ImageSharp.Formats.Bmp"); |
|
|
|
|
|
return config; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Tries the add image format.
|
|
|
/// Tries the add image format.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
|