Exemple #1
0
        public System.Drawing.Bitmap ApplyFilter(Image image, EFilter filtro, Color color = default(Color), int brightness = 0, int noise = 60,
                                                 RotateFlipType RFT = RotateFlipType.RotateNoneFlipNone)
        {
            switch (filtro)
            {
            case EFilter.AutomaticAdjustmentFilter:
                AutomaticAdjustmentFilter AAF = new AutomaticAdjustmentFilter();
                return(AAF.ApplyFilter(image.BitmapImage));

            case EFilter.BlackNWhiteFilter:
                BlackNWhiteFilter BNWF = new BlackNWhiteFilter();
                return(BNWF.ApplyFilter(image.BitmapImage));

            case EFilter.BrightnessFilter:
                BrightnessFilter BF = new BrightnessFilter();
                return(BF.ApplyFilter(image.BitmapImage, brightness));

            case EFilter.ColorFilter:
                ColorFilter CF = new ColorFilter();
                return(CF.ApplyFilter(image.BitmapImage, color));

            case EFilter.InvertFilter:
                InvertFilter IF = new InvertFilter();
                return(IF.ApplyFilter(image.BitmapImage));

            case EFilter.MirrorFilter:
                MirrorFilter MF = new MirrorFilter();
                return(MF.ApplyFilter(image.BitmapImage));

            case EFilter.OldFilmFilter:
                OldFilmFilter OFF = new OldFilmFilter();
                return(OFF.ApplyFilter(image.BitmapImage, noise));

            case EFilter.RotateFlipFilter:
                RotateFlipFilter RFF = new RotateFlipFilter();
                return(RFF.RotateFlip(image.BitmapImage, RFT));

            case EFilter.SepiaFilter:
                SepiaFilter SF = new SepiaFilter();
                return(SF.ApplyFilter(image.BitmapImage));

            case EFilter.WindowsFilter:
                WindowsFilter WF = new WindowsFilter();
                return(WF.ApplyFilter(image.BitmapImage));
            }
            return(image.BitmapImage);
        }
Exemple #2
0
        public System.Drawing.Bitmap ApplyFilter(Image image, EFilter filtro, Color color = default(Color), int brightness = 0, int noise = 60,
                                                 RotateFlipType RFT = RotateFlipType.RotateNoneFlipNone)
        {
            switch (filtro)
            {
            case EFilter.AutomaticAdjustment:
                AutomaticAdjustmentFilter AAF = new AutomaticAdjustmentFilter();
                Bitmap ret = AAF.ApplyFilter(image.BitmapImage);
                GC.Collect();
                return(ret);

            case EFilter.Grayscale:
                BlackNWhiteFilter BNWF = new BlackNWhiteFilter();
                Bitmap            ret2 = BNWF.ApplyFilter(image.BitmapImage);
                GC.Collect();
                return(ret2);

            case EFilter.Brightness:
                BrightnessFilter BF   = new BrightnessFilter();
                Bitmap           ret3 = BF.ApplyFilter(image.BitmapImage, brightness);
                GC.Collect();
                return(ret3);

            case EFilter.Color:
                ColorFilter CF   = new ColorFilter();
                Bitmap      ret4 = CF.ApplyFilter(image.BitmapImage, color);
                GC.Collect();
                return(ret4);

            case EFilter.Invert:
                InvertFilter IF   = new InvertFilter();
                Bitmap       ret5 = IF.ApplyFilter(image.BitmapImage);
                GC.Collect();
                return(ret5);

            case EFilter.Mirror:
                MirrorFilter MF   = new MirrorFilter();
                Bitmap       ret6 = MF.ApplyFilter(image.BitmapImage);
                GC.Collect();
                return(ret6);

            case EFilter.OldFilm:
                OldFilmFilter OFF  = new OldFilmFilter();
                Bitmap        ret7 = OFF.ApplyFilter(image.BitmapImage, noise);
                GC.Collect();
                return(ret7);

            case EFilter.RotateFlip:
                RotateFlipFilter RFF  = new RotateFlipFilter();
                Bitmap           ret8 = RFF.RotateFlip(image.BitmapImage, RFT);
                GC.Collect();
                return(ret8);

            case EFilter.Sepia:
                SepiaFilter SF   = new SepiaFilter();
                Bitmap      ret9 = SF.ApplyFilter(image.BitmapImage);
                GC.Collect();
                return(ret9);

            case EFilter.Windows:
                WindowsFilter WF    = new WindowsFilter();
                Bitmap        ret10 = WF.ApplyFilter(image.BitmapImage);
                GC.Collect();
                return(ret10);
            }
            return(image.BitmapImage);
        }