Пример #1
0
        public override Pixel ProcessPixel(Pixel originalPixel, IParameters parameters)
        {
            var origH = Convertors.GetPixelHue(originalPixel);
            var origS = Convertors.GetPixelSaturation(originalPixel);
            var origL = Convertors.GetPixelLightness(originalPixel);

            var newL = Math.Pow(origL, 1 / (parameters as GammaCorrectionParameters).GammaParameterByUser);

            return(Convertors.HSL2Pixel(origH, origS, newL));
        }
Пример #2
0
        private void buttonApply_Click(object sender, EventArgs e)
        {
            var filter = comboBoxFilters.SelectedItem as IFilter;

            var parameters = new double[parametrControls.Count];

            for (var i = 0; i < parameters.Length; i++)
            {
                parameters[i] = (double)parametrControls[i].Value;
            }

            resultPhoto            = filter.Process(originalPhoto, parameters);
            pictureBoxResult.Image = Convertors.Photo2Bitmap(resultPhoto);

            saveToolStripMenuItem.Enabled = true;
        }
Пример #3
0
 private void LoadPicture(Bitmap bmp)
 {
     originalPhoto            = Convertors.Bitmap2Photo(bmp);
     pictureBoxOriginal.Image = bmp;
     pictureBoxResult.Image   = null;
 }
Пример #4
0
        private void SavePicture(Photo photo, string filename)
        {
            var bmp = Convertors.Photo2Bitmap(photo);

            bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);
        }