mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Former-commit-id: 9ddf97eb0300834d945db627e4c500e67fbf1fb7 Former-commit-id: c9a893530a085724596af1054492d125dc0355ea Former-commit-id: 3266f3ce095fd3f865d0e540e6096f794de70c4fpull/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