mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Former-commit-id: 6055bc865b95eeb9d89c3d6d5e7859ba7707f2e5 Former-commit-id: 552ea8768e0b173fd5fe103645da6c8f16cf143e Former-commit-id: 5594f396a9ffbb48272a27d1cd7d49e40021c399af/merge-core
2 changed files with 34 additions and 0 deletions
@ -0,0 +1,33 @@ |
|||
// <copyright file="Lanczos5Resampler.cs" company="James South">
|
|||
// Copyright © James South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageProcessor.Samplers |
|||
{ |
|||
/// <summary>
|
|||
/// The function implements the Lanczos kernel algorithm as described on
|
|||
/// <see href="https://en.wikipedia.org/wiki/Lanczos_resampling#Algorithm">Wikipedia</see>
|
|||
/// </summary>
|
|||
public class Lanczos5Resampler : IResampler |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public double Radius => 5; |
|||
|
|||
/// <inheritdoc/>
|
|||
public double GetValue(double x) |
|||
{ |
|||
if (x < 0) |
|||
{ |
|||
x = -x; |
|||
} |
|||
|
|||
if (x < 5) |
|||
{ |
|||
return ImageMaths.SinC(x) * ImageMaths.SinC(x / 5f); |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue