From ed92a3b2ceff80a4abfab099d73fc067336bacd2 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Tue, 11 Jul 2017 19:01:01 +0100 Subject: [PATCH] move methods --- src/ImageSharp/ApplyProcessors.cs | 11 ------- src/ImageSharp/Processing/Delegate.cs | 30 +++++++++++++++++++ .../DelegateProcessor.cs} | 8 ++--- .../{ => Processors}/ImageProcessor.cs | 0 4 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 src/ImageSharp/Processing/Delegate.cs rename src/ImageSharp/Processing/{DelegateImageProcessor.cs => Processors/DelegateProcessor.cs} (81%) rename src/ImageSharp/Processing/{ => Processors}/ImageProcessor.cs (100%) diff --git a/src/ImageSharp/ApplyProcessors.cs b/src/ImageSharp/ApplyProcessors.cs index a092b789b..9287c8367 100644 --- a/src/ImageSharp/ApplyProcessors.cs +++ b/src/ImageSharp/ApplyProcessors.cs @@ -85,16 +85,5 @@ namespace ImageSharp operationsRunner.ApplyProcessors(operations); return generated; } - - /// - /// Queues up a simple operation that provides access to the mutatable image. - /// - /// The pixel format. - /// The image to rotate, flip, or both. - /// The operations to perform on the source. - /// returns the current optinoatins class to allow chaining of oprations. - public static IImageOperations Run(this IImageOperations source, Action> operation) - where TPixel : struct, IPixel - => source.ApplyProcessor(new DelegateImageProcessor(operation)); } } diff --git a/src/ImageSharp/Processing/Delegate.cs b/src/ImageSharp/Processing/Delegate.cs new file mode 100644 index 000000000..52ec736f5 --- /dev/null +++ b/src/ImageSharp/Processing/Delegate.cs @@ -0,0 +1,30 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp +{ + using System; + + using ImageSharp.PixelFormats; + + using ImageSharp.Processing; + + /// + /// Extension methods for the type. + /// + public static partial class ImageExtensions + { + /// + /// Queues up a simple operation that provides access to the mutatable image. + /// + /// The pixel format. + /// The image to rotate, flip, or both. + /// The operations to perform on the source. + /// returns the current optinoatins class to allow chaining of oprations. + public static IImageOperations Run(this IImageOperations source, Action> operation) + where TPixel : struct, IPixel + => source.ApplyProcessor(new DelegateProcessor(operation)); + } +} diff --git a/src/ImageSharp/Processing/DelegateImageProcessor.cs b/src/ImageSharp/Processing/Processors/DelegateProcessor.cs similarity index 81% rename from src/ImageSharp/Processing/DelegateImageProcessor.cs rename to src/ImageSharp/Processing/Processors/DelegateProcessor.cs index e1d1060c6..f0d691777 100644 --- a/src/ImageSharp/Processing/DelegateImageProcessor.cs +++ b/src/ImageSharp/Processing/Processors/DelegateProcessor.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -15,16 +15,16 @@ namespace ImageSharp.Processing /// Allows the application of processors to images. /// /// The pixel format. - internal class DelegateImageProcessor : ImageProcessor + internal class DelegateProcessor : ImageProcessor where TPixel : struct, IPixel { private readonly Action> action; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The action. - public DelegateImageProcessor(Action> action) + public DelegateProcessor(Action> action) { this.action = action; } diff --git a/src/ImageSharp/Processing/ImageProcessor.cs b/src/ImageSharp/Processing/Processors/ImageProcessor.cs similarity index 100% rename from src/ImageSharp/Processing/ImageProcessor.cs rename to src/ImageSharp/Processing/Processors/ImageProcessor.cs