예제 #1
0
        private void btn_draw_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex == 0)
            {
                Init();
                line = FormLine.getLine();
                int mode = FormLine.getAlgorithm();
                if (mode == DDA)
                {
                    line.draw_DDA(drawOnePixel);
                }
                else if (mode == Bresenham)
                {
                    line.draw_Bresenham(drawOnePixel);
                }
                else if (mode == MidPoint)
                {
                    line.draw_MidPoint(drawOnePixel);
                }
                else if (mode == XiaolinWu)
                {
                    line.draw_XiaolinWu(drawOnePixelWithBrightness);
                }

                circle = FormCircle.getcircle();
                if (FormCircle.getAlgorithm() == 0)
                {
                    circle.draw_MidPoint(drawOnePixel);
                }
                else if (FormCircle.getAlgorithm() == 1)
                {
                    circle.draw_DDA(drawOnePixel);
                }

                ellipse = FormEllipse.getellipse();
                if (FormEllipse.getAlgorithm() == 0)
                {
                    ellipse.draw_MidPoint(drawOnePixel);
                }
                else if (FormEllipse.getAlgorithm() == 1)
                {
                    ellipse.draw_DDA(drawOnePixel);
                }

                parabol = FormParabol.getParabol();
                if (FormParabol.getAlgorithm() == 0)
                {
                    parabol.draw_MidPoint(drawOnePixel);
                }
                else if (FormParabol.getAlgorithm() == 1)
                {
                    parabol.draw_DDA(drawOnePixel);
                }


                hyperbol = FormHyperbol.getHyperbol();
                if (FormHyperbol.getAlgorithm() == 0)
                {
                    hyperbol.draw_MidPoint(drawOnePixel);
                }
                else if (FormHyperbol.getAlgorithm() == 1)
                {
                    hyperbol.draw_DDA(drawOnePixel);
                }
            }
            else if (listBox1.SelectedIndex == 1)
            {
                Init();
                line = FormLine.getLine();
                int mode = FormLine.getAlgorithm();
                if (mode == DDA)
                {
                    line.draw_DDA(drawOnePixel);
                }
                else if (mode == Bresenham)
                {
                    line.draw_Bresenham(drawOnePixel);
                }
                else if (mode == MidPoint)
                {
                    line.draw_MidPoint(drawOnePixel);
                }
                else if (mode == XiaolinWu)
                {
                    line.draw_XiaolinWu(drawOnePixelWithBrightness);
                }
            }
            else if (listBox1.SelectedIndex == 2)
            {
                Init();
                circle = FormCircle.getcircle();
                if (FormCircle.getAlgorithm() == 0)
                {
                    circle.draw_MidPoint(drawOnePixel);
                }
                else if (FormCircle.getAlgorithm() == 1)
                {
                    circle.draw_DDA(drawOnePixel);
                }
            }
            else if (listBox1.SelectedIndex == 3)
            {
                Init();
                ellipse = FormEllipse.getellipse();
                if (FormEllipse.getAlgorithm() == 0)
                {
                    ellipse.draw_MidPoint(drawOnePixel);
                }
                else if (FormEllipse.getAlgorithm() == 1)
                {
                    ellipse.draw_DDA(drawOnePixel);
                }
            }
            else if (listBox1.SelectedIndex == 4)
            {
                Init();
                parabol = FormParabol.getParabol();
                if (FormParabol.getAlgorithm() == 0)
                {
                    parabol.draw_MidPoint(drawOnePixel);
                }
                else if (FormParabol.getAlgorithm() == 1)
                {
                    parabol.draw_DDA(drawOnePixel);
                }
            }
            else if (listBox1.SelectedIndex == 5)
            {
                Init();
                hyperbol = FormHyperbol.getHyperbol();
                if (FormHyperbol.getAlgorithm() == 0)
                {
                    hyperbol.draw_MidPoint(drawOnePixel);
                }
                else if (FormHyperbol.getAlgorithm() == 1)
                {
                    hyperbol.draw_DDA(drawOnePixel);
                }
            }
        }