mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Former-commit-id: 894501ba723e1643831c3917acb0bd7e064fc75b Former-commit-id: a1bce60477ba5acdf54f4432bdb646bd95326f29 Former-commit-id: c539e6aeab3edf3ebde7658fece6972c321b7362pull/17/head
6 changed files with 42 additions and 6 deletions
@ -0,0 +1,33 @@ |
|||
// <copyright file="Lanczos3Resampler.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 Lanczos8Resampler : IResampler |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public double Radius => 8; |
|||
|
|||
/// <inheritdoc/>
|
|||
public double GetValue(double x) |
|||
{ |
|||
if (x < 0) |
|||
{ |
|||
x = -x; |
|||
} |
|||
|
|||
if (x < 8) |
|||
{ |
|||
return ImageMaths.SinC(x) * ImageMaths.SinC(x / 8f); |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
} |
|||
} |
|||
|
After Width: | Height: | Size: 52 KiB |
Loading…
Reference in new issue