Exemple #1
0
        private void pictureBoxSearch_MouseClick(object sender, MouseEventArgs e)
        {
            if (!pintar)
            {
                if (pa == null)
                {
                    pa = new Poligono();
                }
                if (x == -1)
                {
                    x = e.X;
                    y = e.Y;
                }

                Aplicacoes.BresenhamReta(x, y, e.X, e.Y, bm);
                pictureBoxSearch.Image = bm;

                pa.MOXY[pa.linha, 0] = pa.MAXY[pa.linha, 0] = e.X;
                pa.MOXY[pa.linha, 1] = pa.MAXY[pa.linha, 1] = e.Y;
                pa.linha++;

                x = e.X;
                y = e.Y;
            }
            else
            {
                Aplicacoes.FloodFill(e.X, e.Y, r, g, b, bm);

                pictureBoxSearch.Image = bm;

                pintar = false;
            }
        }
Exemple #2
0
        private void btnRotacionar_Click(object sender, EventArgs e)
        {
            int ang;

            try
            { ang = Int32.Parse(txtAngulo.Text); }
            catch (Exception ex)
            { ang = 0; }

            verificaRB();

            Aplicacoes.transladar(-xa, -ya, ps);
            Aplicacoes.rotacionar(ang, ps);
            Aplicacoes.transladar(xa, ya, ps);

            btnResetar_Click(sender, e);

            foreach (Poligono p in LBPoligono.Items)
            {
                for (int i = 0; i < p.linha - 1; i++)
                {
                    Aplicacoes.BresenhamReta(p.MAXY[i, 0], p.MAXY[i, 1], p.MAXY[i + 1, 0], p.MAXY[i + 1, 1], bm);
                }
                Aplicacoes.BresenhamReta(p.MAXY[p.linha - 1, 0], p.MAXY[p.linha - 1, 1], p.MAXY[0, 0], p.MAXY[0, 1], bm);
            }
        }
Exemple #3
0
        private void btnEscalar_Click(object sender, EventArgs e)
        {
            try
            { dX = Double.Parse(txtX.Text); }
            catch (Exception ex)
            { dX = 0.0; }

            try
            { dY = Double.Parse(txtY.Text); }
            catch (Exception ex)
            { dY = 0.0; }

            verificaRB();

            Aplicacoes.transladar(-xa, -ya, ps);
            Aplicacoes.escalar(dX, dY, ps);
            Aplicacoes.transladar(xa, ya, ps);

            btnResetar_Click(sender, e);

            foreach (Poligono p in LBPoligono.Items)
            {
                for (int i = 0; i < p.linha - 1; i++)
                {
                    Aplicacoes.BresenhamReta(p.MAXY[i, 0], p.MAXY[i, 1], p.MAXY[i + 1, 0], p.MAXY[i + 1, 1], bm);
                }
                Aplicacoes.BresenhamReta(p.MAXY[p.linha - 1, 0], p.MAXY[p.linha - 1, 1], p.MAXY[0, 0], p.MAXY[0, 1], bm);
            }
        }
Exemple #4
0
        private void btnTransladar_Click(object sender, EventArgs e)
        {
            try
            { x = Int32.Parse(txtX.Text); }
            catch (Exception ex)
            { x = 0; }

            try
            { y = Int32.Parse(txtY.Text); }
            catch (Exception ex)
            { y = 0; }

            Aplicacoes.transladar(x, y, ps);

            btnResetar_Click(sender, e);

            foreach (Poligono p in LBPoligono.Items)
            {
                for (int i = 0; i < p.linha - 1; i++)
                {
                    Aplicacoes.BresenhamReta(p.MAXY[i, 0], p.MAXY[i, 1], p.MAXY[i + 1, 0], p.MAXY[i + 1, 1], bm);
                }
                Aplicacoes.BresenhamReta(p.MAXY[p.linha - 1, 0], p.MAXY[p.linha - 1, 1], p.MAXY[0, 0], p.MAXY[0, 1], bm);
            }
        }
Exemple #5
0
 private void pictureBoxSearch_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     LBPoligono.Items.Add(pa);
     LBPoligono.ValueMember = pa.linha.ToString();
     Aplicacoes.BresenhamReta(e.X, e.Y, pa.MAXY[0, 0], pa.MAXY[0, 1], bm);
     pictureBoxSearch.Image = bm;
     pa = null;
     x  = -1;
 }
Exemple #6
0
        private void btnFlipVH_Click(object sender, EventArgs e)
        {
            verificaRB();

            Aplicacoes.transladar(-xa, -ya, ps);
            Aplicacoes.flipVH(ps);
            Aplicacoes.transladar(xa, ya, ps);

            btnResetar_Click(sender, e);

            foreach (Poligono p in LBPoligono.Items)
            {
                for (int i = 0; i < p.linha - 1; i++)
                {
                    Aplicacoes.BresenhamReta(p.MAXY[i, 0], p.MAXY[i, 1], p.MAXY[i + 1, 0], p.MAXY[i + 1, 1], bm);
                }
                Aplicacoes.BresenhamReta(p.MAXY[p.linha - 1, 0], p.MAXY[p.linha - 1, 1], p.MAXY[0, 0], p.MAXY[0, 1], bm);
            }
        }