Beispiel #1
0
        private void mandelbrot(int num = 0) // calculate all points
        {
            int   x, y;
            float h, b, alt = 0.0f;

            action = false;


            for (x = 0; x < x1; x += 2)
            {
                for (y = 0; y < y1; y++)
                {
                    h = pointcolour(xstart + xzoom * (double)x, ystart + yzoom * (double)y); // color value
                    if (h != alt)
                    {
                        b = 1.0f - h * h;                                  // brightness
                        HSBcol.fromHSB(h * 255, 0.8f * 255, b * 255, num); //convert hsb to rgb then make a Java Color
                        Color col = Color.FromArgb((int)HSBcol.rChan, (int)HSBcol.gChan, (int)HSBcol.bChan);

                        pen = new Pen(col);

                        alt = h;
                    }
                    g1.DrawLine(pen, x, y, x + 1, y);
                }
                action     = true;
                isFirstRun = false;
            }
        }
        private void mandelbrot() // calculate all points
        {
            int   x, y;
            float h, b, alt = 0.0f;
            Pen   pen = new Pen(Color.White);

            action         = false;
            this.Cursor    = c1; // in java setCursor(c1)
            picBox1.Cursor = c2;

            //showStatus("Mandelbrot-Set will be produced - please wait..."); will do later
            for (x = 0; x < x1; x += 2)
            {
                for (y = 0; y < y1; y++)
                {
                    h = pointcolour(xstart + xzoom * (double)x, ystart + yzoom * (double)y); // hue value

                    if (h != alt)
                    {
                        b = 1.0f - h * h;           // brightness

                        HSBcol.fromHSB(h, 0.8f, b); //convert hsb to rgb then make a Java Color
                        Color col = Color.FromArgb(Convert.ToByte(HSBcol.rChan), Convert.ToByte(HSBcol.gChan), Convert.ToByte(HSBcol.bChan));

                        pen = new Pen(col);

                        //djm end
                        //djm added to convert to RGB from HSB

                        alt = h;
                    }
                    g1.DrawLine(pen, new Point(x, y), new Point(x + 1, y)); // drawing pixel
                }
                //showStatus("Mandelbrot-Set ready - please select zoom area with pressed mouse.");
                Cursor.Current = c1;
            }

            picBox1.Image = picture;
            action        = true;
        }
Beispiel #3
0
        private void mandelbrot(int change = 0) //calculate mandelbrot points
        {
            int   x, y;
            float h, b, alt = 0.0f;

            action = false;
            //pictureBox1.Cursor = c1; ( java cursor)
            //pictureBox1.Cursor = c2;

            //showStatus("Mandelbrot-Set will be produced - please wait...");
            for (x = 0; x < x1; x += 2)
            {
                for (y = 0; y < y1; y++)
                {
                    h = pointcolour(xstart + xzoom * (double)x, ystart + yzoom * (double)y); // color value
                    if (h != alt)
                    {
                        b = 1.0f - h * h; // brightnes
                                          //djm added
                        HSBcol.fromHSB(h * 255, 0.8f * 255, b * 255, change);

                        Color col = Color.FromArgb((int)HSBcol.rChan, (int)HSBcol.gChan, (int)HSBcol.bChan);//g1.setColor(col);

                        pen = new Pen(col);


                        //djmg1.setColor(col);

                        alt = h;
                    }
                    g1.DrawLine(pen, x, y, x + 1, y);
                }
            }
            //showStatus("Mandelbrot-Set ready - please select zoom area with pressed mouse.");
            textBox1.Text    = "Mandelbrot-Set ready - please select zoom area with pressed mouse.";
            textBox1.Enabled = false;
            action           = true;
        }
Beispiel #4
0
        private void mandelbrot(int num = 0) // calculate all points
        {
            int   x, y;
            float h, b, alt = 0.0f;

            action = false;
            //Dispalying message in text box before mandelbrot is ready
            textBox1.Text    = "Mandelbrot-Set will be produced - please wait...";
            textBox1.Enabled = false;
            for (x = 0; x < x1; x += 2)
            {
                for (y = 0; y < y1; y++)
                {
                    h = pointcolour(xstart + xzoom * (double)x, ystart + yzoom * (double)y); // color value

                    if (h != alt)
                    {
                        b = 1.0f - h * h; // brightnes
                        ///djm added

                        HSBcol.fromHSB(h * 255, 0.8f * 255, b * 255, num); //convert hsb to rgb then make a Java Color
                        Color col = Color.FromArgb((int)HSBcol.rChan, (int)HSBcol.gChan, (int)HSBcol.bChan);
                        pen = new Pen(col);

                        alt = h;
                    }

                    g1.DrawLine(pen, x, y, x + 1, y);
                }
            }
            //Displaying message after mandlebrot is ready
            Cursor.Current = Cursors.Cross;
            textBox1.Text  = "Mandelbrot-Set ready - please select and zoom with pressed mouse." +
                             " Different options are available on 'Menu'";
            textBox1.Enabled = false;

            action = true;
        }
Beispiel #5
0
        private void mandelbrot() // calculate all points
        {
            int   x, y;
            float h, b, alt = 0.0f;

            action = false;
            //showStatus("Mandelbrot-Set will be produced - please wait...");
            //info.Text = "Please wait for the Mandelbrot!";
            //info.Enabled = false;

            for (x = 0; x < x1; x += 2)
            {
                for (y = 0; y < y1; y++)
                {
                    h = pointcolour(xstart + xzoom * (double)x, ystart + yzoom * (double)y); // color value
                    if (h != alt)
                    {
                        b = 1.0f - h * h;                             // brightnes
                        ///djm added
                        HSBcol.fromHSB(h * 255, 0.8f * 255, b * 255); //convert hsb to rgb then make a Java Color
                        Color col = Color.FromArgb((int)HSBcol.rChan, (int)HSBcol.gChan, (int)HSBcol.bChan);
                        Pen   p   = new Pen(col);

                        alt = h;
                    }
                    g1.DrawLine(pen, x, y, x + 1, y);
                }
            }
            // showStatus("Mandelbrot-Set ready - please select zoom area with pressed mouse.");

            Cursor.Current = Cursors.Cross;
            //info.Text = "aa";
            //info.Enabled=false;

            action = true;
        }