Browse Source

removed extension method

af/merge-core
Scott Williams 9 years ago
parent
commit
7f9a32b80a
  1. 2
      src/ImageSharp.Drawing.Paths/DrawLines.cs
  2. 3
      src/ImageSharp.Drawing/DrawImage.cs
  3. 3
      src/ImageSharp.Processing/Binarization/BinaryThreshold.cs
  4. 3
      src/ImageSharp.Processing/ColorMatrix/BlackWhite.cs
  5. 3
      src/ImageSharp.Processing/ColorMatrix/ColorBlindness.cs
  6. 3
      src/ImageSharp.Processing/ColorMatrix/Grayscale.cs
  7. 3
      src/ImageSharp.Processing/ColorMatrix/Hue.cs
  8. 3
      src/ImageSharp.Processing/ColorMatrix/Kodachrome.cs
  9. 3
      src/ImageSharp.Processing/ColorMatrix/Lomograph.cs
  10. 3
      src/ImageSharp.Processing/ColorMatrix/Polaroid.cs
  11. 3
      src/ImageSharp.Processing/ColorMatrix/Saturation.cs
  12. 3
      src/ImageSharp.Processing/ColorMatrix/Sepia.cs
  13. 3
      src/ImageSharp.Processing/Convolution/BoxBlur.cs
  14. 3
      src/ImageSharp.Processing/Convolution/DetectEdges.cs
  15. 3
      src/ImageSharp.Processing/Convolution/GaussianBlur.cs
  16. 3
      src/ImageSharp.Processing/Convolution/GaussianSharpen.cs
  17. 3
      src/ImageSharp.Processing/Effects/Alpha.cs
  18. 3
      src/ImageSharp.Processing/Effects/BackgroundColor.cs
  19. 5
      src/ImageSharp.Processing/Effects/Brightness.cs
  20. 3
      src/ImageSharp.Processing/Effects/Contrast.cs
  21. 3
      src/ImageSharp.Processing/Effects/Invert.cs
  22. 3
      src/ImageSharp.Processing/Effects/OilPainting.cs
  23. 3
      src/ImageSharp.Processing/Effects/Pixelate.cs
  24. 3
      src/ImageSharp.Processing/Overlays/Glow.cs
  25. 3
      src/ImageSharp.Processing/Overlays/Vignette.cs
  26. 4
      src/ImageSharp.Processing/Transforms/Crop.cs
  27. 4
      src/ImageSharp.Processing/Transforms/EntropyCrop.cs
  28. 4
      src/ImageSharp.Processing/Transforms/Flip.cs
  29. 3
      src/ImageSharp.Processing/Transforms/Resize.cs
  30. 4
      src/ImageSharp.Processing/Transforms/Rotate.cs
  31. 4
      src/ImageSharp.Processing/Transforms/Skew.cs
  32. 19
      src/ImageSharp/Image/ImageProcessingExtensions.cs

2
src/ImageSharp.Drawing.Paths/DrawLines.cs

@ -13,8 +13,6 @@ namespace ImageSharp
using Drawing.Processors;
using SixLabors.Shapes;
using Path = SixLabors.Shapes.Path;
/// <summary>
/// Extension methods for the <see cref="Image{TColor}"/> type.
/// </summary>

3
src/ImageSharp.Drawing/DrawImage.cs

@ -51,7 +51,8 @@ namespace ImageSharp
location = Point.Empty;
}
return source.Apply(source.Bounds, new DrawImageProcessor<TColor>(image, size, location, percent));
source.ApplyProcessor(new DrawImageProcessor<TColor>(image, size, location, percent), source.Bounds);
return source;
}
}
}

3
src/ImageSharp.Processing/Binarization/BinaryThreshold.cs

@ -40,7 +40,8 @@ namespace ImageSharp
public static Image<TColor> BinaryThreshold<TColor>(this Image<TColor> source, float threshold, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new BinaryThresholdProcessor<TColor>(threshold));
source.ApplyProcessor(new BinaryThresholdProcessor<TColor>(threshold), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/ColorMatrix/BlackWhite.cs

@ -39,7 +39,8 @@ namespace ImageSharp
public static Image<TColor> BlackWhite<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new BlackWhiteProcessor<TColor>());
source.ApplyProcessor(new BlackWhiteProcessor<TColor>(), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/ColorMatrix/ColorBlindness.cs

@ -78,7 +78,8 @@ namespace ImageSharp
break;
}
return source.Apply(rectangle, processor);
source.ApplyProcessor(processor, rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/ColorMatrix/Grayscale.cs

@ -45,7 +45,8 @@ namespace ImageSharp
? (IImageProcessor<TColor>)new GrayscaleBt709Processor<TColor>()
: new GrayscaleBt601Processor<TColor>();
return source.Apply(rectangle, processor);
source.ApplyProcessor(processor, rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/ColorMatrix/Hue.cs

@ -41,7 +41,8 @@ namespace ImageSharp
public static Image<TColor> Hue<TColor>(this Image<TColor> source, float degrees, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new HueProcessor<TColor>(degrees));
source.ApplyProcessor(new HueProcessor<TColor>(degrees), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/ColorMatrix/Kodachrome.cs

@ -39,7 +39,8 @@ namespace ImageSharp
public static Image<TColor> Kodachrome<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new KodachromeProcessor<TColor>());
source.ApplyProcessor(new KodachromeProcessor<TColor>(), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/ColorMatrix/Lomograph.cs

@ -39,7 +39,8 @@ namespace ImageSharp
public static Image<TColor> Lomograph<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new LomographProcessor<TColor>());
source.ApplyProcessor(new LomographProcessor<TColor>(), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/ColorMatrix/Polaroid.cs

@ -39,7 +39,8 @@ namespace ImageSharp
public static Image<TColor> Polaroid<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new PolaroidProcessor<TColor>());
source.ApplyProcessor(new PolaroidProcessor<TColor>(), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/ColorMatrix/Saturation.cs

@ -41,7 +41,8 @@ namespace ImageSharp
public static Image<TColor> Saturation<TColor>(this Image<TColor> source, int amount, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new SaturationProcessor<TColor>(amount));
source.ApplyProcessor(new SaturationProcessor<TColor>(amount), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/ColorMatrix/Sepia.cs

@ -39,7 +39,8 @@ namespace ImageSharp
public static Image<TColor> Sepia<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new SepiaProcessor<TColor>());
source.ApplyProcessor(new SepiaProcessor<TColor>(), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Convolution/BoxBlur.cs

@ -41,7 +41,8 @@ namespace ImageSharp
public static Image<TColor> BoxBlur<TColor>(this Image<TColor> source, int radius, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new BoxBlurProcessor<TColor>(radius));
source.ApplyProcessor(new BoxBlurProcessor<TColor>(), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Convolution/DetectEdges.cs

@ -146,7 +146,8 @@ namespace ImageSharp
public static Image<TColor> DetectEdges<TColor>(this Image<TColor> source, Rectangle rectangle, IEdgeDetectorProcessor<TColor> filter)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, filter);
source.ApplyProcessor(filter, rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Convolution/GaussianBlur.cs

@ -41,7 +41,8 @@ namespace ImageSharp
public static Image<TColor> GaussianBlur<TColor>(this Image<TColor> source, float sigma, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new GaussianBlurProcessor<TColor>(sigma));
source.ApplyProcessor(new GaussianBlurProcessor<TColor>(sigma), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Convolution/GaussianSharpen.cs

@ -41,7 +41,8 @@ namespace ImageSharp
public static Image<TColor> GaussianSharpen<TColor>(this Image<TColor> source, float sigma, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new GaussianSharpenProcessor<TColor>(sigma));
source.ApplyProcessor(new GaussianSharpenProcessor<TColor>(sigma), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Effects/Alpha.cs

@ -40,7 +40,8 @@ namespace ImageSharp
public static Image<TColor> Alpha<TColor>(this Image<TColor> source, int percent, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new AlphaProcessor<TColor>(percent));
source.ApplyProcessor(new AlphaProcessor<TColor>(percent), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Effects/BackgroundColor.cs

@ -24,7 +24,8 @@ namespace ImageSharp
public static Image<TColor> BackgroundColor<TColor>(this Image<TColor> source, TColor color)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(source.Bounds, new BackgroundColorProcessor<TColor>(color));
source.ApplyProcessor(new BackgroundColorProcessor<TColor>(color), source.Bounds);
return source;
}
}
}

5
src/ImageSharp.Processing/Effects/Brightness.cs

@ -39,8 +39,9 @@ namespace ImageSharp
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Brightness<TColor>(this Image<TColor> source, int amount, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new BrightnessProcessor<TColor>(amount));
{
source.ApplyProcessor(new BrightnessProcessor<TColor>(amount), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Effects/Contrast.cs

@ -40,7 +40,8 @@ namespace ImageSharp
public static Image<TColor> Contrast<TColor>(this Image<TColor> source, int amount, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new ContrastProcessor<TColor>(amount));
source.ApplyProcessor(new ContrastProcessor<TColor>(amount), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Effects/Invert.cs

@ -38,7 +38,8 @@ namespace ImageSharp
public static Image<TColor> Invert<TColor>(this Image<TColor> source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return source.Apply(rectangle, new InvertProcessor<TColor>());
source.ApplyProcessor(new InvertProcessor<TColor>(), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Effects/OilPainting.cs

@ -49,7 +49,8 @@ namespace ImageSharp
throw new ArgumentOutOfRangeException(nameof(brushSize));
}
return source.Apply(rectangle, new OilPaintingProcessor<TColor>(levels, brushSize));
source.ApplyProcessor(new OilPaintingProcessor<TColor>(levels, brushSize), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Effects/Pixelate.cs

@ -45,7 +45,8 @@ namespace ImageSharp
throw new ArgumentOutOfRangeException(nameof(size));
}
return source.Apply(rectangle, new PixelateProcessor<TColor>(size));
source.ApplyProcessor(new PixelateProcessor<TColor>(size), rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Overlays/Glow.cs

@ -88,7 +88,8 @@ namespace ImageSharp
processor.GlowColor = color;
}
return source.Apply(rectangle, processor);
source.ApplyProcessor(processor, rectangle);
return source;
}
}
}

3
src/ImageSharp.Processing/Overlays/Vignette.cs

@ -90,7 +90,8 @@ namespace ImageSharp
processor.VignetteColor = color;
}
return source.Apply(rectangle, processor);
source.ApplyProcessor(processor, rectangle);
return source;
}
}
}

4
src/ImageSharp.Processing/Transforms/Crop.cs

@ -41,7 +41,9 @@ namespace ImageSharp
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
CropProcessor<TColor> processor = new CropProcessor<TColor>(cropRectangle);
return source.Apply(source.Bounds, processor);
source.ApplyProcessor(processor, source.Bounds);
return source;
}
}
}

4
src/ImageSharp.Processing/Transforms/EntropyCrop.cs

@ -25,7 +25,9 @@ namespace ImageSharp
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
EntropyCropProcessor<TColor> processor = new EntropyCropProcessor<TColor>(threshold);
return source.Apply(source.Bounds, processor);
source.ApplyProcessor(processor, source.Bounds);
return source;
}
}
}

4
src/ImageSharp.Processing/Transforms/Flip.cs

@ -26,7 +26,9 @@ namespace ImageSharp
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
FlipProcessor<TColor> processor = new FlipProcessor<TColor>(flipType);
return source.Apply(source.Bounds, processor);
source.ApplyProcessor(processor, source.Bounds);
return source;
}
}
}

3
src/ImageSharp.Processing/Transforms/Resize.cs

@ -167,7 +167,8 @@ namespace ImageSharp
processor = new ResizeProcessor<TColor>(sampler, width, height, targetRectangle);
}
return source.Apply(sourceRectangle, processor);
source.ApplyProcessor(processor, sourceRectangle);
return source;
}
}
}

4
src/ImageSharp.Processing/Transforms/Rotate.cs

@ -53,7 +53,9 @@ namespace ImageSharp
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
RotateProcessor<TColor> processor = new RotateProcessor<TColor> { Angle = degrees, Expand = expand };
return source.Apply(source.Bounds, processor);
source.ApplyProcessor(processor, source.Bounds);
return source;
}
}
}

4
src/ImageSharp.Processing/Transforms/Skew.cs

@ -41,7 +41,9 @@ namespace ImageSharp
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
SkewProcessor<TColor> processor = new SkewProcessor<TColor> { AngleX = degreesX, AngleY = degreesY, Expand = expand };
return source.Apply(source.Bounds, processor);
source.ApplyProcessor(processor, source.Bounds);
return source;
}
}
}

19
src/ImageSharp/Image/ImageProcessingExtensions.cs

@ -24,24 +24,7 @@ namespace ImageSharp
public static Image<TColor> Apply<TColor>(this Image<TColor> source, IImageProcessor<TColor> processor)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
return Apply(source, source.Bounds, processor);
}
/// <summary>
/// Applies the processor to the image.
/// <remarks>This method does not resize the target image.</remarks>
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="sourceRectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to draw.
/// </param>
/// <param name="processor">The processors to apply to the image.</param>
/// <returns>The <see cref="Image{TColor}"/>.</returns>
public static Image<TColor> Apply<TColor>(this Image<TColor> source, Rectangle sourceRectangle, IImageProcessor<TColor> processor)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
source.ApplyProcessor(processor, sourceRectangle);
source.ApplyProcessor(processor, source.Bounds);
return source;
}
}

Loading…
Cancel
Save