diff --git a/src/ImageSharp/Advanced/ImageExtensions.cs b/src/ImageSharp/Advanced/ImageExtensions.cs
index f4043b5ad..a517ea5b3 100644
--- a/src/ImageSharp/Advanced/ImageExtensions.cs
+++ b/src/ImageSharp/Advanced/ImageExtensions.cs
@@ -12,13 +12,35 @@ namespace SixLabors.ImageSharp.Advanced
///
internal static class ImageExtensions
{
+ ///
+ /// Gets a reference to the pixel at the specified position.
+ ///
+ /// The source image frame
+ /// The x coordinate (row)
+ /// The y coordinate (position at row)
+ /// A reference to the element.
+ public static ref TPixel GetPixelReference(this ImageFrame source, int x, int y)
+ where TPixel : struct, IPixel
+ => ref GetPixelReference((IPixelSource)source, x, y);
+
+ ///
+ /// Gets a reference to the pixel at the specified position.
+ ///
+ /// The source image frame
+ /// The x coordinate (row)
+ /// The y coordinate (position at row)
+ /// A reference to the element.
+ public static ref TPixel GetPixelReference(this Image source, int x, int y)
+ where TPixel : struct, IPixel
+ => ref source.Frames.RootFrame.GetPixelReference(x, y);
+
///
/// Gets the representation of the pixels as an area of contiguous memory in the given pixel format.
///
/// The type of the pixel.
/// The source.
/// The
- public static Span GetPixelSpan(this ImageFrame source)
+ internal static Span GetPixelSpan(this ImageFrame source)
where TPixel : struct, IPixel
=> GetSpan(source);
@@ -29,7 +51,7 @@ namespace SixLabors.ImageSharp.Advanced
/// The source.
/// The row.
/// The
- public static Span GetPixelRowSpan(this ImageFrame source, int row)
+ internal static Span GetPixelRowSpan(this ImageFrame source, int row)
where TPixel : struct, IPixel
=> GetSpan(source, row);
@@ -39,7 +61,7 @@ namespace SixLabors.ImageSharp.Advanced
/// The type of the pixel.
/// The source.
/// The
- public static Span GetPixelSpan(this Image source)
+ internal static Span GetPixelSpan(this Image source)
where TPixel : struct, IPixel
=> source.Frames.RootFrame.GetPixelSpan();
@@ -50,7 +72,7 @@ namespace SixLabors.ImageSharp.Advanced
/// The source.
/// The row.
/// The
- public static Span GetPixelRowSpan(this Image source, int row)
+ internal static Span GetPixelRowSpan(this Image source, int row)
where TPixel : struct, IPixel
=> source.Frames.RootFrame.GetPixelRowSpan(row);
@@ -60,7 +82,7 @@ namespace SixLabors.ImageSharp.Advanced
/// The Pixel format.
/// The source image
/// Returns the configuration.
- public static Configuration GetConfiguration(this Image source)
+ internal static Configuration GetConfiguration(this Image source)
where TPixel : struct, IPixel
=> GetConfiguration((IConfigurable)source);
@@ -107,5 +129,17 @@ namespace SixLabors.ImageSharp.Advanced
/// Returns the bounds of the image
private static Configuration GetConfiguration(IConfigurable source)
=> source?.Configuration ?? Configuration.Default;
+
+ ///
+ /// Gets a reference to the pixel at the specified position.
+ ///
+ /// The source image frame
+ /// The x coordinate (row)
+ /// The y coordinate (position at row)
+ /// A reference to the element.
+ private static ref TPixel GetPixelReference(IPixelSource source, int x, int y)
+ where TPixel : struct, IPixel
+ => ref source.PixelBuffer[x, y];
+
}
}