Example #1
0
        private void btn_log_Click(object sender, EventArgs e)
        {
            double c;

            if (double.TryParse(this.txtbx_cConst.Text, out c))
            {
                using (var bitMap = new Bitmap(this._filePath))
                {
                    using (var imageProcessor = new ImageProcessor(bitMap))
                    {
                        IFilter filter = this._filterBuilder.CreateLogarithmicFilter(c);
                        imageProcessor.ApplyFilter(filter);
                        imageProcessor.SaveChanges("log.jpg");
                    }
                }

                MessageBox.Show("The operation has been completed successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Parameters are invalid", "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void btn_Halftone_Click(object sender, EventArgs e)
        {
            using (var bitMap = new Bitmap(this._filePath))
            {
                using (var imageProcessor = new ImageProcessor(bitMap))
                {
                    IFilter filter = this._filterBuilder.CreateBinaryHalftoneFilter();
                    imageProcessor.ApplyFilter(filter);
                    imageProcessor.SaveChanges("halftone.jpg");
                }
            }

            MessageBox.Show("The operation has been completed successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }