public ColorEditor(RectangleF Rect) : base(Rect)
        {
            float Padding = 10;
            float X       = Padding;

            ColorScaleSlider       = new Slider(new RectangleF(X, Padding, 30, Rect.Height - Padding * 2));
            ColorScaleSlider.Value = 0.5;
            ChildElements.Add(ColorScaleSlider);
            X += ColorScaleSlider.Rect.Width + Padding;
            MainCircleOuterRadius = Rect.Height / 2 - Padding;
            MainCirclePosition    = new Vector2(X + MainCircleOuterRadius, Padding + MainCircleOuterRadius);
            X += MainCircleOuterRadius * 2 + Padding;
            InnerCircleRadius     = MainCircleOuterRadius * 0.3f;
            MainCircleInnerRadius = MainCircleOuterRadius * 0.6f;

            ColorPalette[0]     = Color4.Orange;
            ColorPalette[1]     = Color4.DarkBlue;
            ColorPalette[2]     = Color4.Cyan;
            PalettePositions[0] = 0.0f;
            PalettePositions[1] = 0.33f;
            PalettePositions[2] = 0.66f;
            CurrentPaletteSize  = 3;
            InteriorColor       = Color.Black;
            DragEvent          += MainDrag;
            MouseDownEvent     += MouseDown;
            HoverEvent         += MouseHover;
            MouseUpEvent       += MouseUp;
            float SliderHeight = (Rect.Height - Padding * 4) / 3;

            Color[] Colors = new Color[] { Color.Red, Color.Lime, Color.Blue };
            for (int i = 0; i < 3; i++)
            {
                ColorSliders[i] = new Slider(new RectangleF(X, Padding + (SliderHeight + Padding) * i, 140, SliderHeight));
                ColorSliders[i].BackgroundColor = Colors[i];
                ChildElements.Add(ColorSliders[i]);
            }
            X += 140 + Padding;
            DotStrengthSlider       = new Slider(new RectangleF(X, Padding, 30, Rect.Height - Padding * 2));
            DotStrengthSlider.Value = 1;
            X += 30 + Padding;
            ChildElements.Add(DotStrengthSlider);
            ColorScaleSlider.SliderEvent += ScaleSliderChanged;
            DistanceColoringButton        = new FractalWindow(new RectangleF(X, Padding, 50, 50));
            DistanceColoringButton.Controller.CameraPos = new Complex(-0.037896351914748, 0.682660083979483);
            DistanceColoringButton.Controller.Zoom      = 0.005;
            DistanceColoringButton.EnableInteraction    = false;
            DistanceColoringButton.MouseDownEvent      += DistanceColorButtonClicked;
            DistanceColoringButton.Controller.DistanceEstimateEnabled = true;
            DistanceColoringButton.Controller.ColorScale = 5;
            ChildElements.Add(DistanceColoringButton);
        }
        public ExampleLocationComponent(float x, float y, AutoZoomController zoomController, Main M) : base(new RectangleF(x, y, Width, Height))
        {
            this.M = M;
            this.zoomController = zoomController;
            string Data = Resources.ExampleLocations;

            string[] lines = Data.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);

            List <ExampleLocationStructs> locations = new List <ExampleLocationStructs>();

            for (int i = lines.Length - 1; i >= 0; i--)
            {
                string[] parts = lines[i].Split(':');
                if (parts[0] == "function")
                {
                    var exampleFunction = new ExampleFunctionStruct();
                    exampleFunction.exampleLocations = locations;
                    exampleFunction.functionString   = parts[1];
                    locations = new List <ExampleLocationStructs>();
                    Examples.Insert(0, exampleFunction);
                }
                else if (parts[0] == "location")
                {
                    var      exampleLocation = new ExampleLocationStructs();
                    string[] locationParts   = parts[1].Split('|');
                    exampleLocation.position = new Complex();
                    if (!double.TryParse(locationParts[0], out exampleLocation.position.real))
                    {
                        Console.WriteLine(locationParts[0] + " is not a valid double");
                        break;
                    }
                    if (!double.TryParse(locationParts[1], out exampleLocation.position.imag))
                    {
                        Console.WriteLine(locationParts[1] + " is not a valid double");
                        break;
                    }
                    if (!double.TryParse(locationParts[2], out exampleLocation.zoom))
                    {
                        Console.WriteLine(locationParts[2] + " is not a valid double");
                        break;
                    }
                    if (!int.TryParse(locationParts[3], out exampleLocation.iter))
                    {
                        Console.WriteLine(locationParts[3] + " is not a valid integer");
                        break;
                    }
                    locations.Add(exampleLocation);
                }
                else
                {
                    Console.WriteLine(parts[0] + " is not a valid modifier");
                    break;
                }
            }
            for (int i = 0; i < ExampleLocationWindows.Length; i++)
            {
                ExampleLocationWindows[i] = new FractalWindow(new RectangleF(10 + SideButtonWidth + (FractalWindowSize + 10) * i, FractalWindowSize + 32, FractalWindowSize, FractalWindowSize));
                ChildElements.Add(ExampleLocationWindows[i]);
                ExampleLocationWindows[i].EnableInteraction = false;
                ExampleLocationWindows[i].MouseDownEvent   += FractalWindowClick;
            }

            int X = (FractalWindowSize + 10) * (ExampleLocationWindows.Length - 1);

            FunctionFractalWindow = new FractalWindow(new RectangleF(10 + SideButtonWidth + X, 10, FractalWindowSize, FractalWindowSize));
            FunctionFractalWindow.EnableInteraction = false;
            FunctionFractalWindow.MouseDownEvent   += FractalWindowClick;
            ChildElements.Add(FunctionFractalWindow);
            polynomialDisplay = new TextDisplay(new RectangleF(10 + SideButtonWidth, 10, X - 10, FractalWindowSize));
            polynomialDisplay.PrepareDraw();
            ChildElements.Add(polynomialDisplay);
            currentExample  = Examples[0];
            MouseDownEvent += MainWindowClicked;
        }
Beispiel #3
0
 public void PrepareFromExisting(GuiComponents.FractalWindow Original)
 {
     StartLocation = GetDataFromWindow(MainWindow.Controller);
     EndLocation   = GetDataFromWindow(Original.Controller);
     PreCompute();
 }