Example #1
0
 public Color ToColor()
 {
     return(Color.FromArgb(
                MathExtension.Clamp((int)(A * 255.0f), 0, 255),
                MathExtension.Clamp((int)(R * 255.0f), 0, 255),
                MathExtension.Clamp((int)(G * 255.0f), 0, 255),
                MathExtension.Clamp((int)(B * 255.0f), 0, 255)));
 }
Example #2
0
 /// <summary>
 /// The image is conceptually wrapped (or tiled) and values are taken from the
 /// opposite edge or corner.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 public static void Wrap(ref int x, ref int y, int width, int height)
 {
     x = MathExtension.Fmod(x, width - 1);
     y = MathExtension.Fmod(y, height - 1);
 }
Example #3
0
 /// <summary>
 /// The nearest border pixels are conceptually extended as far as necessary to
 /// provide values for the convolution. Corner pixels are extended in 90° wedges.
 /// Other edge pixels are extended in lines.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 public static void Extend(ref int x, ref int y, int width, int height)
 {
     x = MathExtension.Clamp(x, 0, width - 1);
     y = MathExtension.Clamp(y, 0, height - 1);
 }