示例#1
0
 public static Color Highlight(Color color, int degree)
 {
     int r = color.R + degree;
     int g = color.G + degree;
     int b = color.B + degree;
     Range ColorRange = new Range(0, 255);
     return Color.FromArgb(color.A, (int)Clamp(r, ColorRange), (int)Clamp(g, ColorRange), (int)Clamp(b, ColorRange));
 }
示例#2
0
 public static double Clamp(double i, Range range)
 {
     if (range.Contains(i))
     {
         return i;
     }
     else
     {
         if (i <= range.Minimum)
         {
             return range.Minimum;
         }
         else
         {
             return range.Maximum;
         }
     }
 }