Esempio n. 1
0
        /// <summary>
        /// Transforms the specified image.
        /// </summary>
        /// <param name="image">The image.</param>
        /// <param name="colorMatrices">The color matrices to apply to the image.</param>
        /// <returns></returns>
        public static Image Transform(this Image image, Queue <ColorMatrix> colorMatrices)
        {
            if (colorMatrices == null)
            {
                throw new ArgumentNullException("colorMatrices");
            }

            if (colorMatrices.Count > 0)
            {
                ColorMatrix multipliedMatrices = colorMatrices.Dequeue();
                while (colorMatrices.Count > 0)
                {
                    multipliedMatrices.Multiply(colorMatrices.Dequeue());
                }

                image.ApplyColorMatrix(multipliedMatrices);
            }

            return(image);
        }