Example #1
0
        private void button1_Click(object sender, EventArgs e) // соляризація
        {
            imgSolar = new Bitmap(img);
            HSLconvertor.toHSL(RGBcolor, height, width);
            RGBcolor rgbNew = new RGBcolor();

            rgbNew = HSLconvertor.toRGB_solorized(RGBcolor.A); // new rgb color

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    imgSolar.SetPixel(x, y, Color.FromArgb(rgbNew.A[x, y], rgbNew.R[x, y], rgbNew.G[x, y], rgbNew.B[x, y]));
                }
            }
            pictureBox2.SizeMode = PictureBoxSizeMode.Zoom;
            pictureBox2.Image    = imgSolar;
        }
Example #2
0
        private void button4_Click(object sender, EventArgs e) // лінеаризація
        {
            double min   = double.Parse(textBox1.Text);
            double max   = double.Parse(textBox2.Text);
            float  L_new = float.Parse(textBox3.Text);

            imgLinerized = new Bitmap(img);
            HSLconvertor hsl = new HSLconvertor();

            hsl.toHSL(RGBcolor, img.Height, img.Width);

            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    if (hsl.L[i, j] > min && hsl.L[i, j] < max)
                    {
                        hsl.L[i, j] = L_new;
                    }
                }
            }

            RGBcolor rgb = new RGBcolor();

            rgb = hsl.toRGB(RGBcolor.A);

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    imgLinerized.SetPixel(x, y, Color.FromArgb(rgb.A[x, y], rgb.R[x, y], rgb.G[x, y], rgb.B[x, y]));
                }
            }
            pictureBox4.SizeMode = PictureBoxSizeMode.Zoom;
            pictureBox4.Image    = imgLinerized;
        }