ARCed.Helpers.Cache.RotateHue C# (CSharp) Метод

RotateHue() публичный статический Метод

Rotates the hue of an image
Values out of range will be automatically corrected
public static RotateHue ( Image image, int hue ) : void
image Image Image to change
hue int Degree of hue displacement (0..360)
Результат void
        public static void RotateHue(Image image, int hue)
        {
            using (var newImage = new Bitmap(image))
            {
                using (var g = Graphics.FromImage(image))
                {
                    var imageAttr = new ImageAttributes();
                    var qm = new QColorMatrix();
                    qm.RotateHue(hue % 360);
                    imageAttr.SetColorMatrix(qm.ToColorMatrix());
                    var destRect = new Rectangle(new Point(), image.Size);
                    g.Clear(Color.Transparent);
                    g.DrawImage(newImage, destRect, 0, 0, image.Width, image.Height,
                        GraphicsUnit.Pixel, imageAttr);
                }
            }
        }