diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index b6b3a56..9c25633 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -100,7 +100,7 @@ Each type lives in `src/FrameProcessor/Domain/`. Tests in `tests/FrameProcessor. - `static ReadOnlyMemory BuildDisplay(IReadOnlyList)` and `BuildDevice(...)`. - **Tests:** `PaletteFactoryTests` — count, ordering preserved. -### [ ] 3.2 `DitheringRegistry` +### [x] 3.2 `DitheringRegistry` - `IReadOnlyDictionary` mapping each enum to the corresponding ImageSharp `KnownDitherings.*`. ### [ ] 3.3 `IImagePipeline` + `ImagePipeline` diff --git a/src/FrameProcessor/ImagePipeline/DitheringRegistry.cs b/src/FrameProcessor/ImagePipeline/DitheringRegistry.cs new file mode 100644 index 0000000..879ff6a --- /dev/null +++ b/src/FrameProcessor/ImagePipeline/DitheringRegistry.cs @@ -0,0 +1,21 @@ +using FrameProcessor.Domain; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Dithering; + +namespace FrameProcessor.ImagePipeline; + +/// +/// Maps each to the corresponding ImageSharp +/// instance from . +/// +public static class DitheringRegistry +{ + public static IReadOnlyDictionary All { get; } = + new Dictionary + { + [DitherAlgorithm.FloydSteinberg] = KnownDitherings.FloydSteinberg, + [DitherAlgorithm.Atkinson] = KnownDitherings.Atkinson, + [DitherAlgorithm.Stucki] = KnownDitherings.Stucki, + [DitherAlgorithm.Jarvis] = KnownDitherings.JarvisJudiceNinke, + }; +}