Download DitheringTest.zip version 1.0.0.0, last updated 06/06/2015 (757.89 KB)

Download
  • md5: 960d00ff8054b8711bf56c562a141126
/* Dithering an image using the Floyd–Steinberg algorithm in C#
 * http://www.cyotek.com/blog/dithering-an-image-using-the-floyd-steinberg-algorithm-in-csharp
 *
 * Copyright © 2015 Cyotek Ltd.
 *
 * Licensed under the MIT License. See LICENSE.txt for the full text.
 */

namespace Cyotek.DitheringTest.Helpers
{
  internal static class IntegerExtensions
  {
    #region Static Methods

    internal static byte ToByte(this int value)
    {
      if (value < 0)
      {
        value = 0;
      }
      else if (value > 255)
      {
        value = 255;
      }

      return (byte)value;
    }

    #endregion
  }
}

Donate

Donate