This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ColorExtensions | |
{ | |
/// <summary> | |
/// Tints the color by the given percent. | |
/// </summary> | |
/// <param name="color">The color being tinted.</param> | |
/// <param name="percent">The percent to tint. Ex: 0.1 will make the color 10% lighter.</param> | |
/// <returns>The new tinted color.</returns> | |
public static Color Lighten( this Color color, float percent ) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** round n down to nearest multiple of m */ | |
long roundDown(long n, long m) { | |
return n >= 0 ? (n / m) * m : ((n - m + 1) / m) * m; | |
} | |
/** round n up to nearest multiple of m */ | |
long roundUp(long n, long m) { | |
return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m; | |
} |
NewerOlder