Exemplo n.º 1
0
        private void pictureBox1_Click3(object sender, EventArgs e)
        {
            nnn    = new Noiz(rnd.Next() % 99);
            nnnn   = new Noiz(rnd.Next() % 99);
            nn     = new Noiz((rnd.Next() % 99) - 20);
            bitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            int srW = pictureBox1.Width / 2;
            int srH = pictureBox1.Height / 2;

            bitmap.SetPixel(srW, srH, Color.FromArgb(255, 255, 255));
            #region fory
            for (w = srW + 1; w < pictureBox1.Width; w++)
            {
                bitmap.SetPixel(w, srH, Color.FromArgb(
                                    // 255,255,255
                                    nn.DoTheThing(bitmap.GetPixel(w - 1, srH).R),
                                    nn.DoTheThing(bitmap.GetPixel(w - 1, srH).G),
                                    nn.DoTheThing(bitmap.GetPixel(w - 1, srH).B)
                                    ));
            }
            for (w = srW - 1; w > 0; w--)
            {
                bitmap.SetPixel(w, srH, Color.FromArgb(
                                    nn.DoTheThing(bitmap.GetPixel(w + 1, srH).R),
                                    nn.DoTheThing(bitmap.GetPixel(w + 1, srH).G),
                                    nn.DoTheThing(bitmap.GetPixel(w + 1, srH).B)
                                    ));
            }
            #endregion fory


            for (h = srH - 1; h > 0; h--)
            {
                for (w = pictureBox1.Width - 9; w > 9; w--)
                {
                    bitmap.SetPixel(w, h, Color.FromArgb(
                                        (nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).R) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).R)) / 2,
                                        (nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).G) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).G)) / 2,
                                        (nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).B) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).B)) / 2
                                        //   r, g, b
                                        ));
                }
            }

            for (h = srH + 1; h < pictureBox1.Height; h++)
            {
                for (w = 9; w < pictureBox1.Width - 9; w++)
                {
                    bitmap.SetPixel(w, h, Color.FromArgb(

                                        (nnnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).R) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).R)) / 2,
                                        (nnnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).G) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).G)) / 2,
                                        (nnnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).B) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).B)) / 2
                                        ));
                }
            }

            pictureBox1.Image = bitmap;
            bitmap.Save("bity.jpg");
        }
Exemplo n.º 2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            nnn = new Noiz(rnd.Next(99));
            nn  = new Noiz(rnd.Next(99));
            int chooser = rnd.Next(5);

            switch (chooser)
            {
            case 0: pictureBox1_Click1(sender, e); break;

            case 1: pictureBox1_Click2(sender, e); break;

            case 2: pictureBox1_Click3(sender, e); break;

            case 3: pictureBox1_Click4(sender, e); break;

            case 4: pictureBox1_ClickXX(sender, e); break;
            }
        }
Exemplo n.º 3
0
        private void pictureBox1_Click4(object sender, EventArgs e)
        {
            nnn    = new Noiz(rnd.Next() % 88 + 11);
            nnnn   = new Noiz(rnd.Next() % 88 + 11);
            nn     = new Noiz(rnd.Next() % 88 + 11);
            bitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            int    srW = pictureBox1.Width / 2;
            int    srH = pictureBox1.Height / 2;
            int    r, x, y;
            int    alf;
            double wsp22 = 14;

            //for (h = 0; h < pictureBox1.Height; h++)
            //    for (w = 0; w < pictureBox1.Width; w++)
            //        bitmap.SetPixel(w, h, Color.Black);
            bitmap.SetPixel(srW, srH, Color.FromArgb(1, 1, 1));
            #region fory

            for (r = 1; r < 7; r++)
            {
                for (alf = 0; alf < 77; alf++)
                {
                    x = srW + (int)(Math.Sin((alf / 77.0) * 2 * Math.PI) * r);
                    y = srH + (int)(Math.Cos((alf / 77.0) * 2 * Math.PI) * r);
                    bitmap.SetPixel(x, y, Color.FromArgb(
                                        11, 11, 11
                                        ));
                }
            }
            #endregion fory

            //  x1 = 22;
            int r1 = 13;

            for (r = 6; r < srH - 5; r++)
            {
                for (alf = 0; alf < wsp22 * r; alf++)
                {
                    int x1 = rnd.Next(22);
                    int x2 = rnd.Next(7);
                    //     x2 = 0;
                    x = srW + (int)(Math.Sin((alf / (wsp22 * r)) * 2 * Math.PI) * r);
                    y = srH + (int)(Math.Cos((alf / (wsp22 * r)) * 2 * Math.PI) * r);
                    int xt  = srW + (int)(Math.Sin(((alf + (x1 - x2)) / (wsp22 * r)) * 2 * Math.PI) * (r - 4 - rnd.Next(3)));
                    int yt  = srH + (int)(Math.Cos(((alf + (x1 - x2)) / (wsp22 * r)) * 2 * Math.PI) * (r - 4 - rnd.Next(3)));
                    int xt1 = srW + (int)(Math.Sin(((alf + (x1 - x2)) / (wsp22 * r)) * 2 * Math.PI) * (r - 4 - rnd.Next(3)));
                    int yt1 = srH + (int)(Math.Cos(((alf + (x1 - x2)) / (wsp22 * r)) * 2 * Math.PI) * (r - 4 - rnd.Next(3)));


                    bitmap.SetPixel(x, y, Color.FromArgb(
                                        (nnn.DoTheThing(bitmap.GetPixel(xt, yt).R) + nn.DoTheThing(bitmap.GetPixel(xt1, yt1).R)) / 2,
                                        (nnnn.DoTheThing(bitmap.GetPixel(xt, yt).G) + nnn.DoTheThing(bitmap.GetPixel(xt1, yt1).G)) / 2,
                                        (nn.DoTheThing(bitmap.GetPixel(xt, yt).B) + nnnn.DoTheThing(bitmap.GetPixel(xt1, yt1).B)) / 2
                                        ));
                }
            }

            //for (h = srH - 1; h > 0; h--)
            //    for (w = pictureBox1.Width - 9; w > 9; w--)
            //    {

            //        bitmap.SetPixel(w, h, Color.FromArgb(
            //                   (nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).R) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).R)) / 2,
            //                    (nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).G) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).G)) / 2,
            //                     (nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).B) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h + 1).B)) / 2
            //                //   r, g, b
            //                ));
            //    }

            //for (h = srH + 1; h < pictureBox1.Height ; h++)
            //    for (w = 9; w < pictureBox1.Width - 9; w++)
            //        bitmap.SetPixel(w, h, Color.FromArgb(

            //                                           (nnnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).R) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).R)) / 2,
            //                                           (nnnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).G) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).G)) / 2,
            //                                           (nnnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).B) + nnn.DoTheThing(bitmap.GetPixel(w + rnd.Next(7) - 3, h - 1).B)) / 2
            //                                            ));

            pictureBox1.Image = bitmap;
            bitmap.Save("bity.jpg");
        }