Browse Source

Reverse breaking change.

pull/2189/head
James Jackson-South 3 years ago
parent
commit
9b29319ea9
  1. 6
      src/ImageSharp/Color/Color.cs
  2. 2
      src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs
  3. 2
      src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs

6
src/ImageSharp/Color/Color.cs

@ -287,12 +287,16 @@ namespace SixLabors.ImageSharp
/// Bulk converts a span of <see cref="Color"/> to a span of a specified <typeparamref name="TPixel"/> type.
/// </summary>
/// <typeparam name="TPixel">The pixel type to convert to.</typeparam>
/// <param name="configuration">The configuration.</param>
/// <param name="source">The source color span.</param>
/// <param name="destination">The destination pixel span.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public static void ToPixel<TPixel>(ReadOnlySpan<Color> source, Span<TPixel> destination)
#pragma warning disable RCS1163 // Unused parameter.
public static void ToPixel<TPixel>(Configuration configuration, ReadOnlySpan<Color> source, Span<TPixel> destination)
#pragma warning restore RCS1163 // Unused parameter.
where TPixel : unmanaged, IPixel<TPixel>
{
// TODO: Investigate bulk operations utilizing configuration parameter here.
Guard.DestinationShouldNotBeTooShort(source, destination, nameof(destination));
for (int i = 0; i < source.Length; i++)
{

2
src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs

@ -36,7 +36,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Dithering
ReadOnlySpan<Color> sourcePalette = definition.Palette.Span;
this.paletteOwner = this.Configuration.MemoryAllocator.Allocate<TPixel>(sourcePalette.Length);
Color.ToPixel(sourcePalette, this.paletteOwner.Memory.Span);
Color.ToPixel(this.Configuration, sourcePalette, this.paletteOwner.Memory.Span);
this.ditherProcessor = new DitherProcessor(
this.Configuration,

2
src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs

@ -56,7 +56,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
int length = Math.Min(this.colorPalette.Length, options.MaxColors);
TPixel[] palette = new TPixel[length];
Color.ToPixel(this.colorPalette.Span, palette.AsSpan());
Color.ToPixel(configuration, this.colorPalette.Span, palette.AsSpan());
return new PaletteQuantizer<TPixel>(configuration, options, palette);
}
}

Loading…
Cancel
Save