Ejemplo n.º 1
0
        /// <summary>
        /// Gets the Original Color
        /// </summary>
        public void RetrieveOriginalPalette()
        {
            //Gives the Original Palette According to the HSB Model
            ColorPalette pal = canvas.Palette;
            float        saturation = 0.8f;
            float        hue, brightness;
            HSB          hsb = new HSB();

            for (int i = 0; i <= 255; i++)
            {
                hue        = (float)i / (float)MAX;
                brightness = 1.0f - hue * hue;
                hsb.FromHSB(hue, saturation, brightness);
                pal.Entries[i] = Color.FromArgb(hsb.rChan, hsb.gChan, hsb.bChan);
            }
            canvas.Palette = pal;
        }
Ejemplo n.º 2
0
        private void Mandelbrot() // calculate all points
        {
            int   x, y;
            float h, b, alt = 0.0f;
            Pen   pen = new Pen(Color.White);

            action             = false;
            pictureBox1.Cursor = c2;


            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);


                        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;
        }