// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) James South.
// Licensed under the Apache License, Version 2.0.
//
//
// Encapsulates a series of time saving extension methods to the class.
//
// --------------------------------------------------------------------------------------------------------------------
namespace ImageProcessor.Extensions
{
///
/// Encapsulates a series of time saving extension methods to the class.
///
public static class DoubleExtensions
{
///
/// Converts an value into a valid .
///
/// If the value given is less than 0 or greater than 255, the value will be constrained into
/// those restricted ranges.
///
///
///
/// The to convert.
///
///
/// The .
///
public static byte ToByte(this double d)
{
return (byte)((d > byte.MaxValue) ? byte.MaxValue : ((d < byte.MinValue) ? byte.MinValue : d));
}
}
}