コード例 #1
0
        private void Filter(object sender, EventArgs e)
        {
            var options = Resources.PhotoFilters;

            using var filterDialog = new InputDropdownDialog <IMatrixFilter>(
                      "Photo Filter", "The filter to be applied to the image:", options);

            if (filterDialog.ShowDialog() == DialogResult.OK)
            {
                var filter = filterDialog.Result;

                _state.Filter(filter);
                _lastCommand = new Action(() => _state.Filter(filter));
            }

            RefreshImageState();
        }
コード例 #2
0
        private void Flip(object sender, EventArgs e)
        {
            var options = Resources.FlipValues;

            using var flipDialog = new InputDropdownDialog <string>(
                      "Flip", "Which direction would you like to flip the image?", options);

            if (flipDialog.ShowDialog() == DialogResult.OK)
            {
                var verticalFlip = flipDialog.Result
                                   .ToLower()
                                   .Equals("vertical");

                _state.Flip(verticalFlip);
                _lastCommand = new Action(() => _state.Flip(verticalFlip));
            }

            RefreshImageState();
        }
コード例 #3
0
        private void DetectEdges(object sender, EventArgs e)
        {
            var options = Resources.EdgeFilters;

            using var edgesDialog = new InputDropdownDialog <IEdgeFilter>(
                      "Detect Edges", "The algorithm to detect edges with:",
                      options, true);

            if (edgesDialog.ShowDialog() == DialogResult.OK)
            {
                var filter    = edgesDialog.Result;
                var greyscale = edgesDialog.CheckboxResult;

                _state.DetectEdges(filter, greyscale);
                _lastCommand = new Action(() => _state.DetectEdges(filter, greyscale));
            }

            RefreshImageState();
        }