예제 #1
0
파일: ImageUtility.cs 프로젝트: webbes/BIP
        /// <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);
        }