private void InitCommands()
 {
     OpenCommand              = new OpenCommand(this);
     ApplyCommand             = new ApplyCommand(this);
     FlipCommand              = new FlipCommand(this);
     HistogramEqualizeCommand = new HistogramEqualizeCommand(this);
     HistogramStretchCommand  = new HistogramStretchCommand(this);
     CropCommand              = new CropCommand(this);
     InpaintCommand           = new InpaintCommand(this);
     ResizeCommand            = new ResizeCommand(this);
     RotateCommand            = new RotateCommand(this);
     SaveAsCommand            = new SaveAsCommand(this);
     SaveCommand              = new SaveCommand(this);
     ZoomCommand              = new ZoomCommand(this);
     ResetCommand             = new ResetCommand(this);
     CloseCommand             = new CloseCommand(this);
     SelectToolCommand        = new SelectToolCommand(this);
     UndoCommand              = new UndoCommand(this);
     RedoCommand              = new RedoCommand(this);
     DropboxCommand           = new DropboxCommand(this);
     DownloadCommand          = new DownloadCommand(this);
     UploadCommand            = new UploadCommand(this);
     DCommand       = new DCommand(this);
     ECommand       = new ECommand(this);
     PrewittCommand = new PrewittCommand(this);
 }
Exemplo n.º 2
0
        private void InitaliseCommands()
        {
            StartGameCommand = ReactiveCommand.Create();
            StartGameCommand.Subscribe(arg => StartGameCommandHandler());

            ResetCommand = ReactiveCommand.Create();
            ResetCommand.Subscribe(arg => ResetCommandHandler());

            StopGameCommand = ReactiveCommand.Create();
            StopGameCommand.Subscribe(arg => StopGameWindowHandler());

            OpenNewGameWindow = ReactiveCommand.Create();
            OpenNewGameWindow.Subscribe(arg => OpenNewGameWindowHandler());

            FlipCommand = ReactiveCommand.Create();
            FlipCommand.Subscribe(arg => FlipCommandHandler());

            UndoCommand = ReactiveCommand.Create();
            UndoCommand.Subscribe(arg => UndoCommandHandler());

            AcceptScoreCommand = ReactiveCommand.Create();
            AcceptScoreCommand.Subscribe(arg => AcceptScoreCommandHandler());

            RejectScoreCommand = ReactiveCommand.Create();
            RejectScoreCommand.Subscribe(arg => RejectScoreCommandHandler());
        }
        private void FlipDialog_Load(object sender, System.EventArgs e)
        {
            if (_firstTimer)
            {
                _firstTimer = false;
                FlipCommand command = new FlipCommand();
                _initialHorizontal = command.Horizontal;
            }

            Horizontal            = _initialHorizontal;
            _rbHorizontal.Checked = Horizontal;
            _rbVertical.Checked   = !Horizontal;
        }
Exemplo n.º 4
0
        public static void Flip(RasterImage image, params string[] parameters)
        {
            FlipCommand cmd        = new FlipCommand();
            bool        horizontal = false;

            if (parameters.Length > 0)
            {
                bool.TryParse(parameters[0], out horizontal);
            }

            cmd.Horizontal = horizontal;
            cmd.Run(image);
        }
Exemplo n.º 5
0
        public MainViewModel()
        {
            LoadCmd  = new Command(LoadCommand);
            SaveCmd  = new Command(SaveCommand);
            ResetCmd = new Command(ResetCommand);

            GrayScaleCmd    = new GrayScaleCommand(() => Image);
            BlurCmd         = new BlurCommand(() => Image);
            LogCmd          = new LogCommand(() => Image);
            ContrastCmd     = new ContrastCommand(() => Image);
            FlipCmd         = new FlipCommand(() => Image);
            NegateCmd       = new NegateCommand(() => Image);
            SobelEdgesCmd   = new SobelEdgeDetectionCommand(() => Image);
            ImpulseNoiseCmd = new ImpulseNoiseCommand(() => Image);
            EdgesCmd        = new EdgeDetectionCommand(() => Image);

            FlipCmd.OnImageChanged += img => Image = img;
        }
Exemplo n.º 6
0
 public abstract void Visit(FlipCommand command);
 public override void Visit(FlipCommand command)
 {
     Console.WriteLine("Flip");
 }
Exemplo n.º 8
0
        /// <summary>
        /// Batch 2 Functions
        /// </summary>
        private void DoBatch2()
        {
            // save the current caption
            string tmpCaption = Text;

            // disable the form
            Enabled = false;

            // change cursor
            Cursor = Cursors.SizeNS;

            // Do AntiAlias
            Text = "AntiAliasing Image...";
            AntiAliasingCommand antiAliasingCommand = new AntiAliasingCommand();

            antiAliasingCommand.Threshold = 25;
            antiAliasingCommand.Dimension = 7;
            antiAliasingCommand.Filter    = AntiAliasingCommandType.Type1;
            antiAliasingCommand.Run(_viewer.Image);
            Text = "Image Is AntiAliased";
            _viewer.Refresh();
            Thread.Sleep(2000);

            // change cursor
            Cursor = Cursors.SizeWE;
            // Do Reverse
            Text = "Reversing Image...";
            FlipCommand flipCommand = new FlipCommand();

            flipCommand.Horizontal = true;
            flipCommand.Run(_viewer.Image);
            Text = "Image Is Reversed";
            _viewer.Refresh();
            Thread.Sleep(2000);

            // change cursor
            Cursor = Cursors.SizeNS;
            // Do Grayscale
            Text = "Grayscaling Image...";
            GrayscaleCommand grayScaleCommand = new GrayscaleCommand();

            grayScaleCommand.BitsPerPixel = 8;
            grayScaleCommand.Run(_viewer.Image);
            Text = "Image Is Grayscaled";
            _viewer.Refresh();
            Thread.Sleep(2000);

            // change cursor
            Cursor = Cursors.SizeWE;
            // Do Invert
            Text = "Inverting Image...";
            InvertCommand invertCommand = new InvertCommand();

            invertCommand.Run(_viewer.Image);
            Text = "Image Is Inverted, Batch Is Complete";
            _viewer.Refresh();
            Thread.Sleep(2000);

            // change the cursor to arrow
            Cursor = Cursors.Arrow;

            // enable the form
            Enabled = true;

            // return the old caption
            Text = tmpCaption;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Batch 1 Functions
        /// </summary>
        private void DoBatch1()
        {
            // save the current caption
            string tmpCaption = Text;

            // change cursor
            Cursor = Cursors.SizeNS;
            // disable the form
            Enabled = false;
            // Do Color Resolution
            Text = "Optimizing Image To 8 Bits Per Pixel With Burkes Dithering...";
            ColorResolutionCommand colorResCommand = new ColorResolutionCommand();

            colorResCommand.BitsPerPixel    = 8;
            colorResCommand.DitheringMethod = RasterDitheringMethod.Burkes;
            colorResCommand.PaletteFlags    = ColorResolutionCommandPaletteFlags.Optimized;
            colorResCommand.Mode            = ColorResolutionCommandMode.InPlace;
            colorResCommand.Order           = RasterByteOrder.Bgr;
            colorResCommand.SetPalette(null);
            colorResCommand.Run(_viewer.Image);
            Text = "Image Is Optimized";
            _viewer.Refresh();
            Thread.Sleep(2000);

            // change cursor
            Cursor = Cursors.SizeWE;
            // Do Flip
            Text = "Flipping Image...";
            FlipCommand flipCommand = new FlipCommand();

            flipCommand.Horizontal = false;
            flipCommand.Run(_viewer.Image);
            Text = "Image Is Flipped";
            _viewer.Refresh();
            Thread.Sleep(2000);

            // change cursor
            Cursor = Cursors.SizeNS;
            // Do Lightening
            Text = "Lightening Image...";
            ChangeIntensityCommand changeIntensityCommand = new ChangeIntensityCommand();

            changeIntensityCommand.Brightness = 200;
            changeIntensityCommand.Run(_viewer.Image);
            Text = "Image Is Lightened";
            _viewer.Refresh();
            Thread.Sleep(2000);

            // change cursor
            Cursor = Cursors.SizeWE;
            // Do Resize
            Text = "Resizing Image...";
            ResizeCommand resizeCommand = new ResizeCommand();

            resizeCommand.Flags            = RasterSizeFlags.None;
            resizeCommand.DestinationImage = new RasterImage(RasterMemoryFlags.Conventional,
                                                             (_viewer.Image.Width + 1) / 2,
                                                             (_viewer.Image.Height + 1) / 2,
                                                             _viewer.Image.BitsPerPixel,
                                                             _viewer.Image.Order,
                                                             _viewer.Image.ViewPerspective,
                                                             _viewer.Image.GetPalette(),
                                                             IntPtr.Zero,
                                                             0);
            resizeCommand.Run(_viewer.Image);
            _viewer.Image = resizeCommand.DestinationImage;
            Text          = "Image Is Resized";
            _viewer.Refresh();
            Thread.Sleep(2000);

            Cursor = Cursors.SizeNS;
            // Do Rotate
            Text = "Rotating Image...";
            RotateCommand rotateCommand = new RotateCommand();

            rotateCommand.Angle     = -4500;
            rotateCommand.FillColor = new RasterColor(255, 0, 0);
            rotateCommand.Flags     = RotateCommandFlags.None;

            rotateCommand.Run(_viewer.Image);
            Text = "Image Is Rotated, Batch Is Complete";
            _viewer.Refresh();
            Thread.Sleep(2000);

            // change the cursor to arrow
            Cursor = Cursors.Arrow;

            // return the old caption
            Text = tmpCaption;

            // enable the form
            Enabled = true;
        }
Exemplo n.º 10
0
 public virtual T Visit(FlipCommand command)
 {
     return(default(T));
 }