From 7635558f9b2c43373b2eea09c6750445ff312f1e Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Sun, 16 Jul 2017 09:18:01 +0100 Subject: [PATCH] internalise cloning processor + rename context --- samples/AvatarWithRoundedCorner/Program.cs | 2 +- src/ImageSharp.Drawing/DrawImage.cs | 12 +++++----- src/ImageSharp.Drawing/FillRegion.cs | 14 +++++------ src/ImageSharp.Drawing/Paths/DrawBeziers.cs | 12 +++++----- src/ImageSharp.Drawing/Paths/DrawLines.cs | 12 +++++----- src/ImageSharp.Drawing/Paths/DrawPath.cs | 12 +++++----- .../Paths/DrawPathCollection.cs | 12 +++++----- src/ImageSharp.Drawing/Paths/DrawPolygon.cs | 12 +++++----- src/ImageSharp.Drawing/Paths/DrawRectangle.cs | 12 +++++----- .../Paths/FillPathBuilder.cs | 8 +++---- .../Paths/FillPathCollection.cs | 8 +++---- src/ImageSharp.Drawing/Paths/FillPaths.cs | 8 +++---- src/ImageSharp.Drawing/Paths/FillPolygon.cs | 8 +++---- src/ImageSharp.Drawing/Paths/FillRectangle.cs | 8 +++---- src/ImageSharp.Drawing/Text/DrawText.Path.cs | 16 ++++++------- src/ImageSharp.Drawing/Text/DrawText.cs | 16 ++++++------- src/ImageSharp/ApplyProcessors.cs | 14 +++++------ src/ImageSharp/Configuration.cs | 2 +- ...> DefaultInternalImageProcessorContext.cs} | 14 +++++------ ...y.cs => IImageProcessingContextFactory.cs} | 10 ++++---- ....cs => IImageProcessingContext{TPixel}.cs} | 8 +++---- ...rocessor.cs => ICloneingImageProcessor.cs} | 4 ++-- .../Binarization/BinaryThreshold.cs | 4 ++-- .../Processing/Binarization/Dither.cs | 12 +++++----- .../Processing/ColorMatrix/BlackWhite.cs | 4 ++-- .../Processing/ColorMatrix/ColorBlindness.cs | 4 ++-- .../Processing/ColorMatrix/Grayscale.cs | 8 +++---- src/ImageSharp/Processing/ColorMatrix/Hue.cs | 4 ++-- .../Processing/ColorMatrix/Kodachrome.cs | 4 ++-- .../Processing/ColorMatrix/Lomograph.cs | 8 +++---- .../Processing/ColorMatrix/Polaroid.cs | 8 +++---- .../Processing/ColorMatrix/Saturation.cs | 4 ++-- .../Processing/ColorMatrix/Sepia.cs | 4 ++-- .../Processing/Convolution/BoxBlur.cs | 6 ++--- .../Processing/Convolution/DetectEdges.cs | 14 +++++------ .../Processing/Convolution/GaussianBlur.cs | 6 ++--- .../Processing/Convolution/GaussianSharpen.cs | 6 ++--- src/ImageSharp/Processing/Delegate.cs | 2 +- src/ImageSharp/Processing/Effects/Alpha.cs | 4 ++-- .../Processing/Effects/BackgroundColor.cs | 8 +++---- .../Processing/Effects/Brightness.cs | 4 ++-- src/ImageSharp/Processing/Effects/Contrast.cs | 4 ++-- src/ImageSharp/Processing/Effects/Invert.cs | 4 ++-- .../Processing/Effects/OilPainting.cs | 8 +++---- src/ImageSharp/Processing/Effects/Pixelate.cs | 6 ++--- src/ImageSharp/Processing/Overlays/Glow.cs | 24 +++++++++---------- .../Processing/Overlays/Vignette.cs | 24 +++++++++---------- .../Processors/CLoneingImageProcessor.cs | 2 +- .../Processing/Transforms/AutoOrient.cs | 2 +- src/ImageSharp/Processing/Transforms/Crop.cs | 4 ++-- .../Processing/Transforms/EntropyCrop.cs | 2 +- src/ImageSharp/Processing/Transforms/Flip.cs | 2 +- src/ImageSharp/Processing/Transforms/Pad.cs | 2 +- .../Processing/Transforms/Resize.cs | 18 +++++++------- .../Processing/Transforms/Rotate.cs | 6 ++--- .../Processing/Transforms/RotateFlip.cs | 2 +- src/ImageSharp/Processing/Transforms/Skew.cs | 4 ++-- src/ImageSharp/Quantizers/Quantize.cs | 4 ++-- .../BaseImageOperationsExtensionTest.cs | 14 ++++++----- .../FakeImageOperationsProvider.cs | 10 ++++---- .../ImageProviders/TestImageProvider.cs | 2 +- 61 files changed, 242 insertions(+), 240 deletions(-) rename src/ImageSharp/{DefaultInternalImageProcessorApplicator.cs => DefaultInternalImageProcessorContext.cs} (79%) rename src/ImageSharp/{IImageProcessorApplicatorFactory.cs => IImageProcessingContextFactory.cs} (74%) rename src/ImageSharp/{IImageProcessorApplicator{TPixel}.cs => IImageProcessingContext{TPixel}.cs} (83%) rename src/ImageSharp/Image/{ICloningImageProcessor.cs => ICloneingImageProcessor.cs} (89%) diff --git a/samples/AvatarWithRoundedCorner/Program.cs b/samples/AvatarWithRoundedCorner/Program.cs index f635ed203..caed6687f 100644 --- a/samples/AvatarWithRoundedCorner/Program.cs +++ b/samples/AvatarWithRoundedCorner/Program.cs @@ -36,7 +36,7 @@ namespace AvatarWithRoundedCorner } // lets create our custom image mutating pipeline - private static IImageProcessorApplicator ConvertToAvatar(this IImageProcessorApplicator operations, Size size, float cornerRadius) + private static IImageProcessingContext ConvertToAvatar(this IImageProcessingContext operations, Size size, float cornerRadius) { return operations.Resize(new ImageSharp.Processing.ResizeOptions { diff --git a/src/ImageSharp.Drawing/DrawImage.cs b/src/ImageSharp.Drawing/DrawImage.cs index a7b1faa15..a89fc7e6f 100644 --- a/src/ImageSharp.Drawing/DrawImage.cs +++ b/src/ImageSharp.Drawing/DrawImage.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The location to draw the blended image. /// The options. /// The . - public static IImageProcessorApplicator DrawImage(this IImageProcessorApplicator source, Image image, Size size, Point location, GraphicsOptions options) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, Size size, Point location, GraphicsOptions options) where TPixel : struct, IPixel { if (size == default(Size)) @@ -49,7 +49,7 @@ namespace ImageSharp /// The image to blend with the currently processing image. /// The opacity of the image image to blend. Must be between 0 and 1. /// The . - public static IImageProcessorApplicator Blend(this IImageProcessorApplicator source, Image image, float percent) + public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, float percent) where TPixel : struct, IPixel { GraphicsOptions options = GraphicsOptions.Default; @@ -66,7 +66,7 @@ namespace ImageSharp /// The blending mode. /// The opacity of the image image to blend. Must be between 0 and 1. /// The . - public static IImageProcessorApplicator Blend(this IImageProcessorApplicator source, Image image, PixelBlenderMode blender, float percent) + public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, PixelBlenderMode blender, float percent) where TPixel : struct, IPixel { GraphicsOptions options = GraphicsOptions.Default; @@ -83,7 +83,7 @@ namespace ImageSharp /// The image to blend with the currently processing image. /// The options, including the blending type and belnding amount. /// The . - public static IImageProcessorApplicator Blend(this IImageProcessorApplicator source, Image image, GraphicsOptions options) + public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, GraphicsOptions options) where TPixel : struct, IPixel { return DrawImage(source, image, default(Size), default(Point), options); @@ -99,7 +99,7 @@ namespace ImageSharp /// The size to draw the blended image. /// The location to draw the blended image. /// The . - public static IImageProcessorApplicator DrawImage(this IImageProcessorApplicator source, Image image, float percent, Size size, Point location) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, float percent, Size size, Point location) where TPixel : struct, IPixel { GraphicsOptions options = GraphicsOptions.Default; @@ -118,7 +118,7 @@ namespace ImageSharp /// The size to draw the blended image. /// The location to draw the blended image. /// The . - public static IImageProcessorApplicator DrawImage(this IImageProcessorApplicator source, Image image, PixelBlenderMode blender, float percent, Size size, Point location) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, PixelBlenderMode blender, float percent, Size size, Point location) where TPixel : struct, IPixel { GraphicsOptions options = GraphicsOptions.Default; diff --git a/src/ImageSharp.Drawing/FillRegion.cs b/src/ImageSharp.Drawing/FillRegion.cs index ff86c7240..829d7b826 100644 --- a/src/ImageSharp.Drawing/FillRegion.cs +++ b/src/ImageSharp.Drawing/FillRegion.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The details how to fill the region of interest. /// The graphics options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, GraphicsOptions options) where TPixel : struct, IPixel { return source.ApplyProcessor(new FillProcessor(brush, options)); @@ -36,7 +36,7 @@ namespace ImageSharp /// The image this method extends. /// The details how to fill the region of interest. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush) where TPixel : struct, IPixel { return source.Fill(brush, GraphicsOptions.Default); @@ -49,7 +49,7 @@ namespace ImageSharp /// The image this method extends. /// The color. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color)); @@ -64,7 +64,7 @@ namespace ImageSharp /// The region. /// The graphics options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, Region region, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Region region, GraphicsOptions options) where TPixel : struct, IPixel { return source.ApplyProcessor(new FillRegionProcessor(brush, region, options)); @@ -78,7 +78,7 @@ namespace ImageSharp /// The brush. /// The region. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, Region region) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Region region) where TPixel : struct, IPixel { return source.Fill(brush, region, GraphicsOptions.Default); @@ -93,7 +93,7 @@ namespace ImageSharp /// The region. /// The options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, Region region, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, Region region, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), region, options); @@ -107,7 +107,7 @@ namespace ImageSharp /// The color. /// The region. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, Region region) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, Region region) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), region); diff --git a/src/ImageSharp.Drawing/Paths/DrawBeziers.cs b/src/ImageSharp.Drawing/Paths/DrawBeziers.cs index b83edb7a2..07cc832d7 100644 --- a/src/ImageSharp.Drawing/Paths/DrawBeziers.cs +++ b/src/ImageSharp.Drawing/Paths/DrawBeziers.cs @@ -28,7 +28,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator DrawBeziers(this IImageProcessorApplicator source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new CubicBezierLineSegment(points)), options); @@ -43,7 +43,7 @@ namespace ImageSharp /// The thickness. /// The points. /// The . - public static IImageProcessorApplicator DrawBeziers(this IImageProcessorApplicator source, IBrush brush, float thickness, PointF[] points) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new CubicBezierLineSegment(points))); @@ -58,7 +58,7 @@ namespace ImageSharp /// The thickness. /// The points. /// The . - public static IImageProcessorApplicator DrawBeziers(this IImageProcessorApplicator source, TPixel color, float thickness, PointF[] points) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points) where TPixel : struct, IPixel { return source.DrawBeziers(new SolidBrush(color), thickness, points); @@ -74,7 +74,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator DrawBeziers(this IImageProcessorApplicator source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.DrawBeziers(new SolidBrush(color), thickness, points, options); @@ -89,7 +89,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator DrawBeziers(this IImageProcessorApplicator source, IPen pen, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IPen pen, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(pen, new Path(new CubicBezierLineSegment(points)), options); @@ -103,7 +103,7 @@ namespace ImageSharp /// The pen. /// The points. /// The . - public static IImageProcessorApplicator DrawBeziers(this IImageProcessorApplicator source, IPen pen, PointF[] points) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IPen pen, PointF[] points) where TPixel : struct, IPixel { return source.Draw(pen, new Path(new CubicBezierLineSegment(points))); diff --git a/src/ImageSharp.Drawing/Paths/DrawLines.cs b/src/ImageSharp.Drawing/Paths/DrawLines.cs index 553ec2ca5..79a5037db 100644 --- a/src/ImageSharp.Drawing/Paths/DrawLines.cs +++ b/src/ImageSharp.Drawing/Paths/DrawLines.cs @@ -28,7 +28,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator DrawLines(this IImageProcessorApplicator source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points)), options); @@ -43,7 +43,7 @@ namespace ImageSharp /// The thickness. /// The points. /// The . - public static IImageProcessorApplicator DrawLines(this IImageProcessorApplicator source, IBrush brush, float thickness, PointF[] points) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points))); @@ -58,7 +58,7 @@ namespace ImageSharp /// The thickness. /// The points. /// The . - public static IImageProcessorApplicator DrawLines(this IImageProcessorApplicator source, TPixel color, float thickness, PointF[] points) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points) where TPixel : struct, IPixel { return source.DrawLines(new SolidBrush(color), thickness, points); @@ -74,7 +74,7 @@ namespace ImageSharp /// The points. /// The options. /// The .> - public static IImageProcessorApplicator DrawLines(this IImageProcessorApplicator source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.DrawLines(new SolidBrush(color), thickness, points, options); @@ -89,7 +89,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator DrawLines(this IImageProcessorApplicator source, IPen pen, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IPen pen, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(pen, new Path(new LinearLineSegment(points)), options); @@ -103,7 +103,7 @@ namespace ImageSharp /// The pen. /// The points. /// The . - public static IImageProcessorApplicator DrawLines(this IImageProcessorApplicator source, IPen pen, PointF[] points) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IPen pen, PointF[] points) where TPixel : struct, IPixel { return source.Draw(pen, new Path(new LinearLineSegment(points))); diff --git a/src/ImageSharp.Drawing/Paths/DrawPath.cs b/src/ImageSharp.Drawing/Paths/DrawPath.cs index 68ba89ff1..91ad05894 100644 --- a/src/ImageSharp.Drawing/Paths/DrawPath.cs +++ b/src/ImageSharp.Drawing/Paths/DrawPath.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The path. /// The options. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IPen pen, IPath path, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(pen.StrokeFill, new ShapePath(path, pen), options); @@ -39,7 +39,7 @@ namespace ImageSharp /// The pen. /// The path. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IPen pen, IPath path) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path) where TPixel : struct, IPixel { return source.Draw(pen, path, GraphicsOptions.Default); @@ -55,7 +55,7 @@ namespace ImageSharp /// The shape. /// The options. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IBrush brush, float thickness, IPath path, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPath path, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), path, options); @@ -70,7 +70,7 @@ namespace ImageSharp /// The thickness. /// The path. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IBrush brush, float thickness, IPath path) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPath path) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), path); @@ -86,7 +86,7 @@ namespace ImageSharp /// The path. /// The options. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, TPixel color, float thickness, IPath path, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPath path, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, path, options); @@ -101,7 +101,7 @@ namespace ImageSharp /// The thickness. /// The path. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, TPixel color, float thickness, IPath path) + public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPath path) where TPixel : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, path); diff --git a/src/ImageSharp.Drawing/Paths/DrawPathCollection.cs b/src/ImageSharp.Drawing/Paths/DrawPathCollection.cs index 086ce9723..8ac048e3e 100644 --- a/src/ImageSharp.Drawing/Paths/DrawPathCollection.cs +++ b/src/ImageSharp.Drawing/Paths/DrawPathCollection.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The paths. /// The options. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IPen pen, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPathCollection paths, GraphicsOptions options) where TPixel : struct, IPixel { foreach (IPath path in paths) @@ -44,7 +44,7 @@ namespace ImageSharp /// The pen. /// The paths. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IPen pen, IPathCollection paths) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPathCollection paths) where TPixel : struct, IPixel { return source.Draw(pen, paths, GraphicsOptions.Default); @@ -60,7 +60,7 @@ namespace ImageSharp /// The shapes. /// The options. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IBrush brush, float thickness, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPathCollection paths, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), paths, options); @@ -75,7 +75,7 @@ namespace ImageSharp /// The thickness. /// The paths. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IBrush brush, float thickness, IPathCollection paths) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPathCollection paths) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), paths); @@ -91,7 +91,7 @@ namespace ImageSharp /// The paths. /// The options. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, TPixel color, float thickness, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPathCollection paths, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, paths, options); @@ -106,7 +106,7 @@ namespace ImageSharp /// The thickness. /// The paths. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, TPixel color, float thickness, IPathCollection paths) + public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPathCollection paths) where TPixel : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, paths); diff --git a/src/ImageSharp.Drawing/Paths/DrawPolygon.cs b/src/ImageSharp.Drawing/Paths/DrawPolygon.cs index 12b687415..8033e6fb6 100644 --- a/src/ImageSharp.Drawing/Paths/DrawPolygon.cs +++ b/src/ImageSharp.Drawing/Paths/DrawPolygon.cs @@ -28,7 +28,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator DrawPolygon(this IImageProcessorApplicator source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)), options); @@ -43,7 +43,7 @@ namespace ImageSharp /// The thickness. /// The points. /// The . - public static IImageProcessorApplicator DrawPolygon(this IImageProcessorApplicator source, IBrush brush, float thickness, PointF[] points) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points))); @@ -58,7 +58,7 @@ namespace ImageSharp /// The thickness. /// The points. /// The . - public static IImageProcessorApplicator DrawPolygon(this IImageProcessorApplicator source, TPixel color, float thickness, PointF[] points) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points) where TPixel : struct, IPixel { return source.DrawPolygon(new SolidBrush(color), thickness, points); @@ -74,7 +74,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator DrawPolygon(this IImageProcessorApplicator source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.DrawPolygon(new SolidBrush(color), thickness, points, options); @@ -88,7 +88,7 @@ namespace ImageSharp /// The pen. /// The points. /// The . - public static IImageProcessorApplicator DrawPolygon(this IImageProcessorApplicator source, IPen pen, PointF[] points) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IPen pen, PointF[] points) where TPixel : struct, IPixel { return source.Draw(pen, new Polygon(new LinearLineSegment(points)), GraphicsOptions.Default); @@ -103,7 +103,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator DrawPolygon(this IImageProcessorApplicator source, IPen pen, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IPen pen, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(pen, new Polygon(new LinearLineSegment(points)), options); diff --git a/src/ImageSharp.Drawing/Paths/DrawRectangle.cs b/src/ImageSharp.Drawing/Paths/DrawRectangle.cs index a9832a628..720327270 100644 --- a/src/ImageSharp.Drawing/Paths/DrawRectangle.cs +++ b/src/ImageSharp.Drawing/Paths/DrawRectangle.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The shape. /// The options. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IPen pen, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, RectangleF shape, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(pen, new SixLabors.Shapes.RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height), options); @@ -39,7 +39,7 @@ namespace ImageSharp /// The pen. /// The shape. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IPen pen, RectangleF shape) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, RectangleF shape) where TPixel : struct, IPixel { return source.Draw(pen, shape, GraphicsOptions.Default); @@ -55,7 +55,7 @@ namespace ImageSharp /// The shape. /// The options. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IBrush brush, float thickness, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, RectangleF shape, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), shape, options); @@ -70,7 +70,7 @@ namespace ImageSharp /// The thickness. /// The shape. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, IBrush brush, float thickness, RectangleF shape) + public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, RectangleF shape) where TPixel : struct, IPixel { return source.Draw(new Pen(brush, thickness), shape); @@ -86,7 +86,7 @@ namespace ImageSharp /// The shape. /// The options. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, TPixel color, float thickness, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, RectangleF shape, GraphicsOptions options) where TPixel : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, shape, options); @@ -101,7 +101,7 @@ namespace ImageSharp /// The thickness. /// The shape. /// The . - public static IImageProcessorApplicator Draw(this IImageProcessorApplicator source, TPixel color, float thickness, RectangleF shape) + public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, RectangleF shape) where TPixel : struct, IPixel { return source.Draw(new SolidBrush(color), thickness, shape); diff --git a/src/ImageSharp.Drawing/Paths/FillPathBuilder.cs b/src/ImageSharp.Drawing/Paths/FillPathBuilder.cs index 38d3ad10f..086288201 100644 --- a/src/ImageSharp.Drawing/Paths/FillPathBuilder.cs +++ b/src/ImageSharp.Drawing/Paths/FillPathBuilder.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The shape. /// The graphics options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, Action path, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Action path, GraphicsOptions options) where TPixel : struct, IPixel { var pb = new PathBuilder(); @@ -42,7 +42,7 @@ namespace ImageSharp /// The brush. /// The path. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, Action path) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Action path) where TPixel : struct, IPixel { return source.Fill(brush, path, GraphicsOptions.Default); @@ -57,7 +57,7 @@ namespace ImageSharp /// The path. /// The options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, Action path, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, Action path, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), path, options); @@ -71,7 +71,7 @@ namespace ImageSharp /// The color. /// The path. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, Action path) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, Action path) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), path); diff --git a/src/ImageSharp.Drawing/Paths/FillPathCollection.cs b/src/ImageSharp.Drawing/Paths/FillPathCollection.cs index eec3fa795..dd7d2cf3e 100644 --- a/src/ImageSharp.Drawing/Paths/FillPathCollection.cs +++ b/src/ImageSharp.Drawing/Paths/FillPathCollection.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The shapes. /// The graphics options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPathCollection paths, GraphicsOptions options) where TPixel : struct, IPixel { foreach (IPath s in paths) @@ -43,7 +43,7 @@ namespace ImageSharp /// The brush. /// The paths. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, IPathCollection paths) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPathCollection paths) where TPixel : struct, IPixel { return source.Fill(brush, paths, GraphicsOptions.Default); @@ -58,7 +58,7 @@ namespace ImageSharp /// The paths. /// The options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, IPathCollection paths, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), paths, options); @@ -72,7 +72,7 @@ namespace ImageSharp /// The color. /// The paths. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, IPathCollection paths) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, IPathCollection paths) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), paths); diff --git a/src/ImageSharp.Drawing/Paths/FillPaths.cs b/src/ImageSharp.Drawing/Paths/FillPaths.cs index 7cd6dbe54..2cd6ab0fc 100644 --- a/src/ImageSharp.Drawing/Paths/FillPaths.cs +++ b/src/ImageSharp.Drawing/Paths/FillPaths.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The shape. /// The graphics options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, IPath path, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPath path, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(brush, new ShapeRegion(path), options); @@ -38,7 +38,7 @@ namespace ImageSharp /// The brush. /// The path. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, IPath path) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPath path) where TPixel : struct, IPixel { return source.Fill(brush, new ShapeRegion(path), GraphicsOptions.Default); @@ -53,7 +53,7 @@ namespace ImageSharp /// The path. /// The options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, IPath path, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, IPath path, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), path, options); @@ -67,7 +67,7 @@ namespace ImageSharp /// The color. /// The path. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, IPath path) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, IPath path) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), path); diff --git a/src/ImageSharp.Drawing/Paths/FillPolygon.cs b/src/ImageSharp.Drawing/Paths/FillPolygon.cs index 6b6cef8ac..2fc481b5c 100644 --- a/src/ImageSharp.Drawing/Paths/FillPolygon.cs +++ b/src/ImageSharp.Drawing/Paths/FillPolygon.cs @@ -27,7 +27,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator FillPolygon(this IImageProcessorApplicator source, IBrush brush, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, IBrush brush, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(brush, new Polygon(new LinearLineSegment(points)), options); @@ -41,7 +41,7 @@ namespace ImageSharp /// The brush. /// The points. /// The . - public static IImageProcessorApplicator FillPolygon(this IImageProcessorApplicator source, IBrush brush, PointF[] points) + public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, IBrush brush, PointF[] points) where TPixel : struct, IPixel { return source.Fill(brush, new Polygon(new LinearLineSegment(points))); @@ -56,7 +56,7 @@ namespace ImageSharp /// The points. /// The options. /// The . - public static IImageProcessorApplicator FillPolygon(this IImageProcessorApplicator source, TPixel color, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, TPixel color, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)), options); @@ -70,7 +70,7 @@ namespace ImageSharp /// The color. /// The points. /// The . - public static IImageProcessorApplicator FillPolygon(this IImageProcessorApplicator source, TPixel color, PointF[] points) + public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, TPixel color, PointF[] points) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points))); diff --git a/src/ImageSharp.Drawing/Paths/FillRectangle.cs b/src/ImageSharp.Drawing/Paths/FillRectangle.cs index 9e475137a..22cd1ac16 100644 --- a/src/ImageSharp.Drawing/Paths/FillRectangle.cs +++ b/src/ImageSharp.Drawing/Paths/FillRectangle.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The shape. /// The options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, RectangleF shape, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(brush, new SixLabors.Shapes.RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height), options); @@ -38,7 +38,7 @@ namespace ImageSharp /// The brush. /// The shape. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, RectangleF shape) + public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, RectangleF shape) where TPixel : struct, IPixel { return source.Fill(brush, new SixLabors.Shapes.RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height)); @@ -53,7 +53,7 @@ namespace ImageSharp /// The shape. /// The options. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, RectangleF shape, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), shape, options); @@ -67,7 +67,7 @@ namespace ImageSharp /// The color. /// The shape. /// The . - public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, RectangleF shape) + public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, RectangleF shape) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), shape); diff --git a/src/ImageSharp.Drawing/Text/DrawText.Path.cs b/src/ImageSharp.Drawing/Text/DrawText.Path.cs index c109047b2..8adab652f 100644 --- a/src/ImageSharp.Drawing/Text/DrawText.Path.cs +++ b/src/ImageSharp.Drawing/Text/DrawText.Path.cs @@ -31,7 +31,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, TPixel color, IPath path) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, TPixel color, IPath path) where TPixel : struct, IPixel { return source.DrawText(text, font, color, path, TextGraphicsOptions.Default); @@ -50,7 +50,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, TPixel color, IPath path, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, TPixel color, IPath path, TextGraphicsOptions options) where TPixel : struct, IPixel { return source.DrawText(text, font, Brushes.Solid(color), null, path, options); @@ -68,7 +68,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IBrush brush, IPath path) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPath path) where TPixel : struct, IPixel { return source.DrawText(text, font, brush, path, TextGraphicsOptions.Default); @@ -87,7 +87,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IBrush brush, IPath path, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPath path, TextGraphicsOptions options) where TPixel : struct, IPixel { return source.DrawText(text, font, brush, null, path, options); @@ -105,7 +105,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IPen pen, IPath path) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IPen pen, IPath path) where TPixel : struct, IPixel { return source.DrawText(text, font, pen, path, TextGraphicsOptions.Default); @@ -124,7 +124,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IPen pen, IPath path, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IPen pen, IPath path, TextGraphicsOptions options) where TPixel : struct, IPixel { return source.DrawText(text, font, null, pen, path, options); @@ -143,7 +143,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IBrush brush, IPen pen, IPath path) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPen pen, IPath path) where TPixel : struct, IPixel { return source.DrawText(text, font, brush, pen, path, TextGraphicsOptions.Default); @@ -163,7 +163,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IBrush brush, IPen pen, IPath path, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPen pen, IPath path, TextGraphicsOptions options) where TPixel : struct, IPixel { float dpiX = DefaultTextDpi; diff --git a/src/ImageSharp.Drawing/Text/DrawText.cs b/src/ImageSharp.Drawing/Text/DrawText.cs index 338d06058..340c88d5e 100644 --- a/src/ImageSharp.Drawing/Text/DrawText.cs +++ b/src/ImageSharp.Drawing/Text/DrawText.cs @@ -34,7 +34,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, TPixel color, PointF location) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, TPixel color, PointF location) where TPixel : struct, IPixel { return source.DrawText(text, font, color, location, TextGraphicsOptions.Default); @@ -53,7 +53,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, TPixel color, PointF location, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, TPixel color, PointF location, TextGraphicsOptions options) where TPixel : struct, IPixel { return source.DrawText(text, font, Brushes.Solid(color), null, location, options); @@ -71,7 +71,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IBrush brush, PointF location) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, PointF location) where TPixel : struct, IPixel { return source.DrawText(text, font, brush, location, TextGraphicsOptions.Default); @@ -90,7 +90,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IBrush brush, PointF location, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, PointF location, TextGraphicsOptions options) where TPixel : struct, IPixel { return source.DrawText(text, font, brush, null, location, options); @@ -108,7 +108,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IPen pen, PointF location) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IPen pen, PointF location) where TPixel : struct, IPixel { return source.DrawText(text, font, pen, location, TextGraphicsOptions.Default); @@ -127,7 +127,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IPen pen, PointF location, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IPen pen, PointF location, TextGraphicsOptions options) where TPixel : struct, IPixel { return source.DrawText(text, font, null, pen, location, options); @@ -146,7 +146,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IBrush brush, IPen pen, PointF location) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPen pen, PointF location) where TPixel : struct, IPixel { return source.DrawText(text, font, brush, pen, location, TextGraphicsOptions.Default); @@ -166,7 +166,7 @@ namespace ImageSharp /// /// The . /// - public static IImageProcessorApplicator DrawText(this IImageProcessorApplicator source, string text, Font font, IBrush brush, IPen pen, PointF location, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPen pen, PointF location, TextGraphicsOptions options) where TPixel : struct, IPixel { float dpiX = DefaultTextDpi; diff --git a/src/ImageSharp/ApplyProcessors.cs b/src/ImageSharp/ApplyProcessors.cs index c0a7f20df..40cd7500a 100644 --- a/src/ImageSharp/ApplyProcessors.cs +++ b/src/ImageSharp/ApplyProcessors.cs @@ -22,13 +22,13 @@ namespace ImageSharp /// The pixel format. /// The image to rotate, flip, or both. /// The operations to perform on the source. - public static void Mutate(this Image source, Action> operations) + public static void Mutate(this Image source, Action> operations) where TPixel : struct, IPixel { Guard.NotNull(operations, nameof(operations)); Guard.NotNull(source, nameof(source)); - IInternalImageProcessorApplicator operationsRunner = source.Configuration.ImageOperationsProvider.CreateImageOperations(source, true); + IInternalImageProcessingContext operationsRunner = source.Configuration.ImageOperationsProvider.CreateImageProcessingContext(source, true); operations(operationsRunner); operationsRunner.Apply(); } @@ -45,7 +45,7 @@ namespace ImageSharp Guard.NotNull(operations, nameof(operations)); Guard.NotNull(source, nameof(source)); - IInternalImageProcessorApplicator operationsRunner = source.Configuration.ImageOperationsProvider.CreateImageOperations(source, true); + IInternalImageProcessingContext operationsRunner = source.Configuration.ImageOperationsProvider.CreateImageProcessingContext(source, true); operationsRunner.ApplyProcessors(operations); operationsRunner.Apply(); } @@ -57,13 +57,13 @@ namespace ImageSharp /// The image to rotate, flip, or both. /// The operations to perform on the source. /// Anew Image which has teh data from the but with the applied. - public static Image Clone(this Image source, Action> operations) + public static Image Clone(this Image source, Action> operations) where TPixel : struct, IPixel { Guard.NotNull(operations, nameof(operations)); Guard.NotNull(source, nameof(source)); - IInternalImageProcessorApplicator operationsRunner = source.Configuration.ImageOperationsProvider.CreateImageOperations(source, false); + IInternalImageProcessingContext operationsRunner = source.Configuration.ImageOperationsProvider.CreateImageProcessingContext(source, false); operations(operationsRunner); return operationsRunner.Apply(); } @@ -81,7 +81,7 @@ namespace ImageSharp Guard.NotNull(operations, nameof(operations)); Guard.NotNull(source, nameof(source)); - IInternalImageProcessorApplicator operationsRunner = source.Configuration.ImageOperationsProvider.CreateImageOperations(source, false); + IInternalImageProcessingContext operationsRunner = source.Configuration.ImageOperationsProvider.CreateImageProcessingContext(source, false); operationsRunner.ApplyProcessors(operations); return operationsRunner.Apply(); } @@ -93,7 +93,7 @@ namespace ImageSharp /// The image to rotate, flip, or both. /// The operations to perform on the source. /// returns the current optinoatins class to allow chaining of oprations. - public static IImageProcessorApplicator ApplyProcessors(this IImageProcessorApplicator source, params IImageProcessor[] operations) + public static IImageProcessingContext ApplyProcessors(this IImageProcessingContext source, params IImageProcessor[] operations) where TPixel : struct, IPixel { foreach (IImageProcessor p in operations) diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs index b86819430..71f6bf412 100644 --- a/src/ImageSharp/Configuration.cs +++ b/src/ImageSharp/Configuration.cs @@ -111,7 +111,7 @@ namespace ImageSharp /// /// Gets or sets the image operations providers. /// - internal IImageProcessorApplicatorFactory ImageOperationsProvider { get; set; } = new DefaultImageOperationsProvider(); + internal IImageProcessingContextFactory ImageOperationsProvider { get; set; } = new DefaultImageOperationsProvider(); /// /// Registers a new format provider. diff --git a/src/ImageSharp/DefaultInternalImageProcessorApplicator.cs b/src/ImageSharp/DefaultInternalImageProcessorContext.cs similarity index 79% rename from src/ImageSharp/DefaultInternalImageProcessorApplicator.cs rename to src/ImageSharp/DefaultInternalImageProcessorContext.cs index ba476ba33..64f444325 100644 --- a/src/ImageSharp/DefaultInternalImageProcessorApplicator.cs +++ b/src/ImageSharp/DefaultInternalImageProcessorContext.cs @@ -15,7 +15,7 @@ namespace ImageSharp /// The static collection of all the default image formats /// /// The pixel format - internal class DefaultInternalImageProcessorApplicator : IInternalImageProcessorApplicator + internal class DefaultInternalImageProcessorContext : IInternalImageProcessingContext where TPixel : struct, IPixel { private readonly bool mutate; @@ -23,11 +23,11 @@ namespace ImageSharp private Image destination; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The image. /// The mutate. - public DefaultInternalImageProcessorApplicator(Image source, bool mutate) + public DefaultInternalImageProcessorContext(Image source, bool mutate) { this.mutate = mutate; this.source = source; @@ -50,16 +50,16 @@ namespace ImageSharp } /// - public IImageProcessorApplicator ApplyProcessor(IImageProcessor processor, Rectangle rectangle) + public IImageProcessingContext ApplyProcessor(IImageProcessor processor, Rectangle rectangle) { if (!this.mutate && this.destination == null) { // this will only work if the first processor applied is the cloning one thus // realistically for this optermissation to work the resize must the first processor // applied any only up processors will take the douple data path. - if (processor is ICloningImageProcessor) + if (processor is ICloneingImageProcessor) { - var cloningProcessor = (ICloningImageProcessor)processor; + var cloningProcessor = (ICloneingImageProcessor)processor; this.destination = cloningProcessor.CloneAndApply(this.source, rectangle); return this; } @@ -74,7 +74,7 @@ namespace ImageSharp } /// - public IImageProcessorApplicator ApplyProcessor(IImageProcessor processor) + public IImageProcessingContext ApplyProcessor(IImageProcessor processor) { return this.ApplyProcessor(processor, this.source.Bounds()); } diff --git a/src/ImageSharp/IImageProcessorApplicatorFactory.cs b/src/ImageSharp/IImageProcessingContextFactory.cs similarity index 74% rename from src/ImageSharp/IImageProcessorApplicatorFactory.cs rename to src/ImageSharp/IImageProcessingContextFactory.cs index e07b1a752..a9cd23905 100644 --- a/src/ImageSharp/IImageProcessorApplicatorFactory.cs +++ b/src/ImageSharp/IImageProcessingContextFactory.cs @@ -11,7 +11,7 @@ namespace ImageSharp /// /// Represents an interface that will create IImageOperations /// - internal interface IImageProcessorApplicatorFactory + internal interface IImageProcessingContextFactory { /// /// Called during Mutate operations to generate the imageoperations provider. @@ -20,20 +20,20 @@ namespace ImageSharp /// The source image. /// A flag to determin with the image operations is allowed to mutate the source image or not. /// A new IImageOPeration - IInternalImageProcessorApplicator CreateImageOperations(Image source, bool mutate) + IInternalImageProcessingContext CreateImageProcessingContext(Image source, bool mutate) where TPixel : struct, IPixel; } /// /// The default implmentation of IImageOperationsProvider /// - internal class DefaultImageOperationsProvider : IImageProcessorApplicatorFactory + internal class DefaultImageOperationsProvider : IImageProcessingContextFactory { /// - public IInternalImageProcessorApplicator CreateImageOperations(Image source, bool mutate) + public IInternalImageProcessingContext CreateImageProcessingContext(Image source, bool mutate) where TPixel : struct, IPixel { - return new DefaultInternalImageProcessorApplicator(source, mutate); + return new DefaultInternalImageProcessorContext(source, mutate); } } } diff --git a/src/ImageSharp/IImageProcessorApplicator{TPixel}.cs b/src/ImageSharp/IImageProcessingContext{TPixel}.cs similarity index 83% rename from src/ImageSharp/IImageProcessorApplicator{TPixel}.cs rename to src/ImageSharp/IImageProcessingContext{TPixel}.cs index 861c5b010..e79b20ba6 100644 --- a/src/ImageSharp/IImageProcessorApplicator{TPixel}.cs +++ b/src/ImageSharp/IImageProcessingContext{TPixel}.cs @@ -15,7 +15,7 @@ namespace ImageSharp /// An interface to queue up image operations. /// /// The pixel format - public interface IImageProcessorApplicator + public interface IImageProcessingContext where TPixel : struct, IPixel { /// @@ -24,21 +24,21 @@ namespace ImageSharp /// The processor to apply /// The area to apply it to /// returns the current optinoatins class to allow chaining of oprations. - IImageProcessorApplicator ApplyProcessor(IImageProcessor processor, Rectangle rectangle); + IImageProcessingContext ApplyProcessor(IImageProcessor processor, Rectangle rectangle); /// /// Adds the processor to the current setr of image operations to be applied. /// /// The processor to apply /// returns the current optinoatins class to allow chaining of oprations. - IImageProcessorApplicator ApplyProcessor(IImageProcessor processor); + IImageProcessingContext ApplyProcessor(IImageProcessor processor); } /// /// An internal interface to queue up image operations and have a method to apply them to and return a result /// /// The pixel format - public interface IInternalImageProcessorApplicator : IImageProcessorApplicator + internal interface IInternalImageProcessingContext : IImageProcessingContext where TPixel : struct, IPixel { /// diff --git a/src/ImageSharp/Image/ICloningImageProcessor.cs b/src/ImageSharp/Image/ICloneingImageProcessor.cs similarity index 89% rename from src/ImageSharp/Image/ICloningImageProcessor.cs rename to src/ImageSharp/Image/ICloneingImageProcessor.cs index 8906063f9..92f87d02e 100644 --- a/src/ImageSharp/Image/ICloningImageProcessor.cs +++ b/src/ImageSharp/Image/ICloneingImageProcessor.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -15,7 +15,7 @@ namespace ImageSharp.Processing /// Encapsulates methods to alter the pixels of an image. /// /// The pixel format. - public interface ICloningImageProcessor : IImageProcessor + internal interface ICloneingImageProcessor : IImageProcessor where TPixel : struct, IPixel { /// diff --git a/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs b/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs index 796b4f597..89d62cc4c 100644 --- a/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs +++ b/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The image this method extends. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// The . - public static IImageProcessorApplicator BinaryThreshold(this IImageProcessorApplicator source, float threshold) + public static IImageProcessingContext BinaryThreshold(this IImageProcessingContext source, float threshold) where TPixel : struct, IPixel { source.ApplyProcessor(new BinaryThresholdProcessor(threshold)); @@ -41,7 +41,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator BinaryThreshold(this IImageProcessorApplicator source, float threshold, Rectangle rectangle) + public static IImageProcessingContext BinaryThreshold(this IImageProcessingContext source, float threshold, Rectangle rectangle) where TPixel : struct, IPixel { source.ApplyProcessor(new BinaryThresholdProcessor(threshold), rectangle); diff --git a/src/ImageSharp/Processing/Binarization/Dither.cs b/src/ImageSharp/Processing/Binarization/Dither.cs index 177279cea..2d9ef4263 100644 --- a/src/ImageSharp/Processing/Binarization/Dither.cs +++ b/src/ImageSharp/Processing/Binarization/Dither.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The image this method extends. /// The ordered ditherer. /// The . - public static IImageProcessorApplicator Dither(this IImageProcessorApplicator source, IOrderedDither dither) + public static IImageProcessingContext Dither(this IImageProcessingContext source, IOrderedDither dither) where TPixel : struct, IPixel { source.ApplyProcessor(new OrderedDitherProcessor(dither, 0)); @@ -39,7 +39,7 @@ namespace ImageSharp /// The ordered ditherer. /// The component index to test the threshold against. Must range from 0 to 3. /// The . - public static IImageProcessorApplicator Dither(this IImageProcessorApplicator source, IOrderedDither dither, int index) + public static IImageProcessingContext Dither(this IImageProcessingContext source, IOrderedDither dither, int index) where TPixel : struct, IPixel { source.ApplyProcessor(new OrderedDitherProcessor(dither, index)); @@ -56,7 +56,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Dither(this IImageProcessorApplicator source, IOrderedDither dither, Rectangle rectangle) + public static IImageProcessingContext Dither(this IImageProcessingContext source, IOrderedDither dither, Rectangle rectangle) where TPixel : struct, IPixel { source.ApplyProcessor(new OrderedDitherProcessor(dither, 0), rectangle); @@ -74,7 +74,7 @@ namespace ImageSharp /// /// The component index to test the threshold against. Must range from 0 to 3. /// The . - public static IImageProcessorApplicator Dither(this IImageProcessorApplicator source, IOrderedDither dither, Rectangle rectangle, int index) + public static IImageProcessingContext Dither(this IImageProcessingContext source, IOrderedDither dither, Rectangle rectangle, int index) where TPixel : struct, IPixel { source.ApplyProcessor(new OrderedDitherProcessor(dither, index), rectangle); @@ -89,7 +89,7 @@ namespace ImageSharp /// The diffusion algorithm to apply. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// The . - public static IImageProcessorApplicator Dither(this IImageProcessorApplicator source, IErrorDiffuser diffuser, float threshold) + public static IImageProcessingContext Dither(this IImageProcessingContext source, IErrorDiffuser diffuser, float threshold) where TPixel : struct, IPixel { source.ApplyProcessor(new ErrorDiffusionDitherProcessor(diffuser, threshold)); @@ -107,7 +107,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Dither(this IImageProcessorApplicator source, IErrorDiffuser diffuser, float threshold, Rectangle rectangle) + public static IImageProcessingContext Dither(this IImageProcessingContext source, IErrorDiffuser diffuser, float threshold, Rectangle rectangle) where TPixel : struct, IPixel { source.ApplyProcessor(new ErrorDiffusionDitherProcessor(diffuser, threshold), rectangle); diff --git a/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs b/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs index 3d15d1cbc..71d1d5070 100644 --- a/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs +++ b/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator BlackWhite(this IImageProcessorApplicator source) + public static IImageProcessingContext BlackWhite(this IImageProcessingContext source) where TPixel : struct, IPixel { source.ApplyProcessor(new BlackWhiteProcessor()); @@ -40,7 +40,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator BlackWhite(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext BlackWhite(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel { source.ApplyProcessor(new BlackWhiteProcessor(), rectangle); diff --git a/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs b/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs index 8a055c33c..9ba961a71 100644 --- a/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs +++ b/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The image this method extends. /// The type of color blindness simulator to apply. /// The . - public static IImageProcessorApplicator ColorBlindness(this IImageProcessorApplicator source, ColorBlindness colorBlindness) + public static IImageProcessingContext ColorBlindness(this IImageProcessingContext source, ColorBlindness colorBlindness) where TPixel : struct, IPixel { source.ApplyProcessor(GetProcessor(colorBlindness)); @@ -42,7 +42,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator ColorBlindness(this IImageProcessorApplicator source, ColorBlindness colorBlindness, Rectangle rectangle) + public static IImageProcessingContext ColorBlindness(this IImageProcessingContext source, ColorBlindness colorBlindness, Rectangle rectangle) where TPixel : struct, IPixel { source.ApplyProcessor(GetProcessor(colorBlindness), rectangle); diff --git a/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs b/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs index 7b00ae0d8..6109c5404 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs @@ -22,7 +22,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator Grayscale(this IImageProcessorApplicator source) + public static IImageProcessingContext Grayscale(this IImageProcessingContext source) where TPixel : struct, IPixel { return Grayscale(source, GrayscaleMode.Bt709); @@ -35,7 +35,7 @@ namespace ImageSharp /// The image this method extends. /// The formula to apply to perform the operation. /// The . - public static IImageProcessorApplicator Grayscale(this IImageProcessorApplicator source, GrayscaleMode mode) + public static IImageProcessingContext Grayscale(this IImageProcessingContext source, GrayscaleMode mode) where TPixel : struct, IPixel { IImageProcessor processor = mode == GrayscaleMode.Bt709 @@ -55,7 +55,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Grayscale(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext Grayscale(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel { return Grayscale(source, GrayscaleMode.Bt709, rectangle); @@ -71,7 +71,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Grayscale(this IImageProcessorApplicator source, GrayscaleMode mode, Rectangle rectangle) + public static IImageProcessingContext Grayscale(this IImageProcessingContext source, GrayscaleMode mode, Rectangle rectangle) where TPixel : struct, IPixel { IImageProcessor processor = mode == GrayscaleMode.Bt709 diff --git a/src/ImageSharp/Processing/ColorMatrix/Hue.cs b/src/ImageSharp/Processing/ColorMatrix/Hue.cs index cd2adaadb..d299b650a 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Hue.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Hue.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The image this method extends. /// The angle in degrees to adjust the image. /// The . - public static IImageProcessorApplicator Hue(this IImageProcessorApplicator source, float degrees) + public static IImageProcessingContext Hue(this IImageProcessingContext source, float degrees) where TPixel : struct, IPixel { source.ApplyProcessor(new HueProcessor(degrees)); @@ -42,7 +42,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Hue(this IImageProcessorApplicator source, float degrees, Rectangle rectangle) + public static IImageProcessingContext Hue(this IImageProcessingContext source, float degrees, Rectangle rectangle) where TPixel : struct, IPixel { source.ApplyProcessor(new HueProcessor(degrees), rectangle); diff --git a/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs b/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs index b16f241c0..c0cd7caf7 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator Kodachrome(this IImageProcessorApplicator source) + public static IImageProcessingContext Kodachrome(this IImageProcessingContext source) where TPixel : struct, IPixel { source.ApplyProcessor(new KodachromeProcessor()); @@ -40,7 +40,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Kodachrome(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext Kodachrome(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel { source.ApplyProcessor(new KodachromeProcessor(), rectangle); diff --git a/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs b/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs index 0a2f80cc4..a90551bf3 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator Lomograph(this IImageProcessorApplicator source) + public static IImageProcessingContext Lomograph(this IImageProcessingContext source) where TPixel : struct, IPixel { return Lomograph(source, GraphicsOptions.Default); @@ -39,7 +39,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Lomograph(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext Lomograph(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel { return Lomograph(source, rectangle, GraphicsOptions.Default); @@ -52,7 +52,7 @@ namespace ImageSharp /// The image this method extends. /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator Lomograph(this IImageProcessorApplicator source, GraphicsOptions options) + public static IImageProcessingContext Lomograph(this IImageProcessingContext source, GraphicsOptions options) where TPixel : struct, IPixel { source.ApplyProcessor(new LomographProcessor(options)); @@ -69,7 +69,7 @@ namespace ImageSharp /// /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator Lomograph(this IImageProcessorApplicator source, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Lomograph(this IImageProcessingContext source, Rectangle rectangle, GraphicsOptions options) where TPixel : struct, IPixel { source.ApplyProcessor(new LomographProcessor(options), rectangle); diff --git a/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs b/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs index e579a3251..b968aedfc 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator Polaroid(this IImageProcessorApplicator source) + public static IImageProcessingContext Polaroid(this IImageProcessingContext source) where TPixel : struct, IPixel { return Polaroid(source, GraphicsOptions.Default); @@ -39,7 +39,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Polaroid(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext Polaroid(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel { return Polaroid(source, rectangle, GraphicsOptions.Default); @@ -52,7 +52,7 @@ namespace ImageSharp /// The image this method extends. /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator Polaroid(this IImageProcessorApplicator source, GraphicsOptions options) + public static IImageProcessingContext Polaroid(this IImageProcessingContext source, GraphicsOptions options) where TPixel : struct, IPixel { source.ApplyProcessor(new PolaroidProcessor(options)); @@ -69,7 +69,7 @@ namespace ImageSharp /// /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator Polaroid(this IImageProcessorApplicator source, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Polaroid(this IImageProcessingContext source, Rectangle rectangle, GraphicsOptions options) where TPixel : struct, IPixel { source.ApplyProcessor(new PolaroidProcessor(options), rectangle); diff --git a/src/ImageSharp/Processing/ColorMatrix/Saturation.cs b/src/ImageSharp/Processing/ColorMatrix/Saturation.cs index 768eb97c5..895362c68 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Saturation.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Saturation.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The image this method extends. /// The new saturation of the image. Must be between -100 and 100. /// The . - public static IImageProcessorApplicator Saturation(this IImageProcessorApplicator source, int amount) + public static IImageProcessingContext Saturation(this IImageProcessingContext source, int amount) where TPixel : struct, IPixel { source.ApplyProcessor(new SaturationProcessor(amount)); @@ -42,7 +42,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Saturation(this IImageProcessorApplicator source, int amount, Rectangle rectangle) + public static IImageProcessingContext Saturation(this IImageProcessingContext source, int amount, Rectangle rectangle) where TPixel : struct, IPixel { source.ApplyProcessor(new SaturationProcessor(amount), rectangle); diff --git a/src/ImageSharp/Processing/ColorMatrix/Sepia.cs b/src/ImageSharp/Processing/ColorMatrix/Sepia.cs index 5cf64a020..4ef4db14e 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Sepia.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Sepia.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator Sepia(this IImageProcessorApplicator source) + public static IImageProcessingContext Sepia(this IImageProcessingContext source) where TPixel : struct, IPixel => source.ApplyProcessor(new SepiaProcessor()); @@ -37,7 +37,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Sepia(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext Sepia(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new SepiaProcessor(), rectangle); } diff --git a/src/ImageSharp/Processing/Convolution/BoxBlur.cs b/src/ImageSharp/Processing/Convolution/BoxBlur.cs index c25de3571..eaddfe2dc 100644 --- a/src/ImageSharp/Processing/Convolution/BoxBlur.cs +++ b/src/ImageSharp/Processing/Convolution/BoxBlur.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator BoxBlur(this IImageProcessorApplicator source) + public static IImageProcessingContext BoxBlur(this IImageProcessingContext source) where TPixel : struct, IPixel => source.ApplyProcessor(new BoxBlurProcessor(7)); @@ -34,7 +34,7 @@ namespace ImageSharp /// The image this method extends. /// The 'radius' value representing the size of the area to sample. /// The . - public static IImageProcessorApplicator BoxBlur(this IImageProcessorApplicator source, int radius) + public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius) where TPixel : struct, IPixel => source.ApplyProcessor(new BoxBlurProcessor(radius)); @@ -48,7 +48,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator BoxBlur(this IImageProcessorApplicator source, int radius, Rectangle rectangle) + public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new BoxBlurProcessor(radius), rectangle); } diff --git a/src/ImageSharp/Processing/Convolution/DetectEdges.cs b/src/ImageSharp/Processing/Convolution/DetectEdges.cs index 7ececcfe2..8721bf4f8 100644 --- a/src/ImageSharp/Processing/Convolution/DetectEdges.cs +++ b/src/ImageSharp/Processing/Convolution/DetectEdges.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator DetectEdges(this IImageProcessorApplicator source) + public static IImageProcessingContext DetectEdges(this IImageProcessingContext source) where TPixel : struct, IPixel { return DetectEdges(source, new SobelProcessor { Grayscale = true }); @@ -41,7 +41,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator DetectEdges(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel { return DetectEdges(source, rectangle, new SobelProcessor { Grayscale = true }); @@ -54,7 +54,7 @@ namespace ImageSharp /// The image this method extends. /// The filter for detecting edges. /// The . - public static IImageProcessorApplicator DetectEdges(this IImageProcessorApplicator source, EdgeDetection filter) + public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, EdgeDetection filter) where TPixel : struct, IPixel => DetectEdges(source, GetProcessor(filter, true)); @@ -66,7 +66,7 @@ namespace ImageSharp /// The filter for detecting edges. /// Whether to convert the image to Grayscale first. Defaults to true. /// The . - public static IImageProcessorApplicator DetectEdges(this IImageProcessorApplicator source, EdgeDetection filter, bool grayscale) + public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, EdgeDetection filter, bool grayscale) where TPixel : struct, IPixel => DetectEdges(source, GetProcessor(filter, grayscale)); @@ -81,7 +81,7 @@ namespace ImageSharp /// /// Whether to convert the image to Grayscale first. Defaults to true. /// The . - public static IImageProcessorApplicator DetectEdges(this IImageProcessorApplicator source, EdgeDetection filter, Rectangle rectangle, bool grayscale = true) + public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, EdgeDetection filter, Rectangle rectangle, bool grayscale = true) where TPixel : struct, IPixel => DetectEdges(source, rectangle, GetProcessor(filter, grayscale)); @@ -92,7 +92,7 @@ namespace ImageSharp /// The image this method extends. /// The filter for detecting edges. /// The . - public static IImageProcessorApplicator DetectEdges(this IImageProcessorApplicator source, IEdgeDetectorProcessor filter) + public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, IEdgeDetectorProcessor filter) where TPixel : struct, IPixel { return source.ApplyProcessor(filter); @@ -108,7 +108,7 @@ namespace ImageSharp /// /// The filter for detecting edges. /// The . - public static IImageProcessorApplicator DetectEdges(this IImageProcessorApplicator source, Rectangle rectangle, IEdgeDetectorProcessor filter) + public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, Rectangle rectangle, IEdgeDetectorProcessor filter) where TPixel : struct, IPixel { source.ApplyProcessor(filter, rectangle); diff --git a/src/ImageSharp/Processing/Convolution/GaussianBlur.cs b/src/ImageSharp/Processing/Convolution/GaussianBlur.cs index 4b1682818..1db4fd500 100644 --- a/src/ImageSharp/Processing/Convolution/GaussianBlur.cs +++ b/src/ImageSharp/Processing/Convolution/GaussianBlur.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator GaussianBlur(this IImageProcessorApplicator source) + public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source) where TPixel : struct, IPixel => source.ApplyProcessor(new GaussianBlurProcessor(3f)); @@ -35,7 +35,7 @@ namespace ImageSharp /// The image this method extends. /// The 'sigma' value representing the weight of the blur. /// The . - public static IImageProcessorApplicator GaussianBlur(this IImageProcessorApplicator source, float sigma) + public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma) where TPixel : struct, IPixel => source.ApplyProcessor(new GaussianBlurProcessor(sigma)); @@ -49,7 +49,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator GaussianBlur(this IImageProcessorApplicator source, float sigma, Rectangle rectangle) + public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new GaussianBlurProcessor(sigma), rectangle); } diff --git a/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs b/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs index 8c8ac6ed2..5f66f1771 100644 --- a/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs +++ b/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator GaussianSharpen(this IImageProcessorApplicator source) + public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source) where TPixel : struct, IPixel => source.ApplyProcessor(new GaussianSharpenProcessor(3f)); @@ -35,7 +35,7 @@ namespace ImageSharp /// The image this method extends. /// The 'sigma' value representing the weight of the blur. /// The . - public static IImageProcessorApplicator GaussianSharpen(this IImageProcessorApplicator source, float sigma) + public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source, float sigma) where TPixel : struct, IPixel => source.ApplyProcessor(new GaussianSharpenProcessor(sigma)); @@ -49,7 +49,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator GaussianSharpen(this IImageProcessorApplicator source, float sigma, Rectangle rectangle) + public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source, float sigma, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new GaussianSharpenProcessor(sigma), rectangle); } diff --git a/src/ImageSharp/Processing/Delegate.cs b/src/ImageSharp/Processing/Delegate.cs index a5647d69e..733c4d090 100644 --- a/src/ImageSharp/Processing/Delegate.cs +++ b/src/ImageSharp/Processing/Delegate.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The image to rotate, flip, or both. /// The operations to perform on the source. /// returns the current optinoatins class to allow chaining of oprations. - public static IImageProcessorApplicator Run(this IImageProcessorApplicator source, Action> operation) + public static IImageProcessingContext Run(this IImageProcessingContext source, Action> operation) where TPixel : struct, IPixel => source.ApplyProcessor(new DelegateProcessor(operation)); } diff --git a/src/ImageSharp/Processing/Effects/Alpha.cs b/src/ImageSharp/Processing/Effects/Alpha.cs index b49a697da..2081c91bd 100644 --- a/src/ImageSharp/Processing/Effects/Alpha.cs +++ b/src/ImageSharp/Processing/Effects/Alpha.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The image this method extends. /// The new opacity of the image. Must be between 0 and 1. /// The . - public static IImageProcessorApplicator Alpha(this IImageProcessorApplicator source, float percent) + public static IImageProcessingContext Alpha(this IImageProcessingContext source, float percent) where TPixel : struct, IPixel => source.ApplyProcessor(new AlphaProcessor(percent)); @@ -38,7 +38,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Alpha(this IImageProcessorApplicator source, float percent, Rectangle rectangle) + public static IImageProcessingContext Alpha(this IImageProcessingContext source, float percent, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new AlphaProcessor(percent), rectangle); } diff --git a/src/ImageSharp/Processing/Effects/BackgroundColor.cs b/src/ImageSharp/Processing/Effects/BackgroundColor.cs index c4754c8e6..ec9fe32d6 100644 --- a/src/ImageSharp/Processing/Effects/BackgroundColor.cs +++ b/src/ImageSharp/Processing/Effects/BackgroundColor.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The color to set as the background. /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator BackgroundColor(this IImageProcessorApplicator source, TPixel color, GraphicsOptions options) + public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, TPixel color, GraphicsOptions options) where TPixel : struct, IPixel => source.ApplyProcessor(new BackgroundColorProcessor(color, options)); @@ -40,7 +40,7 @@ namespace ImageSharp /// /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator BackgroundColor(this IImageProcessorApplicator source, TPixel color, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, TPixel color, Rectangle rectangle, GraphicsOptions options) where TPixel : struct, IPixel => source.ApplyProcessor(new BackgroundColorProcessor(color, options), rectangle); @@ -51,7 +51,7 @@ namespace ImageSharp /// The image this method extends. /// The color to set as the background. /// The . - public static IImageProcessorApplicator BackgroundColor(this IImageProcessorApplicator source, TPixel color) + public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, TPixel color) where TPixel : struct, IPixel { return BackgroundColor(source, color, GraphicsOptions.Default); @@ -67,7 +67,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator BackgroundColor(this IImageProcessorApplicator source, TPixel color, Rectangle rectangle) + public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, TPixel color, Rectangle rectangle) where TPixel : struct, IPixel { return BackgroundColor(source, color, rectangle, GraphicsOptions.Default); diff --git a/src/ImageSharp/Processing/Effects/Brightness.cs b/src/ImageSharp/Processing/Effects/Brightness.cs index 59a02d456..d9ed57612 100644 --- a/src/ImageSharp/Processing/Effects/Brightness.cs +++ b/src/ImageSharp/Processing/Effects/Brightness.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The image this method extends. /// The new brightness of the image. Must be between -100 and 100. /// The . - public static IImageProcessorApplicator Brightness(this IImageProcessorApplicator source, int amount) + public static IImageProcessingContext Brightness(this IImageProcessingContext source, int amount) where TPixel : struct, IPixel => source.ApplyProcessor(new BrightnessProcessor(amount)); @@ -38,7 +38,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Brightness(this IImageProcessorApplicator source, int amount, Rectangle rectangle) + public static IImageProcessingContext Brightness(this IImageProcessingContext source, int amount, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new BrightnessProcessor(amount), rectangle); } diff --git a/src/ImageSharp/Processing/Effects/Contrast.cs b/src/ImageSharp/Processing/Effects/Contrast.cs index e94605a75..0af86e1df 100644 --- a/src/ImageSharp/Processing/Effects/Contrast.cs +++ b/src/ImageSharp/Processing/Effects/Contrast.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The image this method extends. /// The new contrast of the image. Must be between -100 and 100. /// The . - public static IImageProcessorApplicator Contrast(this IImageProcessorApplicator source, int amount) + public static IImageProcessingContext Contrast(this IImageProcessingContext source, int amount) where TPixel : struct, IPixel => source.ApplyProcessor(new ContrastProcessor(amount)); @@ -38,7 +38,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Contrast(this IImageProcessorApplicator source, int amount, Rectangle rectangle) + public static IImageProcessingContext Contrast(this IImageProcessingContext source, int amount, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new ContrastProcessor(amount), rectangle); } diff --git a/src/ImageSharp/Processing/Effects/Invert.cs b/src/ImageSharp/Processing/Effects/Invert.cs index 5e0ceab75..cc480cf0c 100644 --- a/src/ImageSharp/Processing/Effects/Invert.cs +++ b/src/ImageSharp/Processing/Effects/Invert.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator Invert(this IImageProcessorApplicator source) + public static IImageProcessingContext Invert(this IImageProcessingContext source) where TPixel : struct, IPixel => source.ApplyProcessor(new InvertProcessor()); @@ -36,7 +36,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Invert(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext Invert(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new InvertProcessor(), rectangle); } diff --git a/src/ImageSharp/Processing/Effects/OilPainting.cs b/src/ImageSharp/Processing/Effects/OilPainting.cs index e6a8c8373..844b5ceb6 100644 --- a/src/ImageSharp/Processing/Effects/OilPainting.cs +++ b/src/ImageSharp/Processing/Effects/OilPainting.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator OilPaint(this IImageProcessorApplicator source) + public static IImageProcessingContext OilPaint(this IImageProcessingContext source) where TPixel : struct, IPixel { return OilPaint(source, 10, 15); @@ -40,7 +40,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator OilPaint(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext OilPaint(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel { return OilPaint(source, 10, 15, rectangle); @@ -54,7 +54,7 @@ namespace ImageSharp /// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image. /// The number of neighboring pixels used in calculating each individual pixel value. /// The . - public static IImageProcessorApplicator OilPaint(this IImageProcessorApplicator source, int levels, int brushSize) + public static IImageProcessingContext OilPaint(this IImageProcessingContext source, int levels, int brushSize) where TPixel : struct, IPixel => source.ApplyProcessor(new OilPaintingProcessor(levels, brushSize)); @@ -69,7 +69,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator OilPaint(this IImageProcessorApplicator source, int levels, int brushSize, Rectangle rectangle) + public static IImageProcessingContext OilPaint(this IImageProcessingContext source, int levels, int brushSize, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new OilPaintingProcessor(levels, brushSize), rectangle); } diff --git a/src/ImageSharp/Processing/Effects/Pixelate.cs b/src/ImageSharp/Processing/Effects/Pixelate.cs index c1e631838..3ae152c2b 100644 --- a/src/ImageSharp/Processing/Effects/Pixelate.cs +++ b/src/ImageSharp/Processing/Effects/Pixelate.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator Pixelate(this IImageProcessorApplicator source) + public static IImageProcessingContext Pixelate(this IImageProcessingContext source) where TPixel : struct, IPixel => source.ApplyProcessor(new PixelateProcessor(4)); @@ -34,7 +34,7 @@ namespace ImageSharp /// The image this method extends. /// The size of the pixels. /// The . - public static IImageProcessorApplicator Pixelate(this IImageProcessorApplicator source, int size) + public static IImageProcessingContext Pixelate(this IImageProcessingContext source, int size) where TPixel : struct, IPixel => source.ApplyProcessor(new PixelateProcessor(size)); @@ -48,7 +48,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Pixelate(this IImageProcessorApplicator source, int size, Rectangle rectangle) + public static IImageProcessingContext Pixelate(this IImageProcessingContext source, int size, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new PixelateProcessor(size), rectangle); } diff --git a/src/ImageSharp/Processing/Overlays/Glow.cs b/src/ImageSharp/Processing/Overlays/Glow.cs index 30ff66692..e34cbf591 100644 --- a/src/ImageSharp/Processing/Overlays/Glow.cs +++ b/src/ImageSharp/Processing/Overlays/Glow.cs @@ -21,7 +21,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source) + public static IImageProcessingContext Glow(this IImageProcessingContext source) where TPixel : struct, IPixel { return Glow(source, GraphicsOptions.Default); @@ -34,7 +34,7 @@ namespace ImageSharp /// The image this method extends. /// The color to set as the glow. /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, TPixel color) + public static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color) where TPixel : struct, IPixel { return Glow(source, color, GraphicsOptions.Default); @@ -47,7 +47,7 @@ namespace ImageSharp /// The image this method extends. /// The the radius. /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, float radius) + public static IImageProcessingContext Glow(this IImageProcessingContext source, float radius) where TPixel : struct, IPixel { return Glow(source, radius, GraphicsOptions.Default); @@ -62,7 +62,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext Glow(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel => source.Glow(rectangle, GraphicsOptions.Default); @@ -77,7 +77,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, TPixel color, float radius, Rectangle rectangle) + public static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, float radius, Rectangle rectangle) where TPixel : struct, IPixel => source.Glow(color, ValueSize.Absolute(radius), rectangle, GraphicsOptions.Default); @@ -88,7 +88,7 @@ namespace ImageSharp /// The image this method extends. /// The options effecting things like blending. /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, GraphicsOptions options) + public static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options) where TPixel : struct, IPixel => source.Glow(NamedColors.Black, ValueSize.PercentageOfWidth(0.5f), options); @@ -100,7 +100,7 @@ namespace ImageSharp /// The color to set as the glow. /// The options effecting things like blending. /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, TPixel color, GraphicsOptions options) + public static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, GraphicsOptions options) where TPixel : struct, IPixel => source.Glow(color, ValueSize.PercentageOfWidth(0.5f), options); @@ -112,7 +112,7 @@ namespace ImageSharp /// The the radius. /// The options effecting things like blending. /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, float radius, GraphicsOptions options) + public static IImageProcessingContext Glow(this IImageProcessingContext source, float radius, GraphicsOptions options) where TPixel : struct, IPixel => source.Glow(NamedColors.Black, ValueSize.Absolute(radius), options); @@ -126,7 +126,7 @@ namespace ImageSharp /// /// The options effecting things like blending. /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Glow(this IImageProcessingContext source, Rectangle rectangle, GraphicsOptions options) where TPixel : struct, IPixel => source.Glow(NamedColors.Black, ValueSize.PercentageOfWidth(0.5f), rectangle, options); @@ -142,7 +142,7 @@ namespace ImageSharp /// /// The options effecting things like blending. /// The . - public static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, TPixel color, float radius, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, float radius, Rectangle rectangle, GraphicsOptions options) where TPixel : struct, IPixel => source.Glow(color, ValueSize.Absolute(radius), rectangle, options); @@ -158,7 +158,7 @@ namespace ImageSharp /// /// The options effecting things like blending. /// The . - private static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, TPixel color, ValueSize radius, Rectangle rectangle, GraphicsOptions options) + private static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, ValueSize radius, Rectangle rectangle, GraphicsOptions options) where TPixel : struct, IPixel => source.ApplyProcessor(new GlowProcessor(color, radius, options), rectangle); @@ -171,7 +171,7 @@ namespace ImageSharp /// The the radius. /// The options effecting things like blending. /// The . - private static IImageProcessorApplicator Glow(this IImageProcessorApplicator source, TPixel color, ValueSize radius, GraphicsOptions options) + private static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, ValueSize radius, GraphicsOptions options) where TPixel : struct, IPixel => source.ApplyProcessor(new GlowProcessor(color, radius, options)); } diff --git a/src/ImageSharp/Processing/Overlays/Vignette.cs b/src/ImageSharp/Processing/Overlays/Vignette.cs index 81cd773b2..f0c962627 100644 --- a/src/ImageSharp/Processing/Overlays/Vignette.cs +++ b/src/ImageSharp/Processing/Overlays/Vignette.cs @@ -21,7 +21,7 @@ namespace ImageSharp /// The pixel format. /// The image this method extends. /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source) + public static IImageProcessingContext Vignette(this IImageProcessingContext source) where TPixel : struct, IPixel { return Vignette(source, GraphicsOptions.Default); @@ -34,7 +34,7 @@ namespace ImageSharp /// The image this method extends. /// The color to set as the vignette. /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source, TPixel color) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, TPixel color) where TPixel : struct, IPixel { return Vignette(source, color, GraphicsOptions.Default); @@ -48,7 +48,7 @@ namespace ImageSharp /// The the x-radius. /// The the y-radius. /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source, float radiusX, float radiusY) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, float radiusX, float radiusY) where TPixel : struct, IPixel { return Vignette(source, radiusX, radiusY, GraphicsOptions.Default); @@ -63,7 +63,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source, Rectangle rectangle) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel { return Vignette(source, rectangle, GraphicsOptions.Default); @@ -81,7 +81,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source, TPixel color, float radiusX, float radiusY, Rectangle rectangle) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, TPixel color, float radiusX, float radiusY, Rectangle rectangle) where TPixel : struct, IPixel => source.Vignette(color, radiusX, radiusY, rectangle, GraphicsOptions.Default); @@ -92,7 +92,7 @@ namespace ImageSharp /// The image this method extends. /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source, GraphicsOptions options) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, GraphicsOptions options) where TPixel : struct, IPixel => source.VignetteInternal(NamedColors.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options); @@ -104,7 +104,7 @@ namespace ImageSharp /// The color to set as the vignette. /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source, TPixel color, GraphicsOptions options) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, TPixel color, GraphicsOptions options) where TPixel : struct, IPixel => source.VignetteInternal(color, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options); @@ -117,7 +117,7 @@ namespace ImageSharp /// The the y-radius. /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source, float radiusX, float radiusY, GraphicsOptions options) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, float radiusX, float radiusY, GraphicsOptions options) where TPixel : struct, IPixel => source.VignetteInternal(NamedColors.Black, radiusX, radiusY, options); @@ -131,7 +131,7 @@ namespace ImageSharp /// /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, Rectangle rectangle, GraphicsOptions options) where TPixel : struct, IPixel => source.VignetteInternal(NamedColors.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), rectangle, options); @@ -148,15 +148,15 @@ namespace ImageSharp /// /// The options effecting pixel blending. /// The . - public static IImageProcessorApplicator Vignette(this IImageProcessorApplicator source, TPixel color, float radiusX, float radiusY, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, TPixel color, float radiusX, float radiusY, Rectangle rectangle, GraphicsOptions options) where TPixel : struct, IPixel => source.VignetteInternal(color, radiusX, radiusY, rectangle, options); - private static IImageProcessorApplicator VignetteInternal(this IImageProcessorApplicator source, TPixel color, ValueSize radiusX, ValueSize radiusY, Rectangle rectangle, GraphicsOptions options) + private static IImageProcessingContext VignetteInternal(this IImageProcessingContext source, TPixel color, ValueSize radiusX, ValueSize radiusY, Rectangle rectangle, GraphicsOptions options) where TPixel : struct, IPixel => source.ApplyProcessor(new VignetteProcessor(color, radiusX, radiusY, options), rectangle); - private static IImageProcessorApplicator VignetteInternal(this IImageProcessorApplicator source, TPixel color, ValueSize radiusX, ValueSize radiusY, GraphicsOptions options) + private static IImageProcessingContext VignetteInternal(this IImageProcessingContext source, TPixel color, ValueSize radiusX, ValueSize radiusY, GraphicsOptions options) where TPixel : struct, IPixel => source.ApplyProcessor(new VignetteProcessor(color, radiusX, radiusY, options)); } diff --git a/src/ImageSharp/Processing/Processors/CLoneingImageProcessor.cs b/src/ImageSharp/Processing/Processors/CLoneingImageProcessor.cs index 0b6dbd3ed..a95e466ab 100644 --- a/src/ImageSharp/Processing/Processors/CLoneingImageProcessor.cs +++ b/src/ImageSharp/Processing/Processors/CLoneingImageProcessor.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Processing /// Allows the application of processors to images. /// /// The pixel format. - internal abstract class CloneingImageProcessor : IImageProcessor, ICloningImageProcessor + internal abstract class CloneingImageProcessor : IImageProcessor, ICloneingImageProcessor where TPixel : struct, IPixel { /// diff --git a/src/ImageSharp/Processing/Transforms/AutoOrient.cs b/src/ImageSharp/Processing/Transforms/AutoOrient.cs index f741e41b1..f01fbef3d 100644 --- a/src/ImageSharp/Processing/Transforms/AutoOrient.cs +++ b/src/ImageSharp/Processing/Transforms/AutoOrient.cs @@ -21,7 +21,7 @@ namespace ImageSharp /// The pixel format. /// The image to auto rotate. /// The - public static IImageProcessorApplicator AutoOrient(this IImageProcessorApplicator source) + public static IImageProcessingContext AutoOrient(this IImageProcessingContext source) where TPixel : struct, IPixel => source.ApplyProcessor(new Processing.Processors.AutoRotateProcessor()); } diff --git a/src/ImageSharp/Processing/Transforms/Crop.cs b/src/ImageSharp/Processing/Transforms/Crop.cs index aad80fa0f..6a8b02d02 100644 --- a/src/ImageSharp/Processing/Transforms/Crop.cs +++ b/src/ImageSharp/Processing/Transforms/Crop.cs @@ -25,7 +25,7 @@ namespace ImageSharp /// The target image width. /// The target image height. /// The - public static IImageProcessorApplicator Crop(this IImageProcessorApplicator source, int width, int height) + public static IImageProcessingContext Crop(this IImageProcessingContext source, int width, int height) where TPixel : struct, IPixel => Crop(source, new Rectangle(0, 0, width, height)); @@ -38,7 +38,7 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to retain. /// /// The - public static IImageProcessorApplicator Crop(this IImageProcessorApplicator source, Rectangle cropRectangle) + public static IImageProcessingContext Crop(this IImageProcessingContext source, Rectangle cropRectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new CropProcessor(cropRectangle)); } diff --git a/src/ImageSharp/Processing/Transforms/EntropyCrop.cs b/src/ImageSharp/Processing/Transforms/EntropyCrop.cs index a0704619c..8c5f32dd0 100644 --- a/src/ImageSharp/Processing/Transforms/EntropyCrop.cs +++ b/src/ImageSharp/Processing/Transforms/EntropyCrop.cs @@ -23,7 +23,7 @@ namespace ImageSharp /// The image to crop. /// The threshold for entropic density. /// The - public static IImageProcessorApplicator EntropyCrop(this IImageProcessorApplicator source, float threshold = .5f) + public static IImageProcessingContext EntropyCrop(this IImageProcessingContext source, float threshold = .5f) where TPixel : struct, IPixel => source.ApplyProcessor(new EntropyCropProcessor(threshold)); } diff --git a/src/ImageSharp/Processing/Transforms/Flip.cs b/src/ImageSharp/Processing/Transforms/Flip.cs index 2f20c3bd8..071662ae6 100644 --- a/src/ImageSharp/Processing/Transforms/Flip.cs +++ b/src/ImageSharp/Processing/Transforms/Flip.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The image to rotate, flip, or both. /// The to perform the flip. /// The - public static IImageProcessorApplicator Flip(this IImageProcessorApplicator source, FlipType flipType) + public static IImageProcessingContext Flip(this IImageProcessingContext source, FlipType flipType) where TPixel : struct, IPixel => source.ApplyProcessor(new FlipProcessor(flipType)); } diff --git a/src/ImageSharp/Processing/Transforms/Pad.cs b/src/ImageSharp/Processing/Transforms/Pad.cs index 90a9e281b..40fd6da6e 100644 --- a/src/ImageSharp/Processing/Transforms/Pad.cs +++ b/src/ImageSharp/Processing/Transforms/Pad.cs @@ -26,7 +26,7 @@ namespace ImageSharp /// The new width. /// The new height. /// The . - public static IImageProcessorApplicator Pad(this IImageProcessorApplicator source, int width, int height) + public static IImageProcessingContext Pad(this IImageProcessingContext source, int width, int height) where TPixel : struct, IPixel { ResizeOptions options = new ResizeOptions diff --git a/src/ImageSharp/Processing/Transforms/Resize.cs b/src/ImageSharp/Processing/Transforms/Resize.cs index 4c04991c0..c73581a93 100644 --- a/src/ImageSharp/Processing/Transforms/Resize.cs +++ b/src/ImageSharp/Processing/Transforms/Resize.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The resize options. /// The /// Passing zero for one of height or width within the resize options will automatically preserve the aspect ratio of the original image - public static IImageProcessorApplicator Resize(this IImageProcessorApplicator source, ResizeOptions options) + public static IImageProcessingContext Resize(this IImageProcessingContext source, ResizeOptions options) where TPixel : struct, IPixel { return source.Run(img => @@ -56,7 +56,7 @@ namespace ImageSharp /// The target image size. /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static IImageProcessorApplicator Resize(this IImageProcessorApplicator source, Size size) + public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size) where TPixel : struct, IPixel { return Resize(source, size.Width, size.Height, new BicubicResampler(), false); @@ -71,7 +71,7 @@ namespace ImageSharp /// Whether to compress and expand the image color-space to gamma correct the image during processing. /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static IImageProcessorApplicator Resize(this IImageProcessorApplicator source, Size size, bool compand) + public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size, bool compand) where TPixel : struct, IPixel { return Resize(source, size.Width, size.Height, new BicubicResampler(), compand); @@ -86,7 +86,7 @@ namespace ImageSharp /// The target image height. /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static IImageProcessorApplicator Resize(this IImageProcessorApplicator source, int width, int height) + public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height) where TPixel : struct, IPixel { return Resize(source, width, height, new BicubicResampler(), false); @@ -102,7 +102,7 @@ namespace ImageSharp /// Whether to compress and expand the image color-space to gamma correct the image during processing. /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static IImageProcessorApplicator Resize(this IImageProcessorApplicator source, int width, int height, bool compand) + public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, bool compand) where TPixel : struct, IPixel { return Resize(source, width, height, new BicubicResampler(), compand); @@ -118,7 +118,7 @@ namespace ImageSharp /// The to perform the resampling. /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static IImageProcessorApplicator Resize(this IImageProcessorApplicator source, int width, int height, IResampler sampler) + public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler) where TPixel : struct, IPixel { return Resize(source, width, height, sampler, false); @@ -135,7 +135,7 @@ namespace ImageSharp /// Whether to compress and expand the image color-space to gamma correct the image during processing. /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static IImageProcessorApplicator Resize(this IImageProcessorApplicator source, int width, int height, IResampler sampler, bool compand) + public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, bool compand) where TPixel : struct, IPixel { return Resize(source, width, height, sampler, new Rectangle(0, 0, width, height), compand); @@ -159,7 +159,7 @@ namespace ImageSharp /// Whether to compress and expand the image color-space to gamma correct the image during processing. /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static IImageProcessorApplicator Resize(this IImageProcessorApplicator source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle, bool compand) + public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle, bool compand) where TPixel : struct, IPixel { return source.Run(img => @@ -199,7 +199,7 @@ namespace ImageSharp /// Whether to compress and expand the image color-space to gamma correct the image during processing. /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static IImageProcessorApplicator Resize(this IImageProcessorApplicator source, int width, int height, IResampler sampler, Rectangle targetRectangle, bool compand) + public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, Rectangle targetRectangle, bool compand) where TPixel : struct, IPixel { return source.Run(img => diff --git a/src/ImageSharp/Processing/Transforms/Rotate.cs b/src/ImageSharp/Processing/Transforms/Rotate.cs index 08ac44dad..435efa30f 100644 --- a/src/ImageSharp/Processing/Transforms/Rotate.cs +++ b/src/ImageSharp/Processing/Transforms/Rotate.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The image to rotate. /// The angle in degrees to perform the rotation. /// The - public static IImageProcessorApplicator Rotate(this IImageProcessorApplicator source, float degrees) + public static IImageProcessingContext Rotate(this IImageProcessingContext source, float degrees) where TPixel : struct, IPixel { return Rotate(source, degrees, true); @@ -37,7 +37,7 @@ namespace ImageSharp /// The image to rotate. /// The to perform the rotation. /// The - public static IImageProcessorApplicator Rotate(this IImageProcessorApplicator source, RotateType rotateType) + public static IImageProcessingContext Rotate(this IImageProcessingContext source, RotateType rotateType) where TPixel : struct, IPixel => Rotate(source, (float)rotateType, false); @@ -49,7 +49,7 @@ namespace ImageSharp /// The angle in degrees to perform the rotation. /// Whether to expand the image to fit the rotated result. /// The - public static IImageProcessorApplicator Rotate(this IImageProcessorApplicator source, float degrees, bool expand) + public static IImageProcessingContext Rotate(this IImageProcessingContext source, float degrees, bool expand) where TPixel : struct, IPixel => source.ApplyProcessor(new RotateProcessor { Angle = degrees, Expand = expand }); } diff --git a/src/ImageSharp/Processing/Transforms/RotateFlip.cs b/src/ImageSharp/Processing/Transforms/RotateFlip.cs index 2c321358e..83edba0f9 100644 --- a/src/ImageSharp/Processing/Transforms/RotateFlip.cs +++ b/src/ImageSharp/Processing/Transforms/RotateFlip.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The to perform the rotation. /// The to perform the flip. /// The - public static IImageProcessorApplicator RotateFlip(this IImageProcessorApplicator source, RotateType rotateType, FlipType flipType) + public static IImageProcessingContext RotateFlip(this IImageProcessingContext source, RotateType rotateType, FlipType flipType) where TPixel : struct, IPixel { return source.Rotate(rotateType).Flip(flipType); diff --git a/src/ImageSharp/Processing/Transforms/Skew.cs b/src/ImageSharp/Processing/Transforms/Skew.cs index 8fde7270d..5f7853f05 100644 --- a/src/ImageSharp/Processing/Transforms/Skew.cs +++ b/src/ImageSharp/Processing/Transforms/Skew.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The angle in degrees to perform the rotation along the x-axis. /// The angle in degrees to perform the rotation along the y-axis. /// The - public static IImageProcessorApplicator Skew(this IImageProcessorApplicator source, float degreesX, float degreesY) + public static IImageProcessingContext Skew(this IImageProcessingContext source, float degreesX, float degreesY) where TPixel : struct, IPixel { return Skew(source, degreesX, degreesY, true); @@ -39,7 +39,7 @@ namespace ImageSharp /// The angle in degrees to perform the rotation along the y-axis. /// Whether to expand the image to fit the skewed result. /// The - public static IImageProcessorApplicator Skew(this IImageProcessorApplicator source, float degreesX, float degreesY, bool expand) + public static IImageProcessingContext Skew(this IImageProcessingContext source, float degreesX, float degreesY, bool expand) where TPixel : struct, IPixel => source.ApplyProcessor(new SkewProcessor { AngleX = degreesX, AngleY = degreesY, Expand = expand }); } diff --git a/src/ImageSharp/Quantizers/Quantize.cs b/src/ImageSharp/Quantizers/Quantize.cs index 54c57b508..0edc1557a 100644 --- a/src/ImageSharp/Quantizers/Quantize.cs +++ b/src/ImageSharp/Quantizers/Quantize.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// The quantization mode to apply to perform the operation. /// The maximum number of colors to return. Defaults to 256. /// The . - public static IImageProcessorApplicator Quantize(this IImageProcessorApplicator source, Quantization mode = Quantization.Octree, int maxColors = 256) + public static IImageProcessingContext Quantize(this IImageProcessingContext source, Quantization mode = Quantization.Octree, int maxColors = 256) where TPixel : struct, IPixel { IQuantizer quantizer; @@ -54,7 +54,7 @@ namespace ImageSharp /// The quantizer to apply to perform the operation. /// The maximum number of colors to return. /// The . - public static IImageProcessorApplicator Quantize(this IImageProcessorApplicator source, IQuantizer quantizer, int maxColors) + public static IImageProcessingContext Quantize(this IImageProcessingContext source, IQuantizer quantizer, int maxColors) where TPixel : struct, IPixel { return source.Run(img => diff --git a/tests/ImageSharp.Tests/BaseImageOperationsExtensionTest.cs b/tests/ImageSharp.Tests/BaseImageOperationsExtensionTest.cs index 997215ce2..f2afe2f4f 100644 --- a/tests/ImageSharp.Tests/BaseImageOperationsExtensionTest.cs +++ b/tests/ImageSharp.Tests/BaseImageOperationsExtensionTest.cs @@ -9,7 +9,8 @@ namespace ImageSharp.Tests { public abstract class BaseImageOperationsExtensionTest { - protected readonly FakeImageOperationsProvider.FakeImageOperations operations; + protected readonly IImageProcessingContext operations; + private readonly FakeImageOperationsProvider.FakeImageOperations internalOperations; protected readonly Rectangle rect; protected readonly GraphicsOptions options; @@ -17,23 +18,24 @@ namespace ImageSharp.Tests { this.options = new GraphicsOptions(false) { }; this.rect = new Rectangle(91, 123, 324, 56); // make this random? - this.operations = new FakeImageOperationsProvider.FakeImageOperations(null, false); + this.internalOperations = new FakeImageOperationsProvider.FakeImageOperations(null, false); + this.operations = this.internalOperations; } public T Verify(int index = 0) { - Assert.InRange(index, 0, this.operations.applied.Count - 1); + Assert.InRange(index, 0, this.internalOperations.applied.Count - 1); - var operation = this.operations.applied[index]; + var operation = this.internalOperations.applied[index]; return Assert.IsType(operation.Processor); } public T Verify(Rectangle rect, int index = 0) { - Assert.InRange(index, 0, this.operations.applied.Count - 1); + Assert.InRange(index, 0, this.internalOperations.applied.Count - 1); - var operation = this.operations.applied[index]; + var operation = this.internalOperations.applied[index]; Assert.Equal(rect, operation.Rectangle); return Assert.IsType(operation.Processor); diff --git a/tests/ImageSharp.Tests/FakeImageOperationsProvider.cs b/tests/ImageSharp.Tests/FakeImageOperationsProvider.cs index e06b918af..1c6fec0a4 100644 --- a/tests/ImageSharp.Tests/FakeImageOperationsProvider.cs +++ b/tests/ImageSharp.Tests/FakeImageOperationsProvider.cs @@ -8,7 +8,7 @@ using ImageSharp.Processing; using SixLabors.Primitives; - public class FakeImageOperationsProvider : IImageProcessorApplicatorFactory + internal class FakeImageOperationsProvider : IImageProcessingContextFactory { private List ImageOperators = new List(); @@ -29,7 +29,7 @@ .SelectMany(x => x.applied); } - public IInternalImageProcessorApplicator CreateImageOperations(Image source, bool mutate) where TPixel : struct, IPixel + public IInternalImageProcessingContext CreateImageProcessingContext(Image source, bool mutate) where TPixel : struct, IPixel { var op = new FakeImageOperations(source, mutate); this.ImageOperators.Add(op); @@ -37,7 +37,7 @@ } - public class FakeImageOperations : IInternalImageProcessorApplicator + public class FakeImageOperations : IInternalImageProcessingContext where TPixel : struct, IPixel { public Image source; @@ -63,7 +63,7 @@ return source; } - public IImageProcessorApplicator ApplyProcessor(IImageProcessor processor, Rectangle rectangle) + public IImageProcessingContext ApplyProcessor(IImageProcessor processor, Rectangle rectangle) { applied.Add(new AppliedOpperation { @@ -73,7 +73,7 @@ return this; } - public IImageProcessorApplicator ApplyProcessor(IImageProcessor processor) + public IImageProcessingContext ApplyProcessor(IImageProcessor processor) { applied.Add(new AppliedOpperation { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index ae10bf9af..8681bb334 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -85,7 +85,7 @@ namespace ImageSharp.Tests /// /// Returns an instance to the test case with the necessary traits. /// - public Image GetImage(Action> operationsToApply) + public Image GetImage(Action> operationsToApply) { var img = GetImage(); img.Mutate(operationsToApply);