diff --git a/samples/AvatarWithRoundedCorner/Program.cs b/samples/AvatarWithRoundedCorner/Program.cs
index b164c8d3bc..45fe1e3c86 100644
--- a/samples/AvatarWithRoundedCorner/Program.cs
+++ b/samples/AvatarWithRoundedCorner/Program.cs
@@ -23,13 +23,14 @@ namespace AvatarWithRoundedCorner
{
using (var image = Image.Load(source))
{
- image.Resize(new ImageSharp.Processing.ResizeOptions
- {
- Size = size,
- Mode = ImageSharp.Processing.ResizeMode.Crop
- });
+ image.Mutate(x => x
+ .Resize(new ImageSharp.Processing.ResizeOptions
+ {
+ Size = size,
+ Mode = ImageSharp.Processing.ResizeMode.Crop
+ })
+ .Run(i=>ApplyRoundedCourners(i, cornerRadius)));
- ApplyRoundedCourners(image, cornerRadius);
image.Save(destination);
}
}
@@ -38,10 +39,10 @@ namespace AvatarWithRoundedCorner
{
var corners = BuildCorners(img.Width, img.Height, cornerRadius);
// now we have our corners time to draw them
- img.Fill(Rgba32.Transparent, corners, new GraphicsOptions(true)
+ img.Mutate(x => x.Fill(Rgba32.Transparent, corners, new GraphicsOptions(true)
{
BlenderMode = ImageSharp.PixelFormats.PixelBlenderMode.Src // enforces that any part of this shape that has color is punched out of the background
- });
+ }));
}
public static IPathCollection BuildCorners(int imageWidth, int imageHeight, float cornerRadius)
diff --git a/src/ImageSharp.Drawing/DrawImage.cs b/src/ImageSharp.Drawing/DrawImage.cs
index 03eb7be289..bd51e4ac0a 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 Image DrawImage(this Image source, Image image, Size size, Point location, GraphicsOptions options)
+ public static IImageOperations DrawImage(this IImageOperations source, Image image, Size size, Point location, GraphicsOptions options)
where TPixel : struct, IPixel
{
if (size == default(Size))
@@ -37,7 +37,7 @@ namespace ImageSharp
location = Point.Empty;
}
- source.ApplyProcessor(new DrawImageProcessor(image, size, location, options), source.Bounds);
+ source.ApplyProcessor(new DrawImageProcessor(image, size, location, options));
return source;
}
@@ -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 Image Blend(this Image source, Image image, float percent)
+ public static IImageOperations Blend(this IImageOperations 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 Image Blend(this Image source, Image image, PixelBlenderMode blender, float percent)
+ public static IImageOperations Blend(this IImageOperations 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 Image Blend(this Image source, Image image, GraphicsOptions options)
+ public static IImageOperations Blend(this IImageOperations 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 Image DrawImage(this Image source, Image image, float percent, Size size, Point location)
+ public static IImageOperations DrawImage(this IImageOperations 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 Image DrawImage(this Image source, Image image, PixelBlenderMode blender, float percent, Size size, Point location)
+ public static IImageOperations DrawImage(this IImageOperations 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 b3ee2ed996..d8bb78e906 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 Image Fill(this Image source, IBrush brush, GraphicsOptions options)
+ public static IImageOperations Fill(this IImageOperations source, IBrush brush, GraphicsOptions options)
where TPixel : struct, IPixel
{
return source.Apply(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 Image Fill(this Image source, IBrush brush)
+ public static IImageOperations Fill(this IImageOperations 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 Image Fill(this Image source, TPixel color)
+ public static IImageOperations Fill(this IImageOperations 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 Image Fill(this Image source, IBrush brush, Region region, GraphicsOptions options)
+ public static IImageOperations Fill(this IImageOperations source, IBrush brush, Region region, GraphicsOptions options)
where TPixel : struct, IPixel
{
return source.Apply(new FillRegionProcessor(brush, region, options));
@@ -78,7 +78,7 @@ namespace ImageSharp
/// The brush.
/// The region.
/// The .
- public static Image Fill(this Image source, IBrush brush, Region region)
+ public static IImageOperations Fill(this IImageOperations 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 Image Fill(this Image source, TPixel color, Region region, GraphicsOptions options)
+ public static IImageOperations Fill(this IImageOperations 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 Image Fill(this Image source, TPixel color, Region region)
+ public static IImageOperations Fill(this IImageOperations 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 59bcf40363..d332f1d05a 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 Image DrawBeziers(this Image source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options)
+ public static IImageOperations DrawBeziers(this IImageOperations 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 Image DrawBeziers(this Image source, IBrush brush, float thickness, PointF[] points)
+ public static IImageOperations DrawBeziers(this IImageOperations 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 Image DrawBeziers(this Image source, TPixel color, float thickness, PointF[] points)
+ public static IImageOperations DrawBeziers(this IImageOperations 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 Image DrawBeziers(this Image source, TPixel color, float thickness, PointF[] points, GraphicsOptions options)
+ public static IImageOperations DrawBeziers(this IImageOperations 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 Image DrawBeziers(this Image source, IPen pen, PointF[] points, GraphicsOptions options)
+ public static IImageOperations DrawBeziers(this IImageOperations 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 Image DrawBeziers(this Image source, IPen pen, PointF[] points)
+ public static IImageOperations DrawBeziers(this IImageOperations 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 3ce0dc4da6..db1e46af8a 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 Image DrawLines(this Image source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options)
+ public static IImageOperations DrawLines(this IImageOperations 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 Image DrawLines(this Image source, IBrush brush, float thickness, PointF[] points)
+ public static IImageOperations DrawLines(this IImageOperations 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 Image DrawLines(this Image source, TPixel color, float thickness, PointF[] points)
+ public static IImageOperations DrawLines(this IImageOperations 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 Image DrawLines(this Image source, TPixel color, float thickness, PointF[] points, GraphicsOptions options)
+ public static IImageOperations DrawLines(this IImageOperations 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 Image DrawLines(this Image source, IPen pen, PointF[] points, GraphicsOptions options)
+ public static IImageOperations DrawLines(this IImageOperations 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 Image DrawLines(this Image source, IPen pen, PointF[] points)
+ public static IImageOperations DrawLines(this IImageOperations 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 1fba06370d..57ce2032a9 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 Image Draw(this Image source, IPen pen, IPath path, GraphicsOptions options)
+ public static IImageOperations Draw(this IImageOperations 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 Image Draw(this Image source, IPen pen, IPath path)
+ public static IImageOperations Draw(this IImageOperations 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 Image Draw(this Image source, IBrush brush, float thickness, IPath path, GraphicsOptions options)
+ public static IImageOperations Draw(this IImageOperations 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
///