Browse Source

internalise span apis from imagebase

af/merge-core
Scott Williams 9 years ago
parent
commit
7c6f399d2d
  1. 5
      src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs
  2. 3
      src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs
  3. 3
      src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs
  4. 3
      src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs
  5. 22
      src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs
  6. 12
      src/ImageSharp/Advanced/Unsafe/IPixelSource{TPixel}.cs
  7. 50
      src/ImageSharp/Advanced/Unsafe/ImageExtensions.cs
  8. 3
      src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuserBase.cs
  9. 3
      src/ImageSharp/Formats/Gif/GifDecoderCore.cs
  10. 11
      src/ImageSharp/Formats/Jpeg/PdfJsPort/JpegDecoderCore.cs
  11. 5
      src/ImageSharp/Formats/Png/PngDecoderCore.cs
  12. 3
      src/ImageSharp/Formats/Png/PngEncoderCore.cs
  13. 3
      src/ImageSharp/Image/Image.LoadPixelData.cs
  14. 36
      src/ImageSharp/Image/ImageBase{TPixel}.cs
  15. 1
      src/ImageSharp/Image/PixelAccessor{TPixel}.cs
  16. 1
      src/ImageSharp/Memory/SpanHelper.cs
  17. 3
      src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs
  18. 3
      src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs
  19. 3
      src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs
  20. 3
      src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs
  21. 5
      src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs
  22. 5
      src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs
  23. 3
      src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs
  24. 3
      src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs
  25. 3
      src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs
  26. 3
      src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs
  27. 3
      src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs
  28. 5
      src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs
  29. 3
      src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs
  30. 3
      src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs
  31. 3
      src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs
  32. 3
      src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs
  33. 7
      src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs
  34. 11
      src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs
  35. 5
      src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs
  36. 3
      src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs
  37. 3
      src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs
  38. 3
      src/ImageSharp/Quantizers/QuantizerBase{TPixel}.cs
  39. 3
      src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs
  40. 6
      tests/ImageSharp.Benchmarks/Image/CopyPixels.cs
  41. 3
      tests/ImageSharp.Tests/Image/ImageLoadTests.cs
  42. 5
      tests/ImageSharp.Tests/Processing/Processors/ColorMatrix/GrayscaleTest.cs
  43. 6
      tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs
  44. 5
      tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs
  45. 7
      tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs

5
src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Drawing.Brushes.Processors;
using SixLabors.ImageSharp.Drawing.Processors;
using SixLabors.ImageSharp.Memory;
@ -117,7 +118,7 @@ namespace SixLabors.ImageSharp.Drawing.Brushes
{
int sourceY = (y - this.offsetY) % this.yLength;
int offsetX = x - this.offsetX;
Span<TPixel> sourceRow = this.source.GetRowSpan(sourceY);
Span<TPixel> sourceRow = this.source.GetPixelRowSpan(sourceY);
for (int i = 0; i < scanline.Length; i++)
{
@ -128,7 +129,7 @@ namespace SixLabors.ImageSharp.Drawing.Brushes
overlay[i] = pixel;
}
Span<TPixel> destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length);
this.Blender.Blend(destinationRow, destinationRow, overlay, amountBuffer);
}
}

3
src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs

@ -3,6 +3,7 @@
using System;
using System.Numerics;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Drawing.Brushes.Processors;
using SixLabors.ImageSharp.Drawing.Processors;
using SixLabors.ImageSharp.Memory;
@ -162,7 +163,7 @@ namespace SixLabors.ImageSharp.Drawing.Brushes
overlay[i] = this.pattern[patternY, patternX];
}
Span<TPixel> destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length);
this.Blender.Blend(destinationRow, destinationRow, overlay, amountBuffer);
}
}

3
src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@ -77,7 +78,7 @@ namespace SixLabors.ImageSharp.Drawing.Brushes.Processors
overlay[i] = this[x + i, y];
}
Span<TPixel> destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(x).Slice(y, scanline.Length);
this.Blender.Blend(destinationRow, destinationRow, overlay, amountBuffer);
}
}

3
src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs

@ -3,6 +3,7 @@
using System;
using System.Numerics;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Drawing.Brushes.Processors;
using SixLabors.ImageSharp.Drawing.Processors;
using SixLabors.ImageSharp.Memory;
@ -157,7 +158,7 @@ namespace SixLabors.ImageSharp.Drawing.Brushes
overlay[i] = this[offsetX, y];
}
Span<TPixel> destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length);
this.Blender.Blend(destinationRow, destinationRow, overlay, amountBuffer);
}
}

22
src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs

@ -3,6 +3,7 @@
using System;
using System.Numerics;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Drawing.Brushes.Processors;
using SixLabors.ImageSharp.Drawing.Processors;
using SixLabors.ImageSharp.Memory;
@ -91,16 +92,23 @@ namespace SixLabors.ImageSharp.Drawing.Brushes
/// <inheritdoc />
internal override void Apply(Span<float> scanline, int x, int y)
{
Span<TPixel> destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
using (var amountBuffer = new Buffer<float>(scanline.Length))
try
{
for (int i = 0; i < scanline.Length; i++)
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length);
using (var amountBuffer = new Buffer<float>(scanline.Length))
{
amountBuffer[i] = scanline[i] * this.Options.BlendPercentage;
}
for (int i = 0; i < scanline.Length; i++)
{
amountBuffer[i] = scanline[i] * this.Options.BlendPercentage;
}
this.Blender.Blend(destinationRow, destinationRow, this.Colors, amountBuffer);
this.Blender.Blend(destinationRow, destinationRow, this.Colors, amountBuffer);
}
}
catch (Exception)
{
throw;
}
}
}

12
src/ImageSharp/Image/IImageBase{TPixel}.cs → src/ImageSharp/Advanced/Unsafe/IPixelSource{TPixel}.cs

@ -4,18 +4,18 @@
using System;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp
namespace SixLabors.ImageSharp.Advanced.Unsafe
{
/// <summary>
/// Encapsulates the basic properties and methods required to manipulate images in varying formats.
/// Allows access to the pixels as an area of contiguous memory in the given pixel format.
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
public interface IImageBase<TPixel> : IImageBase, IDisposable
/// <typeparam name="TPixel">The type of the pixel.</typeparam>
internal interface IPixelSource<TPixel>
where TPixel : struct, IPixel<TPixel>
{
/// <summary>
/// Gets the representation of the pixels as an area of contiguous memory in the given pixel format.
/// </summary>
Span<TPixel> Pixels { get; }
Span<TPixel> Span { get; }
}
}
}

50
src/ImageSharp/Advanced/Unsafe/ImageExtensions.cs

@ -0,0 +1,50 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Advanced.Unsafe
{
/// <summary>
/// Extension methods over Image{TPixel}
/// </summary>
public static partial class ImageExtensions
{
/// <summary>
/// Gets the representation of the pixels as an area of contiguous memory in the given pixel format.
/// </summary>
/// <typeparam name="TPixel">The type of the pixel.</typeparam>
/// <param name="source">The source.</param>
/// <returns>The <see cref="Span{TPixel}"/></returns>
public static Span<TPixel> GetPixelSpan<TPixel>(this ImageBase<TPixel> source)
where TPixel : struct, IPixel<TPixel>
=> GetSpan(source);
/// <summary>
/// Gets a <see cref="Span{TPixal}"/> representing the row 'y' beginning from the the first pixel on that row.
/// </summary>
/// <typeparam name="TPixel">The type of the pixel.</typeparam>
/// <param name="source">The source.</param>
/// <param name="row">The row.</param>
/// <returns>The <see cref="Span{TPixel}"/></returns>
public static Span<TPixel> GetPixelRowSpan<TPixel>(this ImageBase<TPixel> source, int row)
where TPixel : struct, IPixel<TPixel>
=> GetSpan(source).Slice(row * source.Width, source.Width);
/// <summary>
/// Gets the span.
/// </summary>
/// <typeparam name="TPixel">The type of the pixel.</typeparam>
/// <param name="source">The source.</param>
/// <returns>The span retuned from Pixel source</returns>
private static Span<TPixel> GetSpan<TPixel>(IPixelSource<TPixel> source)
where TPixel : struct, IPixel<TPixel>
=> source.Span;
}
}

3
src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuserBase.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@ -95,7 +96,7 @@ namespace SixLabors.ImageSharp.Dithering.Base
int matrixY = y + row;
if (matrixY > minY && matrixY < maxY)
{
Span<TPixel> rowSpan = image.GetRowSpan(matrixY);
Span<TPixel> rowSpan = image.GetPixelRowSpan(matrixY);
for (int col = 0; col < this.matrixWidth; col++)
{

3
src/ImageSharp/Formats/Gif/GifDecoderCore.cs

@ -6,6 +6,7 @@ using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -440,7 +441,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
writeY = y;
}
Span<TPixel> rowSpan = image.GetRowSpan(writeY);
Span<TPixel> rowSpan = image.GetPixelRowSpan(writeY);
Rgba32 rgba = new Rgba32(0, 0, 0, 255);

11
src/ImageSharp/Formats/Jpeg/PdfJsPort/JpegDecoderCore.cs

@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
@ -860,7 +861,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
{
for (int y = 0; y < image.Height; y++)
{
Span<TPixel> imageRowSpan = image.GetRowSpan(y);
Span<TPixel> imageRowSpan = image.GetPixelRowSpan(y);
Span<byte> areaRowSpan = this.pixelArea.GetRowSpan(y);
for (int x = 0; x < image.Width; x++)
@ -879,7 +880,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
{
for (int y = 0; y < image.Height; y++)
{
Span<TPixel> imageRowSpan = image.GetRowSpan(y);
Span<TPixel> imageRowSpan = image.GetPixelRowSpan(y);
Span<byte> areaRowSpan = this.pixelArea.GetRowSpan(y);
for (int x = 0, o = 0; x < image.Width; x++, o += 3)
{
@ -898,7 +899,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
{
for (int y = 0; y < image.Height; y++)
{
Span<TPixel> imageRowSpan = image.GetRowSpan(y);
Span<TPixel> imageRowSpan = image.GetPixelRowSpan(y);
Span<byte> areaRowSpan = this.pixelArea.GetRowSpan(y);
for (int x = 0, o = 0; x < image.Width; x++, o += 4)
{
@ -919,7 +920,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
{
for (int y = 0; y < image.Height; y++)
{
Span<TPixel> imageRowSpan = image.GetRowSpan(y);
Span<TPixel> imageRowSpan = image.GetPixelRowSpan(y);
Span<byte> areaRowSpan = this.pixelArea.GetRowSpan(y);
for (int x = 0, o = 0; x < image.Width; x++, o += 4)
{
@ -945,7 +946,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
{
for (int y = 0; y < image.Height; y++)
{
Span<TPixel> imageRowSpan = image.GetRowSpan(y);
Span<TPixel> imageRowSpan = image.GetPixelRowSpan(y);
Span<byte> areaRowSpan = this.pixelArea.GetRowSpan(y);
PixelOperations<TPixel>.Instance.PackFromRgb24Bytes(areaRowSpan, imageRowSpan, image.Width);

5
src/ImageSharp/Formats/Png/PngDecoderCore.cs

@ -8,6 +8,7 @@ using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Formats.Png.Filters;
using SixLabors.ImageSharp.Formats.Png.Zlib;
using SixLabors.ImageSharp.Memory;
@ -579,7 +580,7 @@ namespace SixLabors.ImageSharp.Formats.Png
throw new ImageFormatException("Unknown filter type.");
}
Span<TPixel> rowSpan = image.GetRowSpan(this.currentRow);
Span<TPixel> rowSpan = image.GetPixelRowSpan(this.currentRow);
this.ProcessInterlacedDefilteredScanline(this.scanline.Array, rowSpan, Adam7FirstColumn[this.pass], Adam7ColumnIncrement[this.pass]);
Swap(ref this.scanline, ref this.previousScanline);
@ -612,7 +613,7 @@ namespace SixLabors.ImageSharp.Formats.Png
where TPixel : struct, IPixel<TPixel>
{
var color = default(TPixel);
Span<TPixel> rowSpan = pixels.GetRowSpan(this.currentRow);
Span<TPixel> rowSpan = pixels.GetPixelRowSpan(this.currentRow);
// Trim the first marker byte from the buffer
var scanlineBuffer = new Span<byte>(defilteredScanline, 1);

3
src/ImageSharp/Formats/Png/PngEncoderCore.cs

@ -6,6 +6,7 @@ using System.Buffers;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Formats.Png.Filters;
using SixLabors.ImageSharp.Formats.Png.Zlib;
using SixLabors.ImageSharp.Memory;
@ -676,7 +677,7 @@ namespace SixLabors.ImageSharp.Formats.Png
{
for (int y = 0; y < this.height; y++)
{
Buffer<byte> r = this.EncodePixelRow(pixels.GetRowSpan(y), y);
Buffer<byte> r = this.EncodePixelRow(pixels.GetPixelRowSpan(y), y);
deflateStream.Write(r.Array, 0, resultLength);
Swap(ref this.rawScanline, ref this.previousScanline);

3
src/ImageSharp/Image/Image.LoadPixelData.cs

@ -5,6 +5,7 @@ using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@ -69,7 +70,7 @@ namespace SixLabors.ImageSharp
Guard.MustBeGreaterThanOrEqualTo(data.Length, count, nameof(data));
var image = new Image<TPixel>(config, width, height);
SpanHelper.Copy(data, image.Pixels, count);
SpanHelper.Copy(data, image.GetPixelSpan(), count);
return image;
}

36
src/ImageSharp/Image/ImageBase{TPixel}.cs

@ -4,6 +4,7 @@
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
@ -16,7 +17,7 @@ namespace SixLabors.ImageSharp
/// images in different pixel formats.
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
public abstract class ImageBase<TPixel> : IImageBase<TPixel>
public abstract class ImageBase<TPixel> : IImageBase, IDisposable, IPixelSource<TPixel>
where TPixel : struct, IPixel<TPixel>
{
#pragma warning disable SA1401 // Fields must be private
@ -92,11 +93,11 @@ namespace SixLabors.ImageSharp
// Rent then copy the pixels. Unsafe.CopyBlock gives us a nice speed boost here.
this.RentPixels();
other.Pixels.CopyTo(this.Pixels);
other.GetPixelSpan().CopyTo(this.GetPixelSpan());
}
/// <inheritdoc/>
public Span<TPixel> Pixels => new Span<TPixel>(this.PixelBuffer, 0, this.Width * this.Height);
Span<TPixel> IPixelSource<TPixel>.Span => new Span<TPixel>(this.PixelBuffer, 0, this.Width * this.Height);
/// <inheritdoc/>
public int Width { get; private set; }
@ -139,37 +140,12 @@ namespace SixLabors.ImageSharp
/// <param name="y">The y-coordinate of the pixel. Must be greater than or equal to zero and less than the height of the image.</param>
/// <returns>The <see typeparam="TPixel"/> at the specified position.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ref TPixel GetPixelReference(int x, int y)
internal ref TPixel GetPixelReference(int x, int y)
{
this.CheckCoordinates(x, y);
return ref this.PixelBuffer[(y * this.Width) + x];
}
/// <summary>
/// Gets a <see cref="Span{TPixal}"/> representing the row 'y' beginning from the the first pixel on that row.
/// </summary>
/// <param name="y">The y-coordinate of the pixel row. Must be greater than or equal to zero and less than the height of the image.</param>
/// <returns>The <see cref="Span{TPixel}"/></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Span<TPixel> GetRowSpan(int y)
{
this.CheckCoordinates(y);
return this.Pixels.Slice(y * this.Width, this.Width);
}
/// <summary>
/// Gets a <see cref="Span{T}"/> to the row 'y' beginning from the pixel at 'x'.
/// </summary>
/// <param name="x">The x coordinate (position in the row)</param>
/// <param name="y">The y (row) coordinate</param>
/// <returns>The <see cref="Span{TPixel}"/></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Span<TPixel> GetRowSpan(int x, int y)
{
this.CheckCoordinates(x, y);
return this.Pixels.Slice((y * this.Width) + x, this.Width - x);
}
/// <summary>
/// Clones the image
/// </summary>
@ -210,7 +186,7 @@ namespace SixLabors.ImageSharp
/// <param name="target">The target pixel buffer accessor.</param>
internal void CopyTo(PixelAccessor<TPixel> target)
{
SpanHelper.Copy(this.Pixels, target.PixelBuffer.Span);
SpanHelper.Copy(this.GetPixelSpan(), target.PixelBuffer.Span);
}
/// <summary>

1
src/ImageSharp/Image/PixelAccessor{TPixel}.cs

@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using Unsafe = System.Runtime.CompilerServices.Unsafe;
namespace SixLabors.ImageSharp
{

1
src/ImageSharp/Memory/SpanHelper.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using Unsafe = System.Runtime.CompilerServices.Unsafe;
namespace SixLabors.ImageSharp.Memory
{

3
src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs

@ -3,6 +3,7 @@
using System;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -87,7 +88,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> row = source.GetRowSpan(y - startY);
Span<TPixel> row = source.GetPixelRowSpan(y - startY);
for (int x = minX; x < maxX; x++)
{

3
src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Dithering;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -69,7 +70,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
for (int y = startY; y < endY; y++)
{
Span<TPixel> row = source.GetRowSpan(y);
Span<TPixel> row = source.GetPixelRowSpan(y);
for (int x = startX; x < endX; x++)
{

3
src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs

@ -3,6 +3,7 @@
using System;
using System.Buffers;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Dithering;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -78,7 +79,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
byte[] bytes = new byte[4];
for (int y = startY; y < endY; y++)
{
Span<TPixel> row = source.GetRowSpan(y);
Span<TPixel> row = source.GetPixelRowSpan(y);
for (int x = startX; x < endX; x++)
{

3
src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -56,7 +57,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> row = source.GetRowSpan(y - startY);
Span<TPixel> row = source.GetPixelRowSpan(y - startY);
for (int x = minX; x < maxX; x++)
{

5
src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -65,7 +66,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> sourceRow = source.GetRowSpan(y);
Span<TPixel> sourceRow = source.GetPixelRowSpan(y);
Span<TPixel> targetRow = targetPixels.GetRowSpan(y);
for (int x = startX; x < endX; x++)
@ -84,7 +85,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
int offsetY = y + fyr;
offsetY = offsetY.Clamp(0, maxY);
Span<TPixel> sourceOffsetRow = source.GetRowSpan(offsetY);
Span<TPixel> sourceOffsetRow = source.GetPixelRowSpan(offsetY);
for (int fx = 0; fx < kernelXWidth; fx++)
{

5
src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -54,7 +55,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> sourceRow = source.GetRowSpan(y);
Span<TPixel> sourceRow = source.GetPixelRowSpan(y);
Span<TPixel> targetRow = targetPixels.GetRowSpan(y);
for (int x = startX; x < endX; x++)
@ -70,7 +71,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
int offsetY = y + fyr;
offsetY = offsetY.Clamp(0, maxY);
Span<TPixel> sourceOffsetRow = source.GetRowSpan(offsetY);
Span<TPixel> sourceOffsetRow = source.GetPixelRowSpan(offsetY);
for (int fx = 0; fx < kernelLength; fx++)
{

3
src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -67,7 +68,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> row = source.GetRowSpan(y - startY);
Span<TPixel> row = source.GetPixelRowSpan(y - startY);
for (int x = minX; x < maxX; x++)
{

3
src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs

@ -3,6 +3,7 @@
using System;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -82,7 +83,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> destination = source.GetRowSpan(y - startY).Slice(minX - startX, width);
Span<TPixel> destination = source.GetPixelRowSpan(y - startY).Slice(minX - startX, width);
// This switched color & destination in the 2nd and 3rd places because we are applying the target colour under the current one
blender.Blend(destination, colors, destination, amount);

3
src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -67,7 +68,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> row = source.GetRowSpan(y - startY);
Span<TPixel> row = source.GetPixelRowSpan(y - startY);
for (int x = minX; x < maxX; x++)
{

3
src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -69,7 +70,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> row = source.GetRowSpan(y - startY);
Span<TPixel> row = source.GetPixelRowSpan(y - startY);
for (int x = minX; x < maxX; x++)
{

3
src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -48,7 +49,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> row = source.GetRowSpan(y - startY);
Span<TPixel> row = source.GetPixelRowSpan(y - startY);
for (int x = minX; x < maxX; x++)
{

5
src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -74,7 +75,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> sourceRow = source.GetRowSpan(y);
Span<TPixel> sourceRow = source.GetPixelRowSpan(y);
Span<TPixel> targetRow = targetPixels.GetRowSpan(y);
for (int x = startX; x < endX; x++)
@ -94,7 +95,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
offsetY = offsetY.Clamp(0, maxY);
Span<TPixel> sourceOffsetRow = source.GetRowSpan(offsetY);
Span<TPixel> sourceOffsetRow = source.GetPixelRowSpan(offsetY);
for (int fx = 0; fx <= radius; fx++)
{

3
src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Common;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -84,7 +85,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
offsetPy--;
}
Span<TPixel> row = source.GetRowSpan(offsetY + offsetPy);
Span<TPixel> row = source.GetPixelRowSpan(offsetY + offsetPy);
for (int x = minX; x < maxX; x += size)
{

3
src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -104,7 +105,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
amounts[i] = (this.options.BlendPercentage * (1 - (.95F * (distance / maxDistance)))).Clamp(0, 1);
}
Span<TPixel> destination = source.GetRowSpan(offsetY).Slice(offsetX, width);
Span<TPixel> destination = source.GetPixelRowSpan(offsetY).Slice(offsetX, width);
this.blender.Blend(destination, destination, rowColors, amounts);
}

3
src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -125,7 +126,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
amounts[i] = (this.options.BlendPercentage * (.9F * (distance / maxDistance))).Clamp(0, 1);
}
Span<TPixel> destination = source.GetRowSpan(offsetY).Slice(offsetX, width);
Span<TPixel> destination = source.GetPixelRowSpan(offsetY).Slice(offsetX, width);
this.blender.Blend(destination, destination, rowColors, amounts);
}

3
src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs

@ -3,6 +3,7 @@
using System;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -51,7 +52,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> sourceRow = source.GetRowSpan(minX, y);
Span<TPixel> sourceRow = source.GetPixelRowSpan(minX).Slice(y);
Span<TPixel> targetRow = targetPixels.GetRowSpan(y - minY);
SpanHelper.Copy(sourceRow, targetRow, maxX - minX);
});

7
src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs

@ -3,6 +3,7 @@
using System;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -65,8 +66,8 @@ namespace SixLabors.ImageSharp.Processing.Processors
y =>
{
int newY = height - y - 1;
Span<TPixel> sourceRow = source.GetRowSpan(y);
Span<TPixel> altSourceRow = source.GetRowSpan(newY);
Span<TPixel> sourceRow = source.GetPixelRowSpan(y);
Span<TPixel> altSourceRow = source.GetPixelRowSpan(newY);
Span<TPixel> targetRow = targetPixels.GetRowSpan(y);
Span<TPixel> altTargetRow = targetPixels.GetRowSpan(newY);
@ -97,7 +98,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> sourceRow = source.GetRowSpan(y);
Span<TPixel> sourceRow = source.GetPixelRowSpan(y);
Span<TPixel> targetRow = targetPixels.GetRowSpan(y);
for (int x = 0; x < halfWidth; x++)

11
src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -73,7 +74,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
if (source.Width == cloned.Width && source.Height == cloned.Height && sourceRectangle == this.ResizeRectangle)
{
// the cloned will be blank here copy all the pixel data over
source.Pixels.CopyTo(cloned.Pixels);
source.GetPixelSpan().CopyTo(cloned.GetPixelSpan());
return;
}
@ -104,8 +105,8 @@ namespace SixLabors.ImageSharp.Processing.Processors
y =>
{
// Y coordinates of source points
Span<TPixel> sourceRow = source.GetRowSpan((int)(((y - startY) * heightFactor) + sourceY));
Span<TPixel> targetRow = cloned.GetRowSpan(y);
Span<TPixel> sourceRow = source.GetPixelRowSpan((int)(((y - startY) * heightFactor) + sourceY));
Span<TPixel> targetRow = cloned.GetPixelRowSpan(y);
for (int x = minX; x < maxX; x++)
{
@ -136,7 +137,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
using (var tempRowBuffer = new Buffer<Vector4>(source.Width))
{
Span<Vector4> firstPassRow = firstPassPixels.GetRowSpan(y);
Span<TPixel> sourceRow = source.GetRowSpan(y);
Span<TPixel> sourceRow = source.GetPixelRowSpan(y);
PixelOperations<TPixel>.Instance.ToVector4(sourceRow, tempRowBuffer, sourceRow.Length);
if (this.Compand)
@ -167,7 +168,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
{
// Ensure offsets are normalised for cropping and padding.
WeightsWindow window = this.VerticalWeights.Weights[y - startY];
Span<TPixel> targetRow = cloned.GetRowSpan(y);
Span<TPixel> targetRow = cloned.GetPixelRowSpan(y);
if (this.Compand)
{

5
src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -169,7 +170,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> sourceRow = source.GetRowSpan(y);
Span<TPixel> sourceRow = source.GetPixelRowSpan(y);
Span<TPixel> targetRow = targetPixels.GetRowSpan(height - y - 1);
for (int x = 0; x < width; x++)
@ -199,7 +200,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
source.Configuration.ParallelOptions,
y =>
{
Span<TPixel> sourceRow = source.GetRowSpan(y);
Span<TPixel> sourceRow = source.GetPixelRowSpan(y);
int newX = height - y - 1;
for (int x = 0; x < width; x++)
{

3
src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Quantizers.Base;
@ -77,7 +78,7 @@ namespace SixLabors.ImageSharp.Quantizers
for (int y = 0; y < height; y++)
{
Span<TPixel> row = source.GetRowSpan(y);
Span<TPixel> row = source.GetPixelRowSpan(y);
// And loop through each column
for (int x = 0; x < width; x++)

3
src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Quantizers.Base;
@ -73,7 +74,7 @@ namespace SixLabors.ImageSharp.Quantizers
for (int y = 0; y < height; y++)
{
Span<TPixel> row = source.GetRowSpan(y);
Span<TPixel> row = source.GetPixelRowSpan(y);
// And loop through each column
for (int x = 0; x < width; x++)

3
src/ImageSharp/Quantizers/QuantizerBase{TPixel}.cs

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Dithering;
using SixLabors.ImageSharp.PixelFormats;
@ -92,7 +93,7 @@ namespace SixLabors.ImageSharp.Quantizers.Base
// Loop through each row
for (int y = 0; y < height; y++)
{
Span<TPixel> row = source.GetRowSpan(y);
Span<TPixel> row = source.GetPixelRowSpan(y);
// And loop through each column
for (int x = 0; x < width; x++)

3
src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs

@ -6,6 +6,7 @@ using System.Buffers;
using System.Collections.Generic;
using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Quantizers.Base;
@ -251,7 +252,7 @@ namespace SixLabors.ImageSharp.Quantizers
for (int y = 0; y < height; y++)
{
Span<TPixel> row = source.GetRowSpan(y);
Span<TPixel> row = source.GetPixelRowSpan(y);
// And loop through each column
for (int x = 0; x < width; x++)

6
tests/ImageSharp.Benchmarks/Image/CopyPixels.cs

@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Image
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
public class CopyPixels : BenchmarkBase
@ -103,8 +103,8 @@ namespace SixLabors.ImageSharp.Benchmarks.Image
Configuration.Default.ParallelOptions,
y =>
{
Span<Rgba32> sourceRow = source.GetRowSpan(y);
Span<Rgba32> targetRow = target.GetRowSpan(y);
Span<Rgba32> sourceRow = source.GetPixelRowSpan(y);
Span<Rgba32> targetRow = target.GetPixelRowSpan(y);
for (int x = 0; x < source.Width; x++)
{

3
tests/ImageSharp.Tests/Image/ImageLoadTests.cs

@ -7,6 +7,7 @@ using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.IO;
using Moq;
using Xunit;
using SixLabors.ImageSharp.Advanced.Unsafe;
namespace SixLabors.ImageSharp.Tests
{
@ -324,7 +325,7 @@ namespace SixLabors.ImageSharp.Tests
using (Image<Rgba32> img = image1Provider.GetImage())
{
Assert.Equal(166036, img.Pixels.Length);
Assert.Equal(166036, img.GetPixelSpan().Length);
}
}

5
tests/ImageSharp.Tests/Processing/Processors/ColorMatrix/GrayscaleTest.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
@ -31,9 +32,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.ColorMatrix
{
image.Mutate(x => x.Grayscale(value));
byte[] data = new byte[3];
for (int i = 0; i < image.Pixels.Length; i++)
for (int i = 0; i < image.GetPixelSpan().Length; i++)
{
image.Pixels[i].ToXyzBytes(data, 0);
image.GetPixelSpan()[i].ToXyzBytes(data, 0);
Assert.Equal(data[0], data[1]);
Assert.Equal(data[1], data[2]);
}

6
tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs

@ -2,7 +2,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
{
using System;
using System.Collections.Generic;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -31,8 +31,8 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
for (int y = 0; y < actual.Height; y++)
{
Span<TPixelA> aSpan = expected.GetRowSpan(y);
Span<TPixelB> bSpan = actual.GetRowSpan(y);
Span<TPixelA> aSpan = expected.GetPixelRowSpan(y);
Span<TPixelB> bSpan = actual.GetPixelRowSpan(y);
PixelOperations<TPixelA>.Instance.ToRgba32(aSpan, aBuffer, width);
PixelOperations<TPixelB>.Instance.ToRgba32(bSpan, bBuffer, width);

5
tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs

@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -64,8 +65,8 @@
for (int y = 0; y < actual.Height; y++)
{
Span<TPixelA> aSpan = expected.GetRowSpan(y);
Span<TPixelB> bSpan = actual.GetRowSpan(y);
Span<TPixelA> aSpan = expected.GetPixelRowSpan(y);
Span<TPixelB> bSpan = actual.GetPixelRowSpan(y);
PixelOperations<TPixelA>.Instance.ToRgba32(aSpan, aBuffer, width);
PixelOperations<TPixelB>.Instance.ToRgba32(bSpan, bBuffer, width);

7
tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs

@ -4,6 +4,7 @@
using System;
using System.Drawing.Imaging;
using SixLabors.ImageSharp.Advanced.Unsafe;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@ -100,7 +101,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
var destPtr = (Argb32*)workBuffer.Pin();
for (int y = 0; y < h; y++)
{
Span<TPixel> row = image.GetRowSpan(y);
Span<TPixel> row = image.GetPixelRowSpan(y);
byte* sourcePtr = sourcePtrBase + data.Stride * y;
@ -142,7 +143,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
var destPtr = (Rgb24*)workBuffer.Pin();
for (int y = 0; y < h; y++)
{
Span<TPixel> row = image.GetRowSpan(y);
Span<TPixel> row = image.GetPixelRowSpan(y);
byte* sourcePtr = sourcePtrBase + data.Stride * y;
@ -175,7 +176,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
for (int y = 0; y < h; y++)
{
Span<TPixel> row = image.GetRowSpan(y);
Span<TPixel> row = image.GetPixelRowSpan(y);
ToArgb32(row, workBuffer);
byte* destPtr = destPtrBase + data.Stride * y;

Loading…
Cancel
Save