Beispiel #1
0
        private void button22_Click(object sender, EventArgs e)
        {
            //Color[] color2 = new Color[16];

            Color[] color1 = new Color[16];

            Bitmap bmp = new Bitmap(640, 480);

            if (pictureBox1.Image != null)
            {
                bmp = (Bitmap)pictureBox1.Image.Clone();
            }

            Color  c;
            vector pan = new vector();
            int    R, G, B;
            int    colorT = 0, g = 0;
            double t = 0;

            double[] x1 = { 0, 15 };
            double[] y1 = { 247, 0 };
            double[] y2 = { 174, 64 };
            double[] y3 = { 28, 229 };

            for (int i = 0; i < 16; i++)
            {
                R         = (int)pan.Lagrange(i, x1.Length, x1, y1);
                G         = (int)pan.Lagrange(i, x1.Length, x1, y2);
                B         = (int)pan.Lagrange(i, x1.Length, x1, y3);
                color1[i] = Color.FromArgb(R, G, B);
            }

            do
            {
                c = color1[colorT];
                g++;
                if (g < 16)
                {
                    colorT++;
                }
                else
                {
                    colorT--;
                }

                for (int i = 0; i < 15; i++)
                {
                    vector v = new vector();
                    t      = t + 0.005;
                    v.x0   = -8 + 6 * t;
                    v.y0   = -2 + 3 * t;
                    v.col0 = c;
                    v.proceso_encender(ref bmp);
                    pictureBox1.Image = bmp;
                }
            } while (g < 31);
            //Color c;
            //Color c2;
            //vector pan = new vector();
            //int R, G, B;
            //double[] x1 = { 0, 15 };
            //int count = 0;


            //double[] y1 = { 255, 255 };
            //double[] y2 = { 0, 255 };
            //double[] y3 = { 0, 0 };

            //double[] y4 = { 255, 255 };
            //double[] y5 = { 255, 0 };
            //double[] y6 = { 0, 0 };

            //for (int i = 0; i < 16; i++)
            //{
            //    R = (int)pan.Lagrange(i, x1.Length, x1, y1);
            //    G = (int)pan.Lagrange(i, x1.Length, x1, y2);
            //    B = (int)pan.Lagrange(i, x1.Length, x1, y3);
            //    color1[i] = Color.FromArgb(R, G, B);
            //}
            //for (int i = 0; i < 16; i++)
            //{
            //    R = (int)pan.Lagrange(i, x1.Length, x1, y4);
            //    G = (int)pan.Lagrange(i, x1.Length, x1, y5);
            //    B = (int)pan.Lagrange(i, x1.Length, x1, y6);
            //    color2[i] = Color.FromArgb(R, G, B);
            //}
            //double t = 0 ,r = 0,z=0;
            //double x=0, y=0;

            //do
            //{
            //    c = color1[count];
            //    c2 = color2[count];
            //    count++;
            //    for (int i = 0; i < 30; i++)
            //    {
            //        if(i<15){
            //            vector v = new vector();
            //            t = t + 0.005;
            //            //r = t;
            //            v.x0 = x = (-8 + 6 * t);
            //            v.y0 = y = (-2 + 3 * t);
            //            v.col0 = c;
            //            v.proceso_encender(ref bmp);
            //            pictureBox1.Image = bmp;
            //            label2.Text = r.ToString();

            //        }
            //        else
            //        {

            //            vector v = new vector();
            //            r = r + 0.005;
            //            v.x0 = x + 6 * r;
            //            v.y0 = y + 3 * r;
            //            v.col0 = c2;
            //            v.proceso_encender(ref bmp);
            //            pictureBox1.Image = bmp;

            //        }

            //    }

            //} while (count < 16);
        }
Beispiel #2
0
        private void button25_Click(object sender, EventArgs e)
        {
            Bitmap bmp = new Bitmap(640, 480);

            if (pictureBox1.Image != null)
            {
                bmp = (Bitmap)pictureBox1.Image.Clone();
            }

            Color[] paleta1;
            paleta1 = new Color[16];

            paleta1[0]  = Color.Black;
            paleta1[1]  = Color.Navy;
            paleta1[2]  = Color.Green;
            paleta1[3]  = Color.Aqua;
            paleta1[4]  = Color.Red;
            paleta1[5]  = Color.Purple;
            paleta1[6]  = Color.Maroon;
            paleta1[7]  = Color.FromArgb(150, 150, 150);
            paleta1[8]  = Color.FromArgb(90, 90, 90);
            paleta1[9]  = Color.Blue;
            paleta1[10] = Color.Lime;
            paleta1[11] = Color.Silver;
            paleta1[12] = Color.Teal;
            paleta1[13] = Color.Fuchsia;
            paleta1[14] = Color.Yellow;
            paleta1[15] = Color.White;

            int    ColorT;
            double x, y, z = 0, z1 = 0, z2 = 0, z3;

            for (int i = 0; i < 640; i++)
            {
                for (int j = 0; j < 480; j++)
                {
                    //z1 = 1.5 * (Math.Sqrt((x +1) * (x +1) + (y - 0) * (y - 0))) - 9.3 * 0;
                    //z2 = 1.5 * (Math.Sqrt((x - 0) * (x - 0) + (y + 0) * (y + 0))) - 9.3 * 0;
                    //z3 = 1.5 * (Math.Sqrt((x - 1) * (x - 1) + (y + 0) * (y + 0))) - 9.3 * 0;
                    //for (int l = 0; l < 20; j++)
                    //{
                    //    z2 = 1.5 * Math.Sqrt(Math.Sqrt(x-10+l)+Math.Sqrt(y)-9.3*0);
                    //    z1 = 1 * Math.Sin(z2)+z1;

                    //}
                    for (int k = 0; k < 20; k++)
                    {
                        vector pant = new vector();
                        pant.Transforma(i, j, out x, out y);
                        z  = Math.Sin(z) + 1;
                        z  = (1.5 * (Math.Sqrt((x - 10 + k) * (x - 10 + k) + (y) * (y))) - 9.3 * 0);
                        z1 = Math.Sin(z) + 1;
                    }

                    //z1 = Math.Sin(z1) + 1;
                    //z2 = Math.Sin(z2) + 1;
                    //z3 = Math.Sin(z3) + 1;
                    //z = z1 + z2;
                    ColorT = (int)(21 + z) * (15 / 42);
                    bmp.SetPixel(i, j, paleta1[ColorT]);
                    pictureBox1.Image = bmp;
                }
            }
        }