diff --git a/src/ImageProcessorCore/Bootstrapper.cs b/src/ImageProcessorCore/Bootstrapper.cs
index 1479de0e9..932bcf434 100644
--- a/src/ImageProcessorCore/Bootstrapper.cs
+++ b/src/ImageProcessorCore/Bootstrapper.cs
@@ -8,7 +8,7 @@ namespace ImageProcessorCore
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
-
+ using System.Reflection;
using System.Threading.Tasks;
using Formats;
@@ -56,9 +56,16 @@ namespace ImageProcessorCore
public static Bootstrapper Instance = Lazy.Value;
///
- /// Gets the list of supported
+ /// Gets the collection of supported
+ ///
+ public IReadOnlyCollection ImageFormats =>
+ new ReadOnlyCollection(this.imageFormats);
+
+ ///
+ /// Gets the collection of supported pixel accessors
///
- public IReadOnlyCollection ImageFormats => new ReadOnlyCollection(this.imageFormats);
+ public IReadOnlyDictionary> PixelAccessors =>
+ new ReadOnlyDictionary>(this.pixelAccessors);
///
/// Gets or sets the global parallel options for processing tasks in parallel.
@@ -74,6 +81,21 @@ namespace ImageProcessorCore
this.imageFormats.Add(format);
}
+ ///
+ /// Adds a pixel accessor for the given pixel format.
+ ///
+ /// The packed format type, must implement
+ /// The function to return a new instance of the pixel accessor.
+ public void AddPixelAccessor(Type packedType, Func initializer)
+ {
+ if (!typeof(IPackedVector).GetTypeInfo().IsAssignableFrom(packedType.GetTypeInfo()))
+ {
+ throw new ArgumentException($"Type {packedType} must implement {nameof(IPackedVector)}");
+ }
+
+ this.pixelAccessors.Add(packedType, initializer);
+ }
+
///
/// Gets an instance of the correct for the packed vector.
///
diff --git a/src/ImageProcessorCore/project.json b/src/ImageProcessorCore/project.json
index e3800d495..85d2f9723 100644
--- a/src/ImageProcessorCore/project.json
+++ b/src/ImageProcessorCore/project.json
@@ -24,6 +24,7 @@
"System.IO.Compression": "4.1.0",
"System.Linq": "4.1.0",
"System.Numerics.Vectors": "4.1.1",
+ "System.ObjectModel": "4.0.12",
"System.Resources.ResourceManager": "4.0.1",
"System.Runtime.Extensions": "4.1.0",
"System.Runtime.InteropServices": "4.1.0",