|
| 1 | +// Copyright (c) Six Labors and contributors. |
| 2 | +// Licensed under the Apache License, Version 2.0. |
| 3 | + |
| 4 | +using SixLabors.ImageSharp.PixelFormats; |
| 5 | +using SixLabors.ImageSharp.Processing.Processors.Effects; |
| 6 | + |
| 7 | +namespace SixLabors.ImageSharp.Processing |
| 8 | +{ |
| 9 | + /// <summary> |
| 10 | + /// Defines extension methods that allow the application of user defined processing delegate to an <see cref="Image"/>. |
| 11 | + /// </summary> |
| 12 | + public static class PixelRowDelegateExtensions |
| 13 | + { |
| 14 | + /// <summary> |
| 15 | + /// Applies a user defined processing delegate to the image. |
| 16 | + /// </summary> |
| 17 | + /// <param name="source">The image this method extends.</param> |
| 18 | + /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param> |
| 19 | + /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> |
| 20 | + public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation) |
| 21 | + => ProcessPixelRowsAsVector4(source, rowOperation, PixelConversionModifiers.None); |
| 22 | + |
| 23 | + /// <summary> |
| 24 | + /// Applies a user defined processing delegate to the image. |
| 25 | + /// </summary> |
| 26 | + /// <param name="source">The image this method extends.</param> |
| 27 | + /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param> |
| 28 | + /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param> |
| 29 | + /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> |
| 30 | + public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, PixelConversionModifiers modifiers) |
| 31 | + => source.ApplyProcessor(new PixelRowDelegateProcessor(rowOperation, modifiers)); |
| 32 | + |
| 33 | + /// <summary> |
| 34 | + /// Applies a user defined processing delegate to the image. |
| 35 | + /// </summary> |
| 36 | + /// <param name="source">The image this method extends.</param> |
| 37 | + /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param> |
| 38 | + /// <param name="rectangle"> |
| 39 | + /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. |
| 40 | + /// </param> |
| 41 | + /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> |
| 42 | + public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle) |
| 43 | + => ProcessPixelRowsAsVector4(source, rowOperation, rectangle, PixelConversionModifiers.None); |
| 44 | + |
| 45 | + /// <summary> |
| 46 | + /// Applies a user defined processing delegate to the image. |
| 47 | + /// </summary> |
| 48 | + /// <param name="source">The image this method extends.</param> |
| 49 | + /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param> |
| 50 | + /// <param name="rectangle"> |
| 51 | + /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. |
| 52 | + /// </param> |
| 53 | + /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param> |
| 54 | + /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> |
| 55 | + public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle, PixelConversionModifiers modifiers) |
| 56 | + => source.ApplyProcessor(new PixelRowDelegateProcessor(rowOperation, modifiers), rectangle); |
| 57 | + |
| 58 | + /// <summary> |
| 59 | + /// Applies a user defined processing delegate to the image. |
| 60 | + /// </summary> |
| 61 | + /// <param name="source">The image this method extends.</param> |
| 62 | + /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param> |
| 63 | + /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> |
| 64 | + public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation<Point> rowOperation) |
| 65 | + => ProcessPixelRowsAsVector4(source, rowOperation, PixelConversionModifiers.None); |
| 66 | + |
| 67 | + /// <summary> |
| 68 | + /// Applies a user defined processing delegate to the image. |
| 69 | + /// </summary> |
| 70 | + /// <param name="source">The image this method extends.</param> |
| 71 | + /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param> |
| 72 | + /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param> |
| 73 | + /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> |
| 74 | + public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation<Point> rowOperation, PixelConversionModifiers modifiers) |
| 75 | + => source.ApplyProcessor(new PositionAwarePixelRowDelegateProcessor(rowOperation, modifiers)); |
| 76 | + |
| 77 | + /// <summary> |
| 78 | + /// Applies a user defined processing delegate to the image. |
| 79 | + /// </summary> |
| 80 | + /// <param name="source">The image this method extends.</param> |
| 81 | + /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param> |
| 82 | + /// <param name="rectangle"> |
| 83 | + /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. |
| 84 | + /// </param> |
| 85 | + /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> |
| 86 | + public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation<Point> rowOperation, Rectangle rectangle) |
| 87 | + => ProcessPixelRowsAsVector4(source, rowOperation, rectangle, PixelConversionModifiers.None); |
| 88 | + |
| 89 | + /// <summary> |
| 90 | + /// Applies a user defined processing delegate to the image. |
| 91 | + /// </summary> |
| 92 | + /// <param name="source">The image this method extends.</param> |
| 93 | + /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param> |
| 94 | + /// <param name="rectangle"> |
| 95 | + /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. |
| 96 | + /// </param> |
| 97 | + /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param> |
| 98 | + /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> |
| 99 | + public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation<Point> rowOperation, Rectangle rectangle, PixelConversionModifiers modifiers) |
| 100 | + => source.ApplyProcessor(new PositionAwarePixelRowDelegateProcessor(rowOperation, modifiers), rectangle); |
| 101 | + } |
| 102 | +} |
0 commit comments