📷 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.
 
 

34 lines
901 B

// <copyright file="Lanczos8Resampler.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageProcessorCore
{
/// <summary>
/// The function implements the Lanczos kernel algorithm as described on
/// <see href="https://en.wikipedia.org/wiki/Lanczos_resampling#Algorithm">Wikipedia</see>
/// with a radius of 8 pixels.
/// </summary>
public class Lanczos8Resampler : IResampler
{
/// <inheritdoc/>
public float Radius => 8;
/// <inheritdoc/>
public float GetValue(float x)
{
if (x < 0)
{
x = -x;
}
if (x < 8)
{
return ImageMaths.SinC(x) * ImageMaths.SinC(x / 8f);
}
return 0;
}
}
}