Browse Source

Merge pull request #491 from SixLabors/js/move-graphics-options

Move GraphicsOptions parameter
af/merge-core
James Jackson-South 8 years ago
committed by GitHub
parent
commit
4f93736112
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs
  2. 8
      src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs
  3. 26
      src/ImageSharp.Drawing/Processing/Drawing/DrawLineExtensions.cs
  4. 20
      src/ImageSharp.Drawing/Processing/Drawing/DrawPathCollectionExtensions.cs
  5. 22
      src/ImageSharp.Drawing/Processing/Drawing/DrawPathExtensions.cs
  6. 26
      src/ImageSharp.Drawing/Processing/Drawing/DrawPolygonExtensions.cs
  7. 20
      src/ImageSharp.Drawing/Processing/Drawing/DrawRectangleExtensions.cs
  8. 14
      src/ImageSharp.Drawing/Processing/Drawing/FillPathBuilderExtensions.cs
  9. 14
      src/ImageSharp.Drawing/Processing/Drawing/FillPathCollectionExtensions.cs
  10. 14
      src/ImageSharp.Drawing/Processing/Drawing/FillPathExtensions.cs
  11. 16
      src/ImageSharp.Drawing/Processing/Drawing/FillPolygonExtensions.cs
  12. 12
      src/ImageSharp.Drawing/Processing/Drawing/FillRectangleExtensions.cs
  13. 18
      src/ImageSharp.Drawing/Processing/Drawing/FillRegionExtensions.cs
  14. 34
      src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.Path.cs
  15. 34
      src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.cs
  16. 12
      src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs
  17. 44
      src/ImageSharp/Processing/Overlays/GlowExtensions.cs
  18. 38
      src/ImageSharp/Processing/Overlays/VignetteExtensions.cs
  19. 31
      tests/ImageSharp.Tests/Drawing/BlendedShapes.cs
  20. 16
      tests/ImageSharp.Tests/Drawing/LineTests.cs
  21. 4
      tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs
  22. 6
      tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs
  23. 4
      tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs
  24. 4
      tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs
  25. 6
      tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs
  26. 22
      tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs
  27. 22
      tests/ImageSharp.Tests/Drawing/Text/DrawText.cs
  28. 8
      tests/ImageSharp.Tests/Issues/Issue412.cs
  29. 2
      tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs
  30. 4
      tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs

24
src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs

@ -19,14 +19,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new Pen<TPixel>(brush, thickness), new Path(new CubicBezierLineSegment(points)), options); => source.Draw(options, new Pen<TPixel>(brush, thickness), new Path(new CubicBezierLineSegment(points)));
/// <summary> /// <summary>
/// Draws the provided points as an open Bezier path at the provided thickness with the supplied brush /// Draws the provided points as an open Bezier path at the provided thickness with the supplied brush
@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, PointF[] points) public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new Pen<TPixel>(brush, thickness), new Path(new CubicBezierLineSegment(points))); => source.Draw(new Pen<TPixel>(brush, thickness), new Path(new CubicBezierLineSegment(points)));
@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, PointF[] points) public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawBeziers(new SolidBrush<TPixel>(color), thickness, points); => source.DrawBeziers(new SolidBrush<TPixel>(color), thickness, points);
@ -59,27 +59,27 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawBeziers(new SolidBrush<TPixel>(color), thickness, points, options); => source.DrawBeziers(options, new SolidBrush<TPixel>(color), thickness, points);
/// <summary> /// <summary>
/// Draws the provided points as an open Bezier path with the supplied pen /// Draws the provided points as an open Bezier path with the supplied pen
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IPen<TPixel> pen, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, new Path(new CubicBezierLineSegment(points)), options); => source.Draw(options, pen, new Path(new CubicBezierLineSegment(points)));
/// <summary> /// <summary>
/// Draws the provided points as an open Bezier path with the supplied pen /// Draws the provided points as an open Bezier path with the supplied pen
@ -89,7 +89,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, PointF[] points) public static IImageProcessingContext<TPixel> DrawBeziers<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, new Path(new CubicBezierLineSegment(points))); => source.Draw(pen, new Path(new CubicBezierLineSegment(points)));
} }

8
src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs

@ -42,10 +42,10 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="image">The image to blend with the currently processing image.</param>
/// <param name="options">The options, including the blending type and blending amount.</param> /// <param name="options">The options, including the blending type and blending amount.</param>
/// <param name="image">The image to blend with the currently processing image.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Blend<TPixel>(this IImageProcessingContext<TPixel> source, Image<TPixel> image, GraphicsOptions options) public static IImageProcessingContext<TPixel> Blend<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, Image<TPixel> image)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
return source.ApplyProcessor(new DrawImageProcessor<TPixel>(image, options)); return source.ApplyProcessor(new DrawImageProcessor<TPixel>(image, options));
@ -82,12 +82,12 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// Draws the given image together with the current one by blending their pixels. /// Draws the given image together with the current one by blending their pixels.
/// </summary> /// </summary>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options containing the blend mode and opacity.</param>
/// <param name="image">The image to blend with the currently processing image.</param> /// <param name="image">The image to blend with the currently processing image.</param>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="location">The location to draw the blended image.</param> /// <param name="location">The location to draw the blended image.</param>
/// <param name="options">The options containing the blend mode and opacity.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawImage<TPixel>(this IImageProcessingContext<TPixel> source, Image<TPixel> image, Point location, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawImage<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, Image<TPixel> image, Point location)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new DrawImageProcessor<TPixel>(image, location, options)); => source.ApplyProcessor(new DrawImageProcessor<TPixel>(image, location, options));
} }

26
src/ImageSharp.Drawing/Processing/Drawing/DrawLineExtensions.cs

@ -19,14 +19,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new Pen<TPixel>(brush, thickness), new Path(new LinearLineSegment(points)), options); => source.Draw(options, new Pen<TPixel>(brush, thickness), new Path(new LinearLineSegment(points)));
/// <summary> /// <summary>
/// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush
@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, PointF[] points) public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new Pen<TPixel>(brush, thickness), new Path(new LinearLineSegment(points))); => source.Draw(new Pen<TPixel>(brush, thickness), new Path(new LinearLineSegment(points)));
@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, PointF[] points) public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawLines(new SolidBrush<TPixel>(color), thickness, points); => source.DrawLines(new SolidBrush<TPixel>(color), thickness, points);
@ -59,27 +59,27 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>> /// <returns>The <see cref="Image{TPixel}"/>.</returns>>
public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawLines(new SolidBrush<TPixel>(color), thickness, points, options); => source.DrawLines(options, new SolidBrush<TPixel>(color), thickness, points);
/// <summary> /// <summary>
/// Draws the provided Points as an open Linear path with the supplied pen /// Draws the provided Points as an open Linear path with the supplied pen
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IPen<TPixel> pen, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, new Path(new LinearLineSegment(points)), options); => source.Draw(options, pen, new Path(new LinearLineSegment(points)));
/// <summary> /// <summary>
/// Draws the provided Points as an open Linear path with the supplied pen /// Draws the provided Points as an open Linear path with the supplied pen
@ -89,8 +89,8 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, PointF[] points) public static IImageProcessingContext<TPixel> DrawLines<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, new Path(new LinearLineSegment(points))); => source.Draw(pen, new Path(new LinearLineSegment(points)));
} }
} }

20
src/ImageSharp.Drawing/Processing/Drawing/DrawPathCollectionExtensions.cs

@ -18,16 +18,16 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="paths">The paths.</param> /// <param name="paths">The paths.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, IPathCollection paths, GraphicsOptions options) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IPen<TPixel> pen, IPathCollection paths)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
foreach (IPath path in paths) foreach (IPath path in paths)
{ {
source.Draw(pen, path, options); source.Draw(options, pen, path);
} }
return source; return source;
@ -43,21 +43,21 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, IPathCollection paths) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, IPathCollection paths)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, paths, GraphicsOptions.Default); => source.Draw(GraphicsOptions.Default, pen, paths);
/// <summary> /// <summary>
/// Draws the outline of the polygon with the provided brush at the provided thickness. /// Draws the outline of the polygon with the provided brush at the provided thickness.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="paths">The shapes.</param> /// <param name="paths">The shapes.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, IPathCollection paths, GraphicsOptions options) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, float thickness, IPathCollection paths)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new Pen<TPixel>(brush, thickness), paths, options); => source.Draw(options, new Pen<TPixel>(brush, thickness), paths);
/// <summary> /// <summary>
/// Draws the outline of the polygon with the provided brush at the provided thickness. /// Draws the outline of the polygon with the provided brush at the provided thickness.
@ -77,14 +77,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="paths">The paths.</param> /// <param name="paths">The paths.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, IPathCollection paths, GraphicsOptions options) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, float thickness, IPathCollection paths)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new SolidBrush<TPixel>(color), thickness, paths, options); => source.Draw(options, new SolidBrush<TPixel>(color), thickness, paths);
/// <summary> /// <summary>
/// Draws the outline of the polygon with the provided brush at the provided thickness. /// Draws the outline of the polygon with the provided brush at the provided thickness.

22
src/ImageSharp.Drawing/Processing/Drawing/DrawPathExtensions.cs

@ -19,13 +19,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, IPath path, GraphicsOptions options) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IPen<TPixel> pen, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(pen.StrokeFill, new ShapePath(path, pen), options); => source.Fill(options, pen.StrokeFill, new ShapePath(path, pen));
/// <summary> /// <summary>
/// Draws the outline of the polygon with the provided pen. /// Draws the outline of the polygon with the provided pen.
@ -37,21 +37,21 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, IPath path) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, path, GraphicsOptions.Default); => source.Draw(GraphicsOptions.Default, pen, path);
/// <summary> /// <summary>
/// Draws the outline of the polygon with the provided brush at the provided thickness. /// Draws the outline of the polygon with the provided brush at the provided thickness.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="path">The shape.</param> /// <param name="path">The shape.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, IPath path, GraphicsOptions options) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, float thickness, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new Pen<TPixel>(brush, thickness), path, options); => source.Draw(options, new Pen<TPixel>(brush, thickness), path);
/// <summary> /// <summary>
/// Draws the outline of the polygon with the provided brush at the provided thickness. /// Draws the outline of the polygon with the provided brush at the provided thickness.
@ -71,14 +71,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, IPath path, GraphicsOptions options) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, float thickness, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new SolidBrush<TPixel>(color), thickness, path, options); => source.Draw(options, new SolidBrush<TPixel>(color), thickness, path);
/// <summary> /// <summary>
/// Draws the outline of the polygon with the provided brush at the provided thickness. /// Draws the outline of the polygon with the provided brush at the provided thickness.
@ -93,4 +93,4 @@ namespace SixLabors.ImageSharp.Processing.Drawing
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new SolidBrush<TPixel>(color), thickness, path); => source.Draw(new SolidBrush<TPixel>(color), thickness, path);
} }
} }

26
src/ImageSharp.Drawing/Processing/Drawing/DrawPolygonExtensions.cs

@ -19,14 +19,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new Pen<TPixel>(brush, thickness), new Polygon(new LinearLineSegment(points)), options); => source.Draw(options, new Pen<TPixel>(brush, thickness), new Polygon(new LinearLineSegment(points)));
/// <summary> /// <summary>
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness. /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, PointF[] points) public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new Pen<TPixel>(brush, thickness), new Polygon(new LinearLineSegment(points))); => source.Draw(new Pen<TPixel>(brush, thickness), new Polygon(new LinearLineSegment(points)));
@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, PointF[] points) public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawPolygon(new SolidBrush<TPixel>(color), thickness, points); => source.DrawPolygon(new SolidBrush<TPixel>(color), thickness, points);
@ -59,14 +59,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, float thickness, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawPolygon(new SolidBrush<TPixel>(color), thickness, points, options); => source.DrawPolygon(options, new SolidBrush<TPixel>(color), thickness, points);
/// <summary> /// <summary>
/// Draws the provided Points as a closed Linear Polygon with the provided Pen. /// Draws the provided Points as a closed Linear Polygon with the provided Pen.
@ -76,21 +76,21 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, PointF[] points) public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, new Polygon(new LinearLineSegment(points)), GraphicsOptions.Default); => source.Draw(GraphicsOptions.Default, pen, new Polygon(new LinearLineSegment(points)));
/// <summary> /// <summary>
/// Draws the provided Points as a closed Linear Polygon with the provided Pen. /// Draws the provided Points as a closed Linear Polygon with the provided Pen.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> DrawPolygon<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IPen<TPixel> pen, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, new Polygon(new LinearLineSegment(points)), options); => source.Draw(options, pen, new Polygon(new LinearLineSegment(points)));
} }
} }

20
src/ImageSharp.Drawing/Processing/Drawing/DrawRectangleExtensions.cs

@ -19,13 +19,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="shape">The shape.</param> /// <param name="shape">The shape.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, RectangleF shape, GraphicsOptions options) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IPen<TPixel> pen, RectangleF shape)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, new RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height), options); => source.Draw(options, pen, new RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height));
/// <summary> /// <summary>
/// Draws the outline of the rectangle with the provided pen. /// Draws the outline of the rectangle with the provided pen.
@ -37,21 +37,21 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, RectangleF shape) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IPen<TPixel> pen, RectangleF shape)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(pen, shape, GraphicsOptions.Default); => source.Draw(GraphicsOptions.Default, pen, shape);
/// <summary> /// <summary>
/// Draws the outline of the rectangle with the provided brush at the provided thickness. /// Draws the outline of the rectangle with the provided brush at the provided thickness.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="shape">The shape.</param> /// <param name="shape">The shape.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, float thickness, RectangleF shape, GraphicsOptions options) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, float thickness, RectangleF shape)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new Pen<TPixel>(brush, thickness), shape, options); => source.Draw(options, new Pen<TPixel>(brush, thickness), shape);
/// <summary> /// <summary>
/// Draws the outline of the rectangle with the provided brush at the provided thickness. /// Draws the outline of the rectangle with the provided brush at the provided thickness.
@ -71,14 +71,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="thickness">The thickness.</param> /// <param name="thickness">The thickness.</param>
/// <param name="shape">The shape.</param> /// <param name="shape">The shape.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float thickness, RectangleF shape, GraphicsOptions options) public static IImageProcessingContext<TPixel> Draw<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, float thickness, RectangleF shape)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Draw(new SolidBrush<TPixel>(color), thickness, shape, options); => source.Draw(options, new SolidBrush<TPixel>(color), thickness, shape);
/// <summary> /// <summary>
/// Draws the outline of the rectangle with the provided brush at the provided thickness. /// Draws the outline of the rectangle with the provided brush at the provided thickness.

14
src/ImageSharp.Drawing/Processing/Drawing/FillPathBuilderExtensions.cs

@ -18,17 +18,17 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The graphics options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="path">The shape.</param> /// <param name="path">The shape.</param>
/// <param name="options">The graphics options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, Action<PathBuilder> path, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, Action<PathBuilder> path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
var pb = new PathBuilder(); var pb = new PathBuilder();
path(pb); path(pb);
return source.Fill(brush, pb.Build(), options); return source.Fill(options, brush, pb.Build());
} }
/// <summary> /// <summary>
@ -41,20 +41,20 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, Action<PathBuilder> path) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, Action<PathBuilder> path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(brush, path, GraphicsOptions.Default); => source.Fill(GraphicsOptions.Default, brush, path);
/// <summary> /// <summary>
/// Flood fills the image in the shape of the provided polygon with the specified brush. /// Flood fills the image in the shape of the provided polygon with the specified brush.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, Action<PathBuilder> path, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, Action<PathBuilder> path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(new SolidBrush<TPixel>(color), path, options); => source.Fill(options, new SolidBrush<TPixel>(color), path);
/// <summary> /// <summary>
/// Flood fills the image in the shape of the provided polygon with the specified brush. /// Flood fills the image in the shape of the provided polygon with the specified brush.

14
src/ImageSharp.Drawing/Processing/Drawing/FillPathCollectionExtensions.cs

@ -17,16 +17,16 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The graphics options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="paths">The shapes.</param> /// <param name="paths">The shapes.</param>
/// <param name="options">The graphics options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, IPathCollection paths, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, IPathCollection paths)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
foreach (IPath s in paths) foreach (IPath s in paths)
{ {
source.Fill(brush, s, options); source.Fill(options, brush, s);
} }
return source; return source;
@ -42,20 +42,20 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, IPathCollection paths) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, IPathCollection paths)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(brush, paths, GraphicsOptions.Default); => source.Fill(GraphicsOptions.Default, brush, paths);
/// <summary> /// <summary>
/// Flood fills the image in the shape of the provided polygon with the specified brush. /// Flood fills the image in the shape of the provided polygon with the specified brush.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="paths">The paths.</param> /// <param name="paths">The paths.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, IPathCollection paths, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, IPathCollection paths)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(new SolidBrush<TPixel>(color), paths, options); => source.Fill(options, new SolidBrush<TPixel>(color), paths);
/// <summary> /// <summary>
/// Flood fills the image in the shape of the provided polygon with the specified brush. /// Flood fills the image in the shape of the provided polygon with the specified brush.

14
src/ImageSharp.Drawing/Processing/Drawing/FillPathExtensions.cs

@ -18,13 +18,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The graphics options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="path">The shape.</param> /// <param name="path">The shape.</param>
/// <param name="options">The graphics options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, IPath path, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(brush, new ShapeRegion(path), options); => source.Fill(options, brush, new ShapeRegion(path));
/// <summary> /// <summary>
/// Flood fills the image in the shape of the provided polygon with the specified brush. /// Flood fills the image in the shape of the provided polygon with the specified brush.
@ -36,20 +36,20 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, IPath path) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(brush, new ShapeRegion(path), GraphicsOptions.Default); => source.Fill(GraphicsOptions.Default, brush, new ShapeRegion(path));
/// <summary> /// <summary>
/// Flood fills the image in the shape of the provided polygon with the specified brush.. /// Flood fills the image in the shape of the provided polygon with the specified brush..
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, IPath path, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(new SolidBrush<TPixel>(color), path, options); => source.Fill(options, new SolidBrush<TPixel>(color), path);
/// <summary> /// <summary>
/// Flood fills the image in the shape of the provided polygon with the specified brush.. /// Flood fills the image in the shape of the provided polygon with the specified brush..

16
src/ImageSharp.Drawing/Processing/Drawing/FillPolygonExtensions.cs

@ -18,13 +18,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> FillPolygon<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> FillPolygon<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(brush, new Polygon(new LinearLineSegment(points)), options); => source.Fill(options, brush, new Polygon(new LinearLineSegment(points)));
/// <summary> /// <summary>
/// Flood fills the image in the shape of a Linear polygon described by the points /// Flood fills the image in the shape of a Linear polygon described by the points
@ -34,7 +34,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> FillPolygon<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, PointF[] points) public static IImageProcessingContext<TPixel> FillPolygon<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(brush, new Polygon(new LinearLineSegment(points))); => source.Fill(brush, new Polygon(new LinearLineSegment(points)));
@ -43,13 +43,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> FillPolygon<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, PointF[] points, GraphicsOptions options) public static IImageProcessingContext<TPixel> FillPolygon<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(new SolidBrush<TPixel>(color), new Polygon(new LinearLineSegment(points)), options); => source.Fill(options, new SolidBrush<TPixel>(color), new Polygon(new LinearLineSegment(points)));
/// <summary> /// <summary>
/// Flood fills the image in the shape of a Linear polygon described by the points /// Flood fills the image in the shape of a Linear polygon described by the points
@ -59,7 +59,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="points">The points.</param> /// <param name="points">The points.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> FillPolygon<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, PointF[] points) public static IImageProcessingContext<TPixel> FillPolygon<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, params PointF[] points)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(new SolidBrush<TPixel>(color), new Polygon(new LinearLineSegment(points))); => source.Fill(new SolidBrush<TPixel>(color), new Polygon(new LinearLineSegment(points)));
} }

12
src/ImageSharp.Drawing/Processing/Drawing/FillRectangleExtensions.cs

@ -18,13 +18,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="shape">The shape.</param> /// <param name="shape">The shape.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, RectangleF shape, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, RectangleF shape)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(brush, new RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height), options); => source.Fill(options, brush, new RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height));
/// <summary> /// <summary>
/// Flood fills the image in the shape of the provided rectangle with the specified brush. /// Flood fills the image in the shape of the provided rectangle with the specified brush.
@ -43,13 +43,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="shape">The shape.</param> /// <param name="shape">The shape.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, RectangleF shape, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, RectangleF shape)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(new SolidBrush<TPixel>(color), shape, options); => source.Fill(options, new SolidBrush<TPixel>(color), shape);
/// <summary> /// <summary>
/// Flood fills the image in the shape of the provided rectangle with the specified brush. /// Flood fills the image in the shape of the provided rectangle with the specified brush.

18
src/ImageSharp.Drawing/Processing/Drawing/FillRegionExtensions.cs

@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(brush, GraphicsOptions.Default); => source.Fill(GraphicsOptions.Default, brush);
/// <summary> /// <summary>
/// Flood fills the image with the specified color. /// Flood fills the image with the specified color.
@ -45,20 +45,20 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, Region region) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, Region region)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(brush, region, GraphicsOptions.Default); => source.Fill(GraphicsOptions.Default, brush, region);
/// <summary> /// <summary>
/// Flood fills the image with in the region with the specified color. /// Flood fills the image with in the region with the specified color.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="region">The region.</param> /// <param name="region">The region.</param>
/// <param name="options">The options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, Region region, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, Region region)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Fill(new SolidBrush<TPixel>(color), region, options); => source.Fill(options, new SolidBrush<TPixel>(color), region);
/// <summary> /// <summary>
/// Flood fills the image with in the region with the specified color. /// Flood fills the image with in the region with the specified color.
@ -77,11 +77,11 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The graphics options.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="region">The region.</param> /// <param name="region">The region.</param>
/// <param name="options">The graphics options.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, Region region, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush, Region region)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new FillRegionProcessor<TPixel>(brush, region, options)); => source.ApplyProcessor(new FillRegionProcessor<TPixel>(brush, region, options));
@ -90,10 +90,10 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="brush">The details how to fill the region of interest.</param>
/// <param name="options">The graphics options.</param> /// <param name="options">The graphics options.</param>
/// <param name="brush">The details how to fill the region of interest.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, IBrush<TPixel> brush, GraphicsOptions options) public static IImageProcessingContext<TPixel> Fill<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, IBrush<TPixel> brush)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new FillProcessor<TPixel>(brush, options)); => source.ApplyProcessor(new FillProcessor<TPixel>(brush, options));
} }

34
src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.Path.cs

@ -29,24 +29,24 @@ namespace SixLabors.ImageSharp.Processing.Text
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, TPixel color, IPath path) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, TPixel color, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, color, path, TextGraphicsOptions.Default); => source.DrawText(TextGraphicsOptions.Default, text, font, color, path);
/// <summary> /// <summary>
/// Draws the text onto the the image filled via the brush. /// Draws the text onto the the image filled via the brush.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="font">The font.</param> /// <param name="font">The font.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
/// <param name="options">The options.</param>
/// <returns> /// <returns>
/// The <see cref="Image{TPixel}" />. /// The <see cref="Image{TPixel}" />.
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, TPixel color, IPath path, TextGraphicsOptions options) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, TextGraphicsOptions options, string text, Font font, TPixel color, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, Brushes.Solid(color), null, path, options); => source.DrawText(options, text, font, Brushes.Solid(color), null, path);
/// <summary> /// <summary>
/// Draws the text onto the the image filled via the brush. /// Draws the text onto the the image filled via the brush.
@ -62,24 +62,24 @@ namespace SixLabors.ImageSharp.Processing.Text
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, IPath path) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, brush, path, TextGraphicsOptions.Default); => source.DrawText(TextGraphicsOptions.Default, text, font, brush, path);
/// <summary> /// <summary>
/// Draws the text onto the the image filled via the brush. /// Draws the text onto the the image filled via the brush.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="font">The font.</param> /// <param name="font">The font.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
/// <param name="options">The options.</param>
/// <returns> /// <returns>
/// The <see cref="Image{TPixel}" />. /// The <see cref="Image{TPixel}" />.
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, IPath path, TextGraphicsOptions options) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, TextGraphicsOptions options, string text, Font font, IBrush<TPixel> brush, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, brush, null, path, options); => source.DrawText(options, text, font, brush, null, path);
/// <summary> /// <summary>
/// Draws the text onto the the image outlined via the pen. /// Draws the text onto the the image outlined via the pen.
@ -95,24 +95,24 @@ namespace SixLabors.ImageSharp.Processing.Text
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IPen<TPixel> pen, IPath path) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IPen<TPixel> pen, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, pen, path, TextGraphicsOptions.Default); => source.DrawText(TextGraphicsOptions.Default, text, font, pen, path);
/// <summary> /// <summary>
/// Draws the text onto the the image outlined via the pen. /// Draws the text onto the the image outlined via the pen.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="font">The font.</param> /// <param name="font">The font.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
/// <param name="options">The options.</param>
/// <returns> /// <returns>
/// The <see cref="Image{TPixel}" />. /// The <see cref="Image{TPixel}" />.
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IPen<TPixel> pen, IPath path, TextGraphicsOptions options) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, TextGraphicsOptions options, string text, Font font, IPen<TPixel> pen, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, null, pen, path, options); => source.DrawText(options, text, font, null, pen, path);
/// <summary> /// <summary>
/// Draws the text onto the the image filled via the brush then outlined via the pen. /// Draws the text onto the the image filled via the brush then outlined via the pen.
@ -129,23 +129,23 @@ namespace SixLabors.ImageSharp.Processing.Text
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, IPen<TPixel> pen, IPath path) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, IPen<TPixel> pen, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, brush, pen, path, TextGraphicsOptions.Default); => source.DrawText(TextGraphicsOptions.Default, text, font, brush, pen, path);
/// <summary> /// <summary>
/// Draws the text onto the the image filled via the brush then outlined via the pen. /// Draws the text onto the the image filled via the brush then outlined via the pen.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="font">The font.</param> /// <param name="font">The font.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
/// <param name="options">The options.</param>
/// <returns> /// <returns>
/// The <see cref="Image{TPixel}" />. /// The <see cref="Image{TPixel}" />.
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, IPen<TPixel> pen, IPath path, TextGraphicsOptions options) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, TextGraphicsOptions options, string text, Font font, IBrush<TPixel> brush, IPen<TPixel> pen, IPath path)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
float dpiX = DefaultTextDpi; float dpiX = DefaultTextDpi;
@ -165,12 +165,12 @@ namespace SixLabors.ImageSharp.Processing.Text
var pathOptions = (GraphicsOptions)options; var pathOptions = (GraphicsOptions)options;
if (brush != null) if (brush != null)
{ {
source.Fill(brush, glyphs, pathOptions); source.Fill(pathOptions, brush, glyphs);
} }
if (pen != null) if (pen != null)
{ {
source.Draw(pen, glyphs, pathOptions); source.Draw(pathOptions, pen, glyphs);
} }
return source; return source;

34
src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.cs

@ -32,24 +32,24 @@ namespace SixLabors.ImageSharp.Processing.Text
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, TPixel color, PointF location) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, TPixel color, PointF location)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, color, location, TextGraphicsOptions.Default); => source.DrawText(TextGraphicsOptions.Default, text, font, color, location);
/// <summary> /// <summary>
/// Draws the text onto the the image filled via the brush. /// Draws the text onto the the image filled via the brush.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="font">The font.</param> /// <param name="font">The font.</param>
/// <param name="color">The color.</param> /// <param name="color">The color.</param>
/// <param name="location">The location.</param> /// <param name="location">The location.</param>
/// <param name="options">The options.</param>
/// <returns> /// <returns>
/// The <see cref="Image{TPixel}" />. /// The <see cref="Image{TPixel}" />.
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, TPixel color, PointF location, TextGraphicsOptions options) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, TextGraphicsOptions options, string text, Font font, TPixel color, PointF location)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, Brushes.Solid(color), null, location, options); => source.DrawText(options, text, font, Brushes.Solid(color), null, location);
/// <summary> /// <summary>
/// Draws the text onto the the image filled via the brush. /// Draws the text onto the the image filled via the brush.
@ -65,24 +65,24 @@ namespace SixLabors.ImageSharp.Processing.Text
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, PointF location) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, PointF location)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, brush, location, TextGraphicsOptions.Default); => source.DrawText(TextGraphicsOptions.Default, text, font, brush, location);
/// <summary> /// <summary>
/// Draws the text onto the the image filled via the brush. /// Draws the text onto the the image filled via the brush.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="font">The font.</param> /// <param name="font">The font.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="location">The location.</param> /// <param name="location">The location.</param>
/// <param name="options">The options.</param>
/// <returns> /// <returns>
/// The <see cref="Image{TPixel}" />. /// The <see cref="Image{TPixel}" />.
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, PointF location, TextGraphicsOptions options) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, TextGraphicsOptions options, string text, Font font, IBrush<TPixel> brush, PointF location)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, brush, null, location, options); => source.DrawText(options, text, font, brush, null, location);
/// <summary> /// <summary>
/// Draws the text onto the the image outlined via the pen. /// Draws the text onto the the image outlined via the pen.
@ -98,24 +98,24 @@ namespace SixLabors.ImageSharp.Processing.Text
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IPen<TPixel> pen, PointF location) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IPen<TPixel> pen, PointF location)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, pen, location, TextGraphicsOptions.Default); => source.DrawText(TextGraphicsOptions.Default, text, font, pen, location);
/// <summary> /// <summary>
/// Draws the text onto the the image outlined via the pen. /// Draws the text onto the the image outlined via the pen.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="font">The font.</param> /// <param name="font">The font.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="location">The location.</param> /// <param name="location">The location.</param>
/// <param name="options">The options.</param>
/// <returns> /// <returns>
/// The <see cref="Image{TPixel}" />. /// The <see cref="Image{TPixel}" />.
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IPen<TPixel> pen, PointF location, TextGraphicsOptions options) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, TextGraphicsOptions options, string text, Font font, IPen<TPixel> pen, PointF location)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, null, pen, location, options); => source.DrawText(options, text, font, null, pen, location);
/// <summary> /// <summary>
/// Draws the text onto the the image filled via the brush then outlined via the pen. /// Draws the text onto the the image filled via the brush then outlined via the pen.
@ -132,23 +132,23 @@ namespace SixLabors.ImageSharp.Processing.Text
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, IPen<TPixel> pen, PointF location) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, IPen<TPixel> pen, PointF location)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.DrawText(text, font, brush, pen, location, TextGraphicsOptions.Default); => source.DrawText(TextGraphicsOptions.Default, text, font, brush, pen, location);
/// <summary> /// <summary>
/// Draws the text using the default resolution of <value>72dpi</value> onto the the image filled via the brush then outlined via the pen. /// Draws the text using the default resolution of <value>72dpi</value> onto the the image filled via the brush then outlined via the pen.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The type of the color.</typeparam> /// <typeparam name="TPixel">The type of the color.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options.</param>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="font">The font.</param> /// <param name="font">The font.</param>
/// <param name="brush">The brush.</param> /// <param name="brush">The brush.</param>
/// <param name="pen">The pen.</param> /// <param name="pen">The pen.</param>
/// <param name="location">The location.</param> /// <param name="location">The location.</param>
/// <param name="options">The options.</param>
/// <returns> /// <returns>
/// The <see cref="Image{TPixel}" />. /// The <see cref="Image{TPixel}" />.
/// </returns> /// </returns>
public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, string text, Font font, IBrush<TPixel> brush, IPen<TPixel> pen, PointF location, TextGraphicsOptions options) public static IImageProcessingContext<TPixel> DrawText<TPixel>(this IImageProcessingContext<TPixel> source, TextGraphicsOptions options, string text, Font font, IBrush<TPixel> brush, IPen<TPixel> pen, PointF location)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
float dpiX = DefaultTextDpi; float dpiX = DefaultTextDpi;
@ -168,12 +168,12 @@ namespace SixLabors.ImageSharp.Processing.Text
var pathOptions = (GraphicsOptions)options; var pathOptions = (GraphicsOptions)options;
if (brush != null) if (brush != null)
{ {
source.Fill(brush, glyphs, pathOptions); source.Fill(pathOptions, brush, glyphs);
} }
if (pen != null) if (pen != null)
{ {
source.Draw(pen, glyphs, pathOptions); source.Draw(pathOptions, pen, glyphs);
} }
return source; return source;

12
src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs

@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color) public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> BackgroundColor(source, color, GraphicsOptions.Default); => BackgroundColor(source, GraphicsOptions.Default, color);
/// <summary> /// <summary>
/// Replaces the background color of image with the given one. /// Replaces the background color of image with the given one.
@ -35,17 +35,17 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, Rectangle rectangle) public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> BackgroundColor(source, color, rectangle, GraphicsOptions.Default); => BackgroundColor(source, GraphicsOptions.Default, color, rectangle);
/// <summary> /// <summary>
/// Replaces the background color of image with the given one. /// Replaces the background color of image with the given one.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="color">The color to set as the background.</param>
/// <param name="options">The options effecting pixel blending.</param> /// <param name="options">The options effecting pixel blending.</param>
/// <param name="color">The color to set as the background.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, GraphicsOptions options) public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new BackgroundColorProcessor<TPixel>(color, options)); => source.ApplyProcessor(new BackgroundColorProcessor<TPixel>(color, options));
@ -54,13 +54,13 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="color">The color to set as the background.</param> /// <param name="color">The color to set as the background.</param>
/// <param name="rectangle"> /// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param> /// </param>
/// <param name="options">The options effecting pixel blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, Rectangle rectangle, GraphicsOptions options) public static IImageProcessingContext<TPixel> BackgroundColor<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new BackgroundColorProcessor<TPixel>(color, options), rectangle); => source.ApplyProcessor(new BackgroundColorProcessor<TPixel>(color, options), rectangle);
} }

44
src/ImageSharp/Processing/Overlays/GlowExtensions.cs

@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color) public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
return Glow(source, color, GraphicsOptions.Default); return Glow(source, GraphicsOptions.Default, color);
} }
/// <summary> /// <summary>
@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, float radius) public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, float radius)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Glow(source, radius, GraphicsOptions.Default); => Glow(source, GraphicsOptions.Default, radius);
/// <summary> /// <summary>
/// Applies a radial glow effect to an image. /// Applies a radial glow effect to an image.
@ -58,7 +58,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle) public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Glow(rectangle, GraphicsOptions.Default); => source.Glow(GraphicsOptions.Default, rectangle);
/// <summary> /// <summary>
/// Applies a radial glow effect to an image. /// Applies a radial glow effect to an image.
@ -73,7 +73,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radius, Rectangle rectangle) public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radius, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Glow(color, ValueSize.Absolute(radius), rectangle, GraphicsOptions.Default); => source.Glow(GraphicsOptions.Default, color, ValueSize.Absolute(radius), rectangle);
/// <summary> /// <summary>
/// Applies a radial glow effect to an image. /// Applies a radial glow effect to an image.
@ -84,75 +84,75 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options) public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Glow(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(0.5f), options); => source.Glow(options, NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(0.5f));
/// <summary> /// <summary>
/// Applies a radial glow effect to an image. /// Applies a radial glow effect to an image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="color">The color to set as the glow.</param>
/// <param name="options">The options effecting things like blending.</param> /// <param name="options">The options effecting things like blending.</param>
/// <param name="color">The color to set as the glow.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, GraphicsOptions options) public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Glow(color, ValueSize.PercentageOfWidth(0.5f), options); => source.Glow(options, color, ValueSize.PercentageOfWidth(0.5f));
/// <summary> /// <summary>
/// Applies a radial glow effect to an image. /// Applies a radial glow effect to an image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="radius">The the radius.</param>
/// <param name="options">The options effecting things like blending.</param> /// <param name="options">The options effecting things like blending.</param>
/// <param name="radius">The the radius.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, float radius, GraphicsOptions options) public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, float radius)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Glow(NamedColors<TPixel>.Black, ValueSize.Absolute(radius), options); => source.Glow(options, NamedColors<TPixel>.Black, ValueSize.Absolute(radius));
/// <summary> /// <summary>
/// Applies a radial glow effect to an image. /// Applies a radial glow effect to an image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="rectangle"> /// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param> /// </param>
/// <param name="options">The options effecting things like blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle, GraphicsOptions options) public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Glow(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(0.5f), rectangle, options); => source.Glow(options, NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(0.5f), rectangle);
/// <summary> /// <summary>
/// Applies a radial glow effect to an image. /// Applies a radial glow effect to an image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="color">The color to set as the glow.</param> /// <param name="color">The color to set as the glow.</param>
/// <param name="radius">The the radius.</param> /// <param name="radius">The the radius.</param>
/// <param name="rectangle"> /// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param> /// </param>
/// <param name="options">The options effecting things like blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radius, Rectangle rectangle, GraphicsOptions options) public static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, float radius, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Glow(color, ValueSize.Absolute(radius), rectangle, options); => source.Glow(options, color, ValueSize.Absolute(radius), rectangle);
/// <summary> /// <summary>
/// Applies a radial glow effect to an image. /// Applies a radial glow effect to an image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="color">The color to set as the glow.</param> /// <param name="color">The color to set as the glow.</param>
/// <param name="radius">The the radius.</param> /// <param name="radius">The the radius.</param>
/// <param name="rectangle"> /// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param> /// </param>
/// <param name="options">The options effecting things like blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
private static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, ValueSize radius, Rectangle rectangle, GraphicsOptions options) private static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, ValueSize radius, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new GlowProcessor<TPixel>(color, radius, options), rectangle); => source.ApplyProcessor(new GlowProcessor<TPixel>(color, radius, options), rectangle);
@ -161,12 +161,12 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="color">The color to set as the glow.</param> /// <param name="color">The color to set as the glow.</param>
/// <param name="radius">The the radius.</param> /// <param name="radius">The the radius.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
private static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, ValueSize radius, GraphicsOptions options) private static IImageProcessingContext<TPixel> Glow<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, ValueSize radius)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new GlowProcessor<TPixel>(color, radius, options)); => source.ApplyProcessor(new GlowProcessor<TPixel>(color, radius, options));
} }
} }

38
src/ImageSharp/Processing/Overlays/VignetteExtensions.cs

@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color) public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Vignette(source, color, GraphicsOptions.Default); => Vignette(source, GraphicsOptions.Default, color);
/// <summary> /// <summary>
/// Applies a radial vignette effect to an image. /// Applies a radial vignette effect to an image.
@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, float radiusX, float radiusY) public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, float radiusX, float radiusY)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Vignette(source, radiusX, radiusY, GraphicsOptions.Default); => Vignette(source, GraphicsOptions.Default, radiusX, radiusY);
/// <summary> /// <summary>
/// Applies a radial vignette effect to an image. /// Applies a radial vignette effect to an image.
@ -57,7 +57,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle) public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> Vignette(source, rectangle, GraphicsOptions.Default); => Vignette(source, GraphicsOptions.Default, rectangle);
/// <summary> /// <summary>
/// Applies a radial vignette effect to an image. /// Applies a radial vignette effect to an image.
@ -73,7 +73,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radiusX, float radiusY, Rectangle rectangle) public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radiusX, float radiusY, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.Vignette(color, radiusX, radiusY, rectangle, GraphicsOptions.Default); => source.Vignette(GraphicsOptions.Default, color, radiusX, radiusY, rectangle);
/// <summary> /// <summary>
/// Applies a radial vignette effect to an image. /// Applies a radial vignette effect to an image.
@ -84,69 +84,69 @@ namespace SixLabors.ImageSharp.Processing.Overlays
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options) public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options); => source.VignetteInternal(options, NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f));
/// <summary> /// <summary>
/// Applies a radial vignette effect to an image. /// Applies a radial vignette effect to an image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="color">The color to set as the vignette.</param>
/// <param name="options">The options effecting pixel blending.</param> /// <param name="options">The options effecting pixel blending.</param>
/// <param name="color">The color to set as the vignette.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, GraphicsOptions options) public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(color, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options); => source.VignetteInternal(options, color, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f));
/// <summary> /// <summary>
/// Applies a radial vignette effect to an image. /// Applies a radial vignette effect to an image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="radiusX">The the x-radius.</param> /// <param name="radiusX">The the x-radius.</param>
/// <param name="radiusY">The the y-radius.</param> /// <param name="radiusY">The the y-radius.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, float radiusX, float radiusY, GraphicsOptions options) public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, float radiusX, float radiusY)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(NamedColors<TPixel>.Black, radiusX, radiusY, options); => source.VignetteInternal(options, NamedColors<TPixel>.Black, radiusX, radiusY);
/// <summary> /// <summary>
/// Applies a radial vignette effect to an image. /// Applies a radial vignette effect to an image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="rectangle"> /// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param> /// </param>
/// <param name="options">The options effecting pixel blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, Rectangle rectangle, GraphicsOptions options) public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), rectangle, options); => source.VignetteInternal(options, NamedColors<TPixel>.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), rectangle);
/// <summary> /// <summary>
/// Applies a radial vignette effect to an image. /// Applies a radial vignette effect to an image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="color">The color to set as the vignette.</param> /// <param name="color">The color to set as the vignette.</param>
/// <param name="radiusX">The the x-radius.</param> /// <param name="radiusX">The the x-radius.</param>
/// <param name="radiusY">The the y-radius.</param> /// <param name="radiusY">The the y-radius.</param>
/// <param name="rectangle"> /// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param> /// </param>
/// <param name="options">The options effecting pixel blending.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, float radiusX, float radiusY, Rectangle rectangle, GraphicsOptions options) public static IImageProcessingContext<TPixel> Vignette<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, float radiusX, float radiusY, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.VignetteInternal(color, radiusX, radiusY, rectangle, options); => source.VignetteInternal(options, color, radiusX, radiusY, rectangle);
private static IImageProcessingContext<TPixel> VignetteInternal<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, ValueSize radiusX, ValueSize radiusY, Rectangle rectangle, GraphicsOptions options) private static IImageProcessingContext<TPixel> VignetteInternal<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, ValueSize radiusX, ValueSize radiusY, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new VignetteProcessor<TPixel>(color, radiusX, radiusY, options), rectangle); => source.ApplyProcessor(new VignetteProcessor<TPixel>(color, radiusX, radiusY, options), rectangle);
private static IImageProcessingContext<TPixel> VignetteInternal<TPixel>(this IImageProcessingContext<TPixel> source, TPixel color, ValueSize radiusX, ValueSize radiusY, GraphicsOptions options) private static IImageProcessingContext<TPixel> VignetteInternal<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, TPixel color, ValueSize radiusX, ValueSize radiusY)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new VignetteProcessor<TPixel>(color, radiusX, radiusY, options)); => source.ApplyProcessor(new VignetteProcessor<TPixel>(color, radiusX, radiusY, options));
} }

31
tests/ImageSharp.Tests/Drawing/BlendedShapes.cs

@ -29,10 +29,8 @@ namespace SixLabors.ImageSharp.Tests.Drawing
var scaleY = (img.Height / 100); var scaleY = (img.Height / 100);
img.Mutate(x => x img.Mutate(x => x
.Fill(NamedColors<TPixel>.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY)) .Fill(NamedColors<TPixel>.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))
.Fill(NamedColors<TPixel>.HotPink, new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY), new ImageSharp.GraphicsOptions(true) .Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors<TPixel>.HotPink, new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY)
{ ));
BlenderMode = mode
}));
img.DebugSave(provider, new { mode }); img.DebugSave(provider, new { mode });
} }
} }
@ -47,14 +45,8 @@ namespace SixLabors.ImageSharp.Tests.Drawing
var scaleX = (img.Width / 100); var scaleX = (img.Width / 100);
var scaleY = (img.Height / 100); var scaleY = (img.Height / 100);
img.Mutate(x => x.Fill(NamedColors<TPixel>.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))); img.Mutate(x => x.Fill(NamedColors<TPixel>.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY)));
img.Mutate(x => x.Fill(NamedColors<TPixel>.HotPink, new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY), new ImageSharp.GraphicsOptions(true) img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors<TPixel>.HotPink, new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY)));
{ img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors<TPixel>.Transparent, new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY)));
BlenderMode = mode
}));
img.Mutate(x => x.Fill(NamedColors<TPixel>.Transparent, new SixLabors.Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY), new ImageSharp.GraphicsOptions(true)
{
BlenderMode = mode
}));
img.DebugSave(provider, new { mode }); img.DebugSave(provider, new { mode });
} }
} }
@ -69,19 +61,13 @@ namespace SixLabors.ImageSharp.Tests.Drawing
var scaleX = (img.Width / 100); var scaleX = (img.Width / 100);
var scaleY = (img.Height / 100); var scaleY = (img.Height / 100);
img.Mutate(x => x.Fill(NamedColors<TPixel>.DarkBlue, new Rectangle(0 * scaleX, 40, 100 * scaleX, 20 * scaleY))); img.Mutate(x => x.Fill(NamedColors<TPixel>.DarkBlue, new Rectangle(0 * scaleX, 40, 100 * scaleX, 20 * scaleY)));
img.Mutate(x => x.Fill(NamedColors<TPixel>.HotPink, new Rectangle(20 * scaleX, 0, 30 * scaleX, 100 * scaleY), new ImageSharp.GraphicsOptions(true) img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors<TPixel>.HotPink, new Rectangle(20 * scaleX, 0, 30 * scaleX, 100 * scaleY)));
{
BlenderMode = mode
}));
var c = NamedColors<TPixel>.Red.ToVector4(); var c = NamedColors<TPixel>.Red.ToVector4();
c.W *= 0.5f; c.W *= 0.5f;
TPixel pixel = default(TPixel); TPixel pixel = default(TPixel);
pixel.PackFromVector4(c); pixel.PackFromVector4(c);
img.Mutate(x => x.Fill(pixel, new SixLabors.Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY), new ImageSharp.GraphicsOptions(true) img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, pixel, new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY)));
{
BlenderMode = mode
}));
img.DebugSave(provider, new { mode }); img.DebugSave(provider, new { mode });
} }
} }
@ -98,10 +84,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
var scaleX = (img.Width / 100); var scaleX = (img.Width / 100);
var scaleY = (img.Height / 100); var scaleY = (img.Height / 100);
img.Mutate(x => x.Fill(NamedColors<TPixel>.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))); img.Mutate(x => x.Fill(NamedColors<TPixel>.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY)));
img.Mutate(x => x.Fill(NamedColors<TPixel>.Black, new SixLabors.Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY), new ImageSharp.GraphicsOptions(true) img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors<TPixel>.Black, new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY)));
{
BlenderMode = mode
}));
img.DebugSave(provider, new { mode }); img.DebugSave(provider, new { mode });
} }
} }

16
tests/ImageSharp.Tests/Drawing/LineTests.cs

@ -50,13 +50,15 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{ {
image.Mutate(x => x image.Mutate(x => x
.BackgroundColor(Rgba32.Blue) .BackgroundColor(Rgba32.Blue)
.DrawLines(Rgba32.HotPink, 5, .DrawLines(
new SixLabors.Primitives.PointF[] { new GraphicsOptions(false),
new Vector2(10, 10), Rgba32.HotPink,
new Vector2(200, 150), 5,
new Vector2(50, 300) new SixLabors.Primitives.PointF[] {
}, new Vector2(10, 10),
new GraphicsOptions(false))); new Vector2(200, 150),
new Vector2(50, 300)
}));
image.Save($"{path}/Simple_noantialias.png"); image.Save($"{path}/Simple_noantialias.png");
using (PixelAccessor<Rgba32> sourcePixels = image.Lock()) using (PixelAccessor<Rgba32> sourcePixels = image.Lock())

4
tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs

@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
[Fact] [Fact]
public void CorrectlySetsBrushPathOptions() public void CorrectlySetsBrushPathOptions()
{ {
this.operations.Fill(this.brush, this.path, this.noneDefault); this.operations.Fill(this.noneDefault, this.brush, this.path);
var processor = this.Verify<FillRegionProcessor<Rgba32>>(); var processor = this.Verify<FillRegionProcessor<Rgba32>>();
Assert.Equal(this.noneDefault, processor.Options); Assert.Equal(this.noneDefault, processor.Options);
@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
[Fact] [Fact]
public void CorrectlySetsColorPathAndOptions() public void CorrectlySetsColorPathAndOptions()
{ {
this.operations.Fill(this.color, this.path, this.noneDefault); this.operations.Fill(this.noneDefault, this.color, this.path);
var processor = this.Verify<FillRegionProcessor<Rgba32>>(); var processor = this.Verify<FillRegionProcessor<Rgba32>>();
Assert.Equal(this.noneDefault, processor.Options); Assert.Equal(this.noneDefault, processor.Options);

6
tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs

@ -31,7 +31,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
})); }));
IPathCollection pathCollection; IPathCollection pathCollection;
public FillPathCollection() public FillPathCollection()
{ {
this.pathCollection = new PathCollection(this.path1, this.path2); this.pathCollection = new PathCollection(this.path1, this.path2);
@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
[Fact] [Fact]
public void CorrectlySetsBrushPathOptions() public void CorrectlySetsBrushPathOptions()
{ {
this.operations.Fill(this.brush, this.pathCollection, this.noneDefault); this.operations.Fill(this.noneDefault, this.brush, this.pathCollection);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
@ -100,7 +100,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
[Fact] [Fact]
public void CorrectlySetsColorPathAndOptions() public void CorrectlySetsColorPathAndOptions()
{ {
this.operations.Fill(this.color, this.pathCollection, this.noneDefault); this.operations.Fill(this.noneDefault, this.color, this.pathCollection);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {

4
tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs

@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
[Fact] [Fact]
public void CorrectlySetsBrushPathAndOptions() public void CorrectlySetsBrushPathAndOptions()
{ {
this.operations.FillPolygon(this.brush, this.path, this.noneDefault); this.operations.FillPolygon(this.noneDefault, this.brush, this.path);
FillRegionProcessor<Rgba32> processor = this.Verify<FillRegionProcessor<Rgba32>>(); FillRegionProcessor<Rgba32> processor = this.Verify<FillRegionProcessor<Rgba32>>();
Assert.Equal(this.noneDefault, processor.Options); Assert.Equal(this.noneDefault, processor.Options);
@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
[Fact] [Fact]
public void CorrectlySetsColorPathAndOptions() public void CorrectlySetsColorPathAndOptions()
{ {
this.operations.FillPolygon(this.color, this.path, this.noneDefault); this.operations.FillPolygon(this.noneDefault, this.color, this.path);
FillRegionProcessor<Rgba32> processor = this.Verify<FillRegionProcessor<Rgba32>>(); FillRegionProcessor<Rgba32> processor = this.Verify<FillRegionProcessor<Rgba32>>();

4
tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs

@ -38,7 +38,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
[Fact] [Fact]
public void CorrectlySetsBrushRectangleAndOptions() public void CorrectlySetsBrushRectangleAndOptions()
{ {
this.operations.Fill(this.brush, this.rectangle, this.noneDefault); this.operations.Fill(this.noneDefault, this.brush, this.rectangle);
FillRegionProcessor<Rgba32> processor = this.Verify<FillRegionProcessor<Rgba32>>(); FillRegionProcessor<Rgba32> processor = this.Verify<FillRegionProcessor<Rgba32>>();
Assert.Equal(this.noneDefault, processor.Options); Assert.Equal(this.noneDefault, processor.Options);
@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
[Fact] [Fact]
public void CorrectlySetsColorRectangleAndOptions() public void CorrectlySetsColorRectangleAndOptions()
{ {
this.operations.Fill(this.color, this.rectangle, this.noneDefault); this.operations.Fill(this.noneDefault, this.color, this.rectangle);
FillRegionProcessor<Rgba32> processor = this.Verify<FillRegionProcessor<Rgba32>>(); FillRegionProcessor<Rgba32> processor = this.Verify<FillRegionProcessor<Rgba32>>();
Assert.Equal(this.noneDefault, processor.Options); Assert.Equal(this.noneDefault, processor.Options);

6
tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs

@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
using (var image = new Image<Rgba32>(500, 500)) using (var image = new Image<Rgba32>(500, 500))
{ {
image.Mutate(x => x image.Mutate(x => x
.FillPolygon(Rgba32.HotPink, simplePath, new GraphicsOptions(true))); .FillPolygon(new GraphicsOptions(true), Rgba32.HotPink, simplePath));
image.Save($"{path}/Simple.png"); image.Save($"{path}/Simple.png");
using (PixelAccessor<Rgba32> sourcePixels = image.Lock()) using (PixelAccessor<Rgba32> sourcePixels = image.Lock())
@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
using (var image = new Image<Rgba32>(500, 500)) using (var image = new Image<Rgba32>(500, 500))
{ {
image.Mutate(x => x image.Mutate(x => x
.FillPolygon(Brushes.Horizontal(Rgba32.HotPink), simplePath, new GraphicsOptions(true))); .FillPolygon(new GraphicsOptions(true), Brushes.Horizontal(Rgba32.HotPink), simplePath));
image.Save($"{path}/Pattern.png"); image.Save($"{path}/Pattern.png");
using (PixelAccessor<Rgba32> sourcePixels = image.Lock()) using (PixelAccessor<Rgba32> sourcePixels = image.Lock())
@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{ {
image.Mutate(x => x image.Mutate(x => x
.BackgroundColor(Rgba32.Blue) .BackgroundColor(Rgba32.Blue)
.FillPolygon(Rgba32.HotPink, simplePath, new GraphicsOptions(false))); .FillPolygon(new GraphicsOptions(false), Rgba32.HotPink, simplePath));
image.Save($"{path}/Simple_NoAntialias.png"); image.Save($"{path}/Simple_NoAntialias.png");
using (PixelAccessor<Rgba32> sourcePixels = image.Lock()) using (PixelAccessor<Rgba32> sourcePixels = image.Lock())

22
tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs

@ -37,12 +37,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
public void FillsForEachACharachterWhenBrushSetAndNotPen() public void FillsForEachACharachterWhenBrushSetAndNotPen()
{ {
this.operations.DrawText( this.operations.DrawText(
new TextGraphicsOptions(true),
"123", "123",
this.Font, this.Font,
Brushes.Solid(Rgba32.Red), Brushes.Solid(Rgba32.Red),
null, null,
this.path, this.path);
new TextGraphicsOptions(true));
this.Verify<FillRegionProcessor<Rgba32>>(0); this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
[Fact] [Fact]
public void FillsForEachACharachterWhenBrushSet() public void FillsForEachACharachterWhenBrushSet()
{ {
this.operations.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), this.path, new TextGraphicsOptions(true)); this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Brushes.Solid(Rgba32.Red), this.path);
this.Verify<FillRegionProcessor<Rgba32>>(0); this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -82,7 +82,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
[Fact] [Fact]
public void FillsForEachACharachterWhenColorSet() public void FillsForEachACharachterWhenColorSet()
{ {
this.operations.DrawText("123", this.Font, Rgba32.Red, this.path, new TextGraphicsOptions(true)); this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Rgba32.Red, this.path);
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -109,12 +109,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
public void DrawForEachACharachterWhenPenSetAndNotBrush() public void DrawForEachACharachterWhenPenSetAndNotBrush()
{ {
this.operations.DrawText( this.operations.DrawText(
new TextGraphicsOptions(true),
"123", "123",
this.Font, this.Font,
null, null,
Pens.Dash(Rgba32.Red, 1), Pens.Dash(Rgba32.Red, 1),
this.path, this.path);
new TextGraphicsOptions(true));
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -134,7 +134,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
[Fact] [Fact]
public void DrawForEachACharachterWhenPenSet() public void DrawForEachACharachterWhenPenSet()
{ {
this.operations.DrawText("123", this.Font, Pens.Dash(Rgba32.Red, 1), this.path, new TextGraphicsOptions(true)); this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Pens.Dash(Rgba32.Red, 1), this.path);
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -155,12 +155,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
public void DrawForEachACharachterWhenPenSetAndFillFroEachWhenBrushSet() public void DrawForEachACharachterWhenPenSetAndFillFroEachWhenBrushSet()
{ {
this.operations.DrawText( this.operations.DrawText(
new TextGraphicsOptions(true),
"123", "123",
this.Font, this.Font,
Brushes.Solid(Rgba32.Red), Brushes.Solid(Rgba32.Red),
Pens.Dash(Rgba32.Red, 1), Pens.Dash(Rgba32.Red, 1),
this.path, this.path);
new TextGraphicsOptions(true));
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -187,12 +187,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
public void BrushAppliesBeforPen() public void BrushAppliesBeforPen()
{ {
this.operations.DrawText( this.operations.DrawText(
new TextGraphicsOptions(true),
"1", "1",
this.Font, this.Font,
Brushes.Solid(Rgba32.Red), Brushes.Solid(Rgba32.Red),
Pens.Dash(Rgba32.Red, 1), Pens.Dash(Rgba32.Red, 1),
this.path, this.path);
new TextGraphicsOptions(true));
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);

22
tests/ImageSharp.Tests/Drawing/Text/DrawText.cs

@ -37,12 +37,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
public void FillsForEachACharachterWhenBrushSetAndNotPen() public void FillsForEachACharachterWhenBrushSetAndNotPen()
{ {
this.operations.DrawText( this.operations.DrawText(
new TextGraphicsOptions(true),
"123", "123",
this.Font, this.Font,
Brushes.Solid(Rgba32.Red), Brushes.Solid(Rgba32.Red),
null, null,
Vector2.Zero, Vector2.Zero);
new TextGraphicsOptions(true));
this.Verify<FillRegionProcessor<Rgba32>>(0); this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
[Fact] [Fact]
public void FillsForEachACharachterWhenBrushSet() public void FillsForEachACharachterWhenBrushSet()
{ {
this.operations.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero, new TextGraphicsOptions(true)); this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero);
this.Verify<FillRegionProcessor<Rgba32>>(0); this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -82,7 +82,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
[Fact] [Fact]
public void FillsForEachACharachterWhenColorSet() public void FillsForEachACharachterWhenColorSet()
{ {
this.operations.DrawText("123", this.Font, Rgba32.Red, Vector2.Zero, new TextGraphicsOptions(true)); this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Rgba32.Red, Vector2.Zero);
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -109,12 +109,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
public void DrawForEachACharachterWhenPenSetAndNotBrush() public void DrawForEachACharachterWhenPenSetAndNotBrush()
{ {
this.operations.DrawText( this.operations.DrawText(
new TextGraphicsOptions(true),
"123", "123",
this.Font, this.Font,
null, null,
Pens.Dash(Rgba32.Red, 1), Pens.Dash(Rgba32.Red, 1),
Vector2.Zero, Vector2.Zero);
new TextGraphicsOptions(true));
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -134,7 +134,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
[Fact] [Fact]
public void DrawForEachACharachterWhenPenSet() public void DrawForEachACharachterWhenPenSet()
{ {
this.operations.DrawText("123", this.Font, Pens.Dash(Rgba32.Red, 1), Vector2.Zero, new TextGraphicsOptions(true)); this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Pens.Dash(Rgba32.Red, 1), Vector2.Zero);
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -155,12 +155,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
public void DrawForEachACharachterWhenPenSetAndFillFroEachWhenBrushSet() public void DrawForEachACharachterWhenPenSetAndFillFroEachWhenBrushSet()
{ {
this.operations.DrawText( this.operations.DrawText(
new TextGraphicsOptions(true),
"123", "123",
this.Font, this.Font,
Brushes.Solid(Rgba32.Red), Brushes.Solid(Rgba32.Red),
Pens.Dash(Rgba32.Red, 1), Pens.Dash(Rgba32.Red, 1),
Vector2.Zero, Vector2.Zero);
new TextGraphicsOptions(true));
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);
@ -188,12 +188,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
public void BrushAppliesBeforePen() public void BrushAppliesBeforePen()
{ {
this.operations.DrawText( this.operations.DrawText(
new TextGraphicsOptions(true),
"1", "1",
this.Font, this.Font,
Brushes.Solid(Rgba32.Red), Brushes.Solid(Rgba32.Red),
Pens.Dash(Rgba32.Red, 1), Pens.Dash(Rgba32.Red, 1),
Vector2.Zero, Vector2.Zero);
new TextGraphicsOptions(true));
var processor = this.Verify<FillRegionProcessor<Rgba32>>(0); var processor = this.Verify<FillRegionProcessor<Rgba32>>(0);
this.Verify<FillRegionProcessor<Rgba32>>(1); this.Verify<FillRegionProcessor<Rgba32>>(1);

8
tests/ImageSharp.Tests/Issues/Issue412.cs

@ -22,24 +22,24 @@ namespace SixLabors.ImageSharp.Tests.Issues
for (var i = 0; i < 40; ++i) for (var i = 0; i < 40; ++i)
{ {
context.DrawLines( context.DrawLines(
new GraphicsOptions(false),
NamedColors<TPixel>.Black, NamedColors<TPixel>.Black,
1, 1,
new[] new[]
{ {
new PointF(i, 0.1066f), new PointF(i, 0.1066f),
new PointF(i, 10.1066f) new PointF(i, 10.1066f)
}, });
new GraphicsOptions(true));
context.DrawLines( context.DrawLines(
new GraphicsOptions(false),
NamedColors<TPixel>.Red, NamedColors<TPixel>.Red,
1, 1,
new[] new[]
{ {
new PointF(i, 15.1066f), new PointF(i, 15.1066f),
new PointF(i, 25.1066f) new PointF(i, 25.1066f)
}, });
new GraphicsOptions(false));
} }
}); });

2
tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs

@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders
using (Image<Rgba32> src = srcFile.CreateImage()) using (Image<Rgba32> src = srcFile.CreateImage())
using (Image<Rgba32> dest = provider.GetImage()) using (Image<Rgba32> dest = provider.GetImage())
{ {
using (Image<Rgba32> res = dest.Clone(x => x.Blend(src, new GraphicsOptions { BlenderMode = mode }))) using (Image<Rgba32> res = dest.Clone(x => x.Blend(new GraphicsOptions { BlenderMode = mode }, src)))
{ {
res.DebugSave(provider, mode.ToString()); res.DebugSave(provider, mode.ToString());
res.CompareToReferenceOutput(provider, mode.ToString()); res.CompareToReferenceOutput(provider, mode.ToString());

4
tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs

@ -35,7 +35,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Effects
[Fact] [Fact]
public void BackgroundColor_amount_options_BackgroundColorProcessorDefaultsSet() public void BackgroundColor_amount_options_BackgroundColorProcessorDefaultsSet()
{ {
this.operations.BackgroundColor(Rgba32.BlanchedAlmond, this.options); this.operations.BackgroundColor(this.options, Rgba32.BlanchedAlmond);
var processor = this.Verify<BackgroundColorProcessor<Rgba32>>(); var processor = this.Verify<BackgroundColorProcessor<Rgba32>>();
Assert.Equal(this.options, processor.GraphicsOptions); Assert.Equal(this.options, processor.GraphicsOptions);
@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Effects
[Fact] [Fact]
public void BackgroundColor_amount_rect_options_BackgroundColorProcessorDefaultsSet() public void BackgroundColor_amount_rect_options_BackgroundColorProcessorDefaultsSet()
{ {
this.operations.BackgroundColor(Rgba32.BlanchedAlmond, this.rect, this.options); this.operations.BackgroundColor(this.options, Rgba32.BlanchedAlmond, this.rect);
var processor = this.Verify<BackgroundColorProcessor<Rgba32>>(this.rect); var processor = this.Verify<BackgroundColorProcessor<Rgba32>>(this.rect);
Assert.Equal(this.options, processor.GraphicsOptions); Assert.Equal(this.options, processor.GraphicsOptions);

Loading…
Cancel
Save