Beispiel #1
0
        /// <summary>
        /// Applyes effects to image
        /// </summary>
        public static BitmapImage GetProcessed(BitmapImage sourceImage, List <int> effects)
        {
            var processedImage = ImageProcess.BitmapImageToByte(sourceImage);

            foreach (int effect in effects)
            {
                switch (effect)
                {
                case EditPageVM.EFFECT_LIGHTENING:
                    processedImage = ImageProcess.Brightness(processedImage, 25);
                    break;

                case EditPageVM.EFFECT_SHADOWING:
                    processedImage = ImageProcess.Shadowing(processedImage, 5);
                    break;

                case EditPageVM.EFFECT_CROP:
                    int indent = EditPageVM.IndentToCrop;
                    int width  = sourceImage.PixelWidth - 2 * indent;
                    int height = sourceImage.PixelHeight - 2 * indent;
                    processedImage = ImageProcess.Crop(processedImage, indent, indent, width, height);
                    break;

                case EditPageVM.EFFECT_ROTATE:
                    processedImage = ImageProcess.Rotate(processedImage, -90f);
                    break;

                case EditPageVM.EFFECT_PIXELIZE:
                    processedImage = ImageProcess.Quality(processedImage, 25);
                    break;

                default:
                    break;
                }
            }

            return(ImageProcess.ByteToBitmapImage(processedImage));
        }