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

28 lines
749 B

// <copyright file="BoxResampler.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 box algorithm. Similar to nearest neighbour when upscaling.
/// When downscaling the pixels will average, merging together.
/// </summary>
public class BoxResampler : IResampler
{
/// <inheritdoc/>
public float Radius => 0.5F;
/// <inheritdoc/>
public float GetValue(float x)
{
if (x > -0.5F && x <= 0.5F)
{
return 1;
}
return 0;
}
}
}