Пример #1
0
 /// <summary>
 /// Draws an image, but hue-shifted by the hue color given and intensity desired.
 /// </summary>
 /// <param name="g">The graphics to draw to.</param>
 /// <param name="image">The image to draw.</param>
 /// <param name="destRect">The rectangle the image should draw in.</param>
 /// <param name="hueColor">The color to shift the hue to.</param>
 /// <param name="intensity">A multiplier describing how intense the hue shift should be, defauls to 1.0.</param>
 /// <param name="srcX">The source x of the image to draw from. Defaults to 0 (left).</param>
 /// <param name="srcY">The source y of the image to draw from. Defaults to 0 (top).</param>
 /// <param name="srcWidth">The source width of the image to draw from. Defaults to -1 (will use Image.Width).</param>
 /// <param name="srcHeight">The source height of the image to draw from. Defaults to -1 (will use Image.Width).</param>
 public static void DrawImageHued(this Graphics g, Image image, Rectangle destRect, Color hueColor, float intensity = 1.0f,
                                  int srcX = 0, int srcY = 0, int srcWidth = -1, int srcHeight = -1)
 {
     using var attribs = new ImageAttributes();
     attribs.SetHueColorMatrix(hueColor, intensity);
     g.DrawImageAttributed(image, destRect, srcX, srcY, srcWidth, srcHeight, attribs);
 }