Пример #1
0
        private void FloodFill(Bitmap bmp, Point pt)
        {
            Stack <Point> pixels           = new Stack <Point>();
            Color         targetColor      = bmp.GetPixel(pt.X, pt.Y);
            Color         replacementColor = buttonKolorLinii.BackColor;

            pixels.Push(pt);

            while (pixels.Count > 0)
            {
                Point a = pixels.Pop();
                if (a.X < bmp.Width && a.X > 0 &&
                    a.Y < bmp.Height && a.Y > 0)
                {
                    if (bmp.GetPixel(a.X, a.Y) == targetColor)
                    {
                        bmp.SetPixel(a.X, a.Y, replacementColor);
                        pixels.Push(new Point(a.X - 1, a.Y));
                        pixels.Push(new Point(a.X + 1, a.Y));
                        pixels.Push(new Point(a.X, a.Y - 1));
                        pixels.Push(new Point(a.X, a.Y + 1));
                    }
                }
            }
            pictureBoxRamka.Image   = bmp;
            pictureBoxPodglad.Image = bmp;
            rysunek = new Rysunek(bmp);
            rysunek.Rysuj(g);
            pictureBoxRamka.Refresh();
            pictureBoxPodglad.Refresh();
        }
Пример #2
0
        private void noweTlo(Image image)
        {
            pictureBoxRamka.Image   = new Bitmap(image);
            pictureBoxPodglad.Image = new Bitmap(image);

            g       = Graphics.FromImage(pictureBoxRamka.Image);
            rysunek = new Rysunek(image);
            rysunek.Rysuj(g);
            pictureBoxRamka.Refresh();
        }
Пример #3
0
 public OknoProgramu()
 {
     InitializeComponent();
     pictureBoxRamka.Image = new Bitmap(pictureBoxRamka.Width, pictureBoxRamka.Height);
     g  = Graphics.FromImage(pictureBoxRamka.Image);
     gp = Graphics.FromImage(pictureBoxRamka.Image);
     r  = new Rysunek(pictureBoxRamka.Width, pictureBoxRamka.Height, Color.White);
     r.Rysuj(g);
     pictureBoxRamka.Refresh();
 }
Пример #4
0
        public OknoProgramu()
        {
            InitializeComponent();
            pictureBoxRamka.Image       = new Bitmap(pictureBoxRamka.Width, pictureBoxRamka.Height);
            pictureBoxPodglad.Image     = new Bitmap(pictureBoxPodglad.Width, pictureBoxPodglad.Height);
            bazowyRozmiar               = pictureBoxRamka.Size;
            pictureBoxPodglad.BackColor = Color.White;
            g    = Graphics.FromImage(pictureBoxRamka.Image);
            font = new Font("Arial", 16);

            rysunek = new Rysunek(pictureBoxRamka.Width, pictureBoxRamka.Height, Color.White);
            rysunek.Rysuj(g);
            pictureBoxRamka.Refresh();
        }
Пример #5
0
        private void nowyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewDialog dialog = new NewDialog();

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                bazowyRozmiar           = dialog.ImageSize;
                pictureBoxRamka.Image   = new Bitmap(bazowyRozmiar.Width, bazowyRozmiar.Height);
                pictureBoxPodglad.Image = new Bitmap(bazowyRozmiar.Width, bazowyRozmiar.Height);
                g  = Graphics.FromImage(pictureBoxRamka.Image);
                gp = Graphics.FromImage(pictureBoxPodglad.Image);

                rysunek = new Rysunek(bazowyRozmiar.Width, bazowyRozmiar.Height, dialog.imageBackColor);
                rysunek.Rysuj(g);
                rysunek.Rysuj(gp);
                pictureBoxRamka.Refresh();
                pictureBoxPodglad.Refresh();
                Text = "MiniPaint wektorowy - niezapisane*";
            }
        }