-
-
Notifications
You must be signed in to change notification settings - Fork 852
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1011 from SixLabors/feature/processors
Make processors public, refactor cloning.
- Loading branch information
Showing
30 changed files
with
343 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/ImageSharp/Processing/Processors/CloningImageProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) Six Labors and contributors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
using SixLabors.ImageSharp.PixelFormats; | ||
using SixLabors.Primitives; | ||
|
||
namespace SixLabors.ImageSharp.Processing.Processors | ||
{ | ||
/// <summary> | ||
/// The base class for all cloning image processors. | ||
/// </summary> | ||
public abstract class CloningImageProcessor : ICloningImageProcessor | ||
{ | ||
/// <inheritdoc/> | ||
public abstract ICloningImageProcessor<TPixel> CreatePixelSpecificCloningProcessor<TPixel>(Image<TPixel> source, Rectangle sourceRectangle) | ||
where TPixel : struct, IPixel<TPixel>; | ||
|
||
/// <inheritdoc/> | ||
IImageProcessor<TPixel> IImageProcessor.CreatePixelSpecificProcessor<TPixel>(Image<TPixel> source, Rectangle sourceRectangle) | ||
=> this.CreatePixelSpecificCloningProcessor(source, sourceRectangle); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/ImageSharp/Processing/Processors/ICloningImageProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Six Labors and contributors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
using SixLabors.ImageSharp.PixelFormats; | ||
using SixLabors.Primitives; | ||
|
||
namespace SixLabors.ImageSharp.Processing.Processors | ||
{ | ||
/// <summary> | ||
/// Defines an algorithm to alter the pixels of a cloned image. | ||
/// </summary> | ||
public interface ICloningImageProcessor : IImageProcessor | ||
{ | ||
/// <summary> | ||
/// Creates a pixel specific <see cref="ICloningImageProcessor{TPixel}"/> that is capable of executing | ||
/// the processing algorithm on an <see cref="Image{TPixel}"/>. | ||
/// </summary> | ||
/// <typeparam name="TPixel">The pixel type.</typeparam> | ||
/// <param name="source">The source image. Cannot be null.</param> | ||
/// <param name="sourceRectangle"> | ||
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to draw. | ||
/// </param> | ||
/// <returns>The <see cref="ICloningImageProcessor{TPixel}"/></returns> | ||
ICloningImageProcessor<TPixel> CreatePixelSpecificCloningProcessor<TPixel>(Image<TPixel> source, Rectangle sourceRectangle) | ||
where TPixel : struct, IPixel<TPixel>; | ||
} | ||
} |
Oops, something went wrong.