@ -2,16 +2,15 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats ;
using SixLabors.ImageSharp.Processing ;
using SixLabors.ImageSharp.Processing.Processors ;
using SixLabors.ImageSharp.Processing.Transforms.Processors ;
using SixLabors.Primitives ;
namespace SixLabors.ImageSharp
namespace SixLabors.ImageSharp.Processing.Transforms
{
/// <summary>
/// Extension methods for the <see cref="Image{TPixel}"/> type.
/// Adds extensions that allow the application of resize operations to the <see cref="Image{TPixel}"/> type.
/// </summary>
public static partial class Imag eExtensions
public static class Resiz eExtensions
{
/// <summary>
/// Resizes an image in accordance with the given <see cref="ResizeOptions"/>.
@ -23,7 +22,7 @@ namespace SixLabors.ImageSharp
/// <remarks>Passing zero for one of height or width within the resize options will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext < TPixel > Resize < TPixel > ( this IImageProcessingContext < TPixel > source , ResizeOptions options )
where TPixel : struct , IPixel < TPixel >
= > source . ApplyProcessor ( new ResizeProcessor < TPixel > ( options , source . GetCurrentSize ( ) ) ) ;
= > source . ApplyProcessor ( new ResizeProcessor < TPixel > ( options , source . GetCurrentSize ( ) ) ) ;
/// <summary>
/// Resizes an image to the given <see cref="Size"/>.
@ -35,7 +34,7 @@ namespace SixLabors.ImageSharp
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext < TPixel > Resize < TPixel > ( this IImageProcessingContext < TPixel > source , Size size )
where TPixel : struct , IPixel < TPixel >
= > Resize ( source , size . Width , size . Height , Resamplers . Bicubic , false ) ;
= > Resize ( source , size . Width , size . Height , Resamplers . Bicubic , false ) ;
/// <summary>
/// Resizes an image to the given <see cref="Size"/>.
@ -48,7 +47,7 @@ namespace SixLabors.ImageSharp
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext < TPixel > Resize < TPixel > ( this IImageProcessingContext < TPixel > source , Size size , bool compand )
where TPixel : struct , IPixel < TPixel >
= > Resize ( source , size . Width , size . Height , Resamplers . Bicubic , compand ) ;
= > Resize ( source , size . Width , size . Height , Resamplers . Bicubic , compand ) ;
/// <summary>
/// Resizes an image to the given width and height.
@ -61,7 +60,7 @@ namespace SixLabors.ImageSharp
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext < TPixel > Resize < TPixel > ( this IImageProcessingContext < TPixel > source , int width , int height )
where TPixel : struct , IPixel < TPixel >
= > Resize ( source , width , height , Resamplers . Bicubic , false ) ;
= > Resize ( source , width , height , Resamplers . Bicubic , false ) ;
/// <summary>
/// Resizes an image to the given width and height.
@ -75,7 +74,7 @@ namespace SixLabors.ImageSharp
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext < TPixel > Resize < TPixel > ( this IImageProcessingContext < TPixel > source , int width , int height , bool compand )
where TPixel : struct , IPixel < TPixel >
= > Resize ( source , width , height , Resamplers . Bicubic , compand ) ;
= > Resize ( source , width , height , Resamplers . Bicubic , compand ) ;
/// <summary>
/// Resizes an image to the given width and height with the given sampler.
@ -89,7 +88,7 @@ namespace SixLabors.ImageSharp
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext < TPixel > Resize < TPixel > ( this IImageProcessingContext < TPixel > source , int width , int height , IResampler sampler )
where TPixel : struct , IPixel < TPixel >
= > Resize ( source , width , height , sampler , false ) ;
= > Resize ( source , width , height , sampler , false ) ;
/// <summary>
/// Resizes an image to the given width and height with the given sampler.
@ -103,7 +102,7 @@ namespace SixLabors.ImageSharp
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext < TPixel > Resize < TPixel > ( this IImageProcessingContext < TPixel > source , Size size , IResampler sampler , bool compand )
where TPixel : struct , IPixel < TPixel >
= > Resize ( source , size . Width , size . Height , sampler , new Rectangle ( 0 , 0 , size . Width , size . Height ) , compand ) ;
= > Resize ( source , size . Width , size . Height , sampler , new Rectangle ( 0 , 0 , size . Width , size . Height ) , compand ) ;
/// <summary>
/// Resizes an image to the given width and height with the given sampler.
@ -118,7 +117,7 @@ namespace SixLabors.ImageSharp
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image</remarks>
public static IImageProcessingContext < TPixel > Resize < TPixel > ( this IImageProcessingContext < TPixel > source , int width , int height , IResampler sampler , bool compand )
where TPixel : struct , IPixel < TPixel >
= > Resize ( source , width , height , sampler , new Rectangle ( 0 , 0 , width , height ) , compand ) ;
= > Resize ( source , width , height , sampler , new Rectangle ( 0 , 0 , width , height ) , compand ) ;
/// <summary>
/// Resizes an image to the given width and height with the given sampler and
@ -147,7 +146,7 @@ namespace SixLabors.ImageSharp
Rectangle targetRectangle ,
bool compand )
where TPixel : struct , IPixel < TPixel >
= > source . ApplyProcessor ( new ResizeProcessor < TPixel > ( sampler , width , height , source . GetCurrentSize ( ) , targetRectangle , compand ) , sourceRectangle ) ;
= > source . ApplyProcessor ( new ResizeProcessor < TPixel > ( sampler , width , height , source . GetCurrentSize ( ) , targetRectangle , compand ) , sourceRectangle ) ;
/// <summary>
/// Resizes an image to the given width and height with the given sampler and source rectangle.
@ -171,6 +170,6 @@ namespace SixLabors.ImageSharp
Rectangle targetRectangle ,
bool compand )
where TPixel : struct , IPixel < TPixel >
= > source . ApplyProcessor ( new ResizeProcessor < TPixel > ( sampler , width , height , source . GetCurrentSize ( ) , targetRectangle , compand ) ) ;
= > source . ApplyProcessor ( new ResizeProcessor < TPixel > ( sampler , width , height , source . GetCurrentSize ( ) , targetRectangle , compand ) ) ;
}
}