//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageProcessorCore
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using ImageProcessorCore.Formats;
///
/// Provides initialization code which allows extending the library.
///
public class Bootstrapper
{
///
/// A new instance Initializes a new instance of the class.
/// with lazy initialization.
///
private static readonly Lazy Lazy = new Lazy(() => new Bootstrapper());
///
/// The default list of supported
///
private readonly List imageFormats;
///
/// Prevents a default instance of the class from being created.
///
private Bootstrapper()
{
this.imageFormats = new List(new List
{
new BmpFormat(),
new JpegFormat(),
new PngFormat(),
new GifFormat()
});
}
///
/// Gets the current bootstrapper instance.
///
public static Bootstrapper Instance = Lazy.Value;
///
/// Gets the list of supported
///
public IReadOnlyCollection ImageFormats => new ReadOnlyCollection(this.imageFormats);
///
/// Adds a new to the collection of supported image formats.
///
/// The new format to add.
public void AddImageFormat(IImageFormat format)
{
this.imageFormats.Add(format);
}
}
}