diff --git a/src/ImageSharp.Drawing/Paths/ShapePath.cs b/src/ImageSharp.Drawing/Paths/ShapePath.cs
index f973668e5..9e2b22a75 100644
--- a/src/ImageSharp.Drawing/Paths/ShapePath.cs
+++ b/src/ImageSharp.Drawing/Paths/ShapePath.cs
@@ -18,6 +18,7 @@ namespace SixLabors.ImageSharp.Drawing
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The shape.
/// The pen to apply to the shape.
// SixLabors.shape willbe moving to a Span/ReadOnlySpan based API shortly use ToArray for now.
diff --git a/src/ImageSharp.Drawing/Paths/ShapeRegion.cs b/src/ImageSharp.Drawing/Paths/ShapeRegion.cs
index 489468dbe..77a3b0115 100644
--- a/src/ImageSharp.Drawing/Paths/ShapeRegion.cs
+++ b/src/ImageSharp.Drawing/Paths/ShapeRegion.cs
@@ -20,6 +20,7 @@ namespace SixLabors.ImageSharp.Drawing
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The shape.
public ShapeRegion(MemoryManager memoryManager, IPath shape)
{
diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs
index 44841bd67..1b83f62eb 100644
--- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs
+++ b/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs
@@ -44,6 +44,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The representing the uncompressed spectral Jpeg data
public JpegImagePostProcessor(MemoryManager memoryManager, IRawJpegData rawJpeg)
{
diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs
index c2b4d632a..e83dd75a5 100644
--- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs
+++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs
@@ -54,6 +54,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
///
/// Initializes
///
+ /// The to use for buffer allocations.
/// The instance
public void InitializeDerivedData(MemoryManager memoryManager, OrigJpegDecoderCore decoder)
{
diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs
index 4142ae354..f1beab114 100644
--- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs
+++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs
@@ -20,6 +20,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
///
/// Initializes a new instance of the struct.
///
+ /// The to use for buffer allocations.
/// The code lengths
/// The huffman values
public PdfJsHuffmanTable(MemoryManager memoryManager, byte[] lengths, byte[] values)
diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsJpegPixelArea.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsJpegPixelArea.cs
index eebc57b86..ac26d892c 100644
--- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsJpegPixelArea.cs
+++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsJpegPixelArea.cs
@@ -27,6 +27,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
///
/// Initializes a new instance of the struct.
///
+ /// The to use for buffer allocations.
/// The image width
/// The image height
/// The number of components
diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsQuantizationTables.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsQuantizationTables.cs
index f7302b156..afe0b3007 100644
--- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsQuantizationTables.cs
+++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsQuantizationTables.cs
@@ -12,6 +12,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
///
internal sealed class PdfJsQuantizationTables : IDisposable
{
+ public PdfJsQuantizationTables(MemoryManager memoryManager)
+ {
+ this.Tables = memoryManager.Allocate2D(64, 4);
+ }
+
///
/// Gets the ZigZag scan table
///
@@ -40,11 +45,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
63
};
- public PdfJsQuantizationTables(MemoryManager memoryManager)
- {
- this.Tables = memoryManager.Allocate2D(64, 4);
- }
-
///
/// Gets or sets the quantization tables.
///
diff --git a/src/ImageSharp/Formats/Png/PngEncoder.cs b/src/ImageSharp/Formats/Png/PngEncoder.cs
index f65ce59b2..1fd70a4d3 100644
--- a/src/ImageSharp/Formats/Png/PngEncoder.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoder.cs
@@ -16,11 +16,15 @@ namespace SixLabors.ImageSharp.Formats.Png
{
private readonly MemoryManager memoryManager;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The to use for buffer allocations.
public PngEncoder(MemoryManager memoryManager)
{
this.memoryManager = memoryManager;
}
-
+
///
/// Gets or sets a value indicating whether the metadata should be ignored when the image is being encoded.
///
diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
index e3e209ed4..327ce9fdf 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
@@ -150,6 +150,7 @@ namespace SixLabors.ImageSharp.Formats.Png
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The options for influancing the encoder
public PngEncoderCore(MemoryManager memoryManager, IPngEncoderOptions options)
{
diff --git a/src/ImageSharp/IImageProcessingContext{TPixel}.cs b/src/ImageSharp/IImageProcessingContext{TPixel}.cs
index 1556987df..68b0a030a 100644
--- a/src/ImageSharp/IImageProcessingContext{TPixel}.cs
+++ b/src/ImageSharp/IImageProcessingContext{TPixel}.cs
@@ -30,6 +30,11 @@ namespace SixLabors.ImageSharp
/// The current operations class to allow chaining of operations.
IImageProcessingContext ApplyProcessor(IImageProcessor processor);
+ ///
+ /// Returns a reference to the used to allocate buffers
+ /// for this context.
+ ///
+ /// A to use for buffer allocations.
MemoryManager GetMemoryManager();
}
diff --git a/src/ImageSharp/Image/ImageFrame{TPixel}.cs b/src/ImageSharp/Image/ImageFrame{TPixel}.cs
index 2f2f545db..888630afe 100644
--- a/src/ImageSharp/Image/ImageFrame{TPixel}.cs
+++ b/src/ImageSharp/Image/ImageFrame{TPixel}.cs
@@ -20,8 +20,6 @@ namespace SixLabors.ImageSharp
public sealed class ImageFrame : IPixelSource, IDisposable
where TPixel : struct, IPixel
{
- public MemoryManager MemoryManager { get; }
-
///
/// The image pixels. Not private as Buffer2D requires an array in its constructor.
///
@@ -32,6 +30,7 @@ namespace SixLabors.ImageSharp
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The width of the image in pixels.
/// The height of the image in pixels.
internal ImageFrame(MemoryManager memoryManager, int width, int height)
@@ -42,6 +41,7 @@ namespace SixLabors.ImageSharp
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The width of the image in pixels.
/// The height of the image in pixels.
/// The meta data.
@@ -60,6 +60,7 @@ namespace SixLabors.ImageSharp
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The source.
internal ImageFrame(MemoryManager memoryManager, ImageFrame source)
{
@@ -69,6 +70,11 @@ namespace SixLabors.ImageSharp
this.MetaData = source.MetaData.Clone();
}
+ ///
+ /// Gets the to use for buffer allocations.
+ ///
+ public MemoryManager MemoryManager { get; }
+
///
Buffer2D IPixelSource.PixelBuffer => this.pixelBuffer;
diff --git a/src/ImageSharp/Memory/ArrayPoolMemoryManager.cs b/src/ImageSharp/Memory/ArrayPoolMemoryManager.cs
index 80c6e00e3..d83e3ca3e 100644
--- a/src/ImageSharp/Memory/ArrayPoolMemoryManager.cs
+++ b/src/ImageSharp/Memory/ArrayPoolMemoryManager.cs
@@ -4,7 +4,6 @@ using System.Runtime.InteropServices;
namespace SixLabors.ImageSharp.Memory
{
-
///
/// Implements by allocating memory from .
///
diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs
index a95d5fef6..f66ce80a5 100644
--- a/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs
@@ -25,8 +25,10 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The options effecting blending and composition.
- public LomographProcessor(MemoryManager memoryManager, GraphicsOptions options) {
+ public LomographProcessor(MemoryManager memoryManager, GraphicsOptions options)
+ {
this.memoryManager = memoryManager;
this.options = options;
}
diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs
index 76a616a1b..a14919e86 100644
--- a/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs
@@ -26,8 +26,10 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The options effecting blending and composition.
- public PolaroidProcessor(MemoryManager memoryManager, GraphicsOptions options) {
+ public PolaroidProcessor(MemoryManager memoryManager, GraphicsOptions options)
+ {
this.memoryManager = memoryManager;
this.options = options;
}
diff --git a/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs
index b81fe3cf3..296ae1bb3 100644
--- a/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs
@@ -24,6 +24,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The to set the background color to.
/// The options defining blending algorithum and amount.
public BackgroundColorProcessor(MemoryManager memoryManager, TPixel color, GraphicsOptions options)
diff --git a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs
index 521da20a7..6114c6438 100644
--- a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs
@@ -27,6 +27,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The color or the glow.
/// The radius of the glow.
/// The options effecting blending and composition.
diff --git a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs
index dc60ffec9..9877f4cc9 100644
--- a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs
@@ -27,6 +27,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The color of the vignette.
/// The x-radius.
/// The y-radius.
@@ -44,6 +45,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The color of the vignette.
/// The options effecting blending and composition.
public VignetteProcessor(MemoryManager memoryManager, TPixel color, GraphicsOptions options)
diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.Weights.cs b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.Weights.cs
index c86fe89b7..95fc5ee6d 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.Weights.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.Weights.cs
@@ -162,6 +162,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The size of the source window
/// The size of the destination window
public WeightsBuffer(MemoryManager memoryManager, int sourceSize, int destinationSize)
diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs
index 6b608d102..3b7ff4b64 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs
@@ -21,6 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The sampler to perform the resize operation.
/// The target width.
/// The target height.
@@ -40,7 +41,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
this.Height = height;
this.ResizeRectangle = resizeRectangle;
}
-
+
///
/// Gets the sampler to perform the resize operation.
///
@@ -60,7 +61,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
/// Gets or sets the resize rectangle.
///
public Rectangle ResizeRectangle { get; protected set; }
-
+
protected MemoryManager MemoryManager { get; }
///
diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs
index 6c4ea7e67..2c0f3f154 100644
--- a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs
@@ -23,6 +23,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The sampler to perform the resize operation.
/// The target width.
/// The target height.
@@ -34,6 +35,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
///
/// Initializes a new instance of the class.
///
+ /// The to use for buffer allocations.
/// The sampler to perform the resize operation.
/// The target width.
/// The target height.