mirror of https://github.com/SixLabors/ImageSharp
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.
23 lines
682 B
23 lines
682 B
// <copyright file="NearestNeighborResampler.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageProcessor.Samplers
|
|
{
|
|
/// <summary>
|
|
/// The function implements the nearest neighbour algorithm. This uses an unscaled filter
|
|
/// which will select the closest pixel to the new pixels position.
|
|
/// </summary>
|
|
public class NearestNeighborResampler : IResampler
|
|
{
|
|
/// <inheritdoc/>
|
|
public float Radius => 1;
|
|
|
|
/// <inheritdoc/>
|
|
public float GetValue(float x)
|
|
{
|
|
return x;
|
|
}
|
|
}
|
|
}
|
|
|