3.2 DitheringRegistry
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -100,7 +100,7 @@ Each type lives in `src/FrameProcessor/Domain/`. Tests in `tests/FrameProcessor.
|
||||
- `static ReadOnlyMemory<Color> BuildDisplay(IReadOnlyList<PaletteEntry>)` and `BuildDevice(...)`.
|
||||
- **Tests:** `PaletteFactoryTests` — count, ordering preserved.
|
||||
|
||||
### [ ] 3.2 `DitheringRegistry`
|
||||
### [x] 3.2 `DitheringRegistry`
|
||||
- `IReadOnlyDictionary<DitherAlgorithm, IDither>` mapping each enum to the corresponding ImageSharp `KnownDitherings.*`.
|
||||
|
||||
### [ ] 3.3 `IImagePipeline` + `ImagePipeline`
|
||||
|
||||
21
src/FrameProcessor/ImagePipeline/DitheringRegistry.cs
Normal file
21
src/FrameProcessor/ImagePipeline/DitheringRegistry.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using FrameProcessor.Domain;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using SixLabors.ImageSharp.Processing.Processors.Dithering;
|
||||
|
||||
namespace FrameProcessor.ImagePipeline;
|
||||
|
||||
/// <summary>
|
||||
/// Maps each <see cref="DitherAlgorithm"/> to the corresponding ImageSharp <see cref="IDither"/>
|
||||
/// instance from <see cref="KnownDitherings"/>.
|
||||
/// </summary>
|
||||
public static class DitheringRegistry
|
||||
{
|
||||
public static IReadOnlyDictionary<DitherAlgorithm, IDither> All { get; } =
|
||||
new Dictionary<DitherAlgorithm, IDither>
|
||||
{
|
||||
[DitherAlgorithm.FloydSteinberg] = KnownDitherings.FloydSteinberg,
|
||||
[DitherAlgorithm.Atkinson] = KnownDitherings.Atkinson,
|
||||
[DitherAlgorithm.Stucki] = KnownDitherings.Stucki,
|
||||
[DitherAlgorithm.Jarvis] = KnownDitherings.JarvisJudiceNinke,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user