예제 #1
0
        public override void draw(Graphics g, int x1, int y1, double xs, double ys, double xz, double yz, int max)
        {
            alt = 0.0f;

            for (x = 0; x < x1; x += 2)
            {
                for (y = 0; y < y1; y++)
                {
                    h = calculateHue(xs + xz * (double)x, ys + yz * (double)y, max); // hue value

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

                        Color col = HSBcol.setHSBValues(h, 0.8f, b) // converts hsb to rgb then return Color object
                                    .toRGB();

                        pen = new Pen(col);

                        alt = h;
                    }

                    g.DrawLine(pen, new Point(x, y), new Point(x + 1, y)); // drawing pixel
                }
            }
        }
예제 #2
0
        private void mandelbrot()
        {
            try
            {
                int   x, y;
                float h, b, alt = 0.0f;
                Pen   pen = new Pen(Color.White);

                // action = false;
                //this.Cursor = c1; // in java setCursor(c1)
                pictureBox1.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;
                    action            = true;
                    pictureBox1.Image = picture;
                }
            }

            catch
            {
            }
        }