📷 A modern, cross-platform, 2D Graphics library for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
856 B

// <copyright file="BicubicResampler.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 Lanczos3Resampler : IResampler
{
/// <inheritdoc/>
public double Radius => 3;
/// <inheritdoc/>
public double GetValue(double x)
{
if (x < 0)
{
x = -x;
}
if (x < 3)
{
return ImageMaths.SinC(x) * ImageMaths.SinC(x / 3f);
}
return 0;
}
}
}