예제 #1
0
 /// <summary>
 /// Returns a new encoding mask that is a combination of color and alpha masks.
 /// </summary>
 /// <param name="colorEncoding"></param>
 /// <param name="alphaEncoding"></param>
 /// <returns></returns>
 public static uint CombineMasks(ColorEncodingMasks colorEncoding, AlphaEncodingMasks alphaEncoding)
 {
     return(colorMasks[(int)colorEncoding] | alphaMasks[(int)alphaEncoding]);
 }
예제 #2
0
 /// <summary>
 /// Returns a color with its red, green and blue channels encoded by a given number of bits.
 /// </summary>
 /// <param name="c">The base color.</param>
 /// <param name="colorEncoding">The color encoding used.</param>
 /// <param name="alphaEncoding">The alpha encoding used.</param>
 /// <returns></returns>
 public static Color CutAlpha(Color c, ColorEncodingMasks colorEncoding, AlphaEncodingMasks alphaEncoding)
 {
     return(Color.FromArgb(CutBits(c.ToArgb(), CombineMasks(colorEncoding, alphaEncoding))));
 }