Ejemplo n.º 1
0
 public static Grasshopper.GUI.Gradient.GH_Gradient Gh2ColorsGradient(Color c0, Color c1, double t0 = 0, double t1 = 1)
 {
     Grasshopper.GUI.Gradient.GH_Gradient gradient = new Grasshopper.GUI.Gradient.GH_Gradient();
     gradient.AddGrip(t0, c0);
     gradient.AddGrip(t1, c1);
     return(gradient);
 }
Ejemplo n.º 2
0
 public static Color GetColourGradient(int charge, int max)
 {
     Grasshopper.GUI.Gradient.GH_Gradient gradient = new Grasshopper.GUI.Gradient.GH_Gradient();
     gradient.AddGrip(max, Color.FromArgb(234, 28, 0));           //Red
     gradient.AddGrip(max * 0.75, Color.FromArgb(234, 126, 0));   //Orange
     gradient.AddGrip(max * 0.50, Color.FromArgb(254, 244, 84));  //Gelb
     gradient.AddGrip(max * 0.25, Color.FromArgb(173, 203, 179)); //babyblau
     gradient.AddGrip(0, Color.FromArgb(75, 107, 169));           //blau
     return(gradient.ColourAt(charge));
 }
Ejemplo n.º 3
0
        public static Grasshopper.GUI.Gradient.GH_Gradient Stress_Gradient(List <System.Drawing.Color> colours = null)
        {
            Grasshopper.GUI.Gradient.GH_Gradient gH_Gradient = new Grasshopper.GUI.Gradient.GH_Gradient();

            if (colours.Count < 2 || colours == null)
            {
                gH_Gradient.AddGrip(-1, System.Drawing.Color.FromArgb(0, 0, 206));
                gH_Gradient.AddGrip(-0.666, System.Drawing.Color.FromArgb(0, 127, 229));
                gH_Gradient.AddGrip(-0.333, System.Drawing.Color.FromArgb(90, 220, 186));
                gH_Gradient.AddGrip(0, System.Drawing.Color.FromArgb(205, 254, 114));
                gH_Gradient.AddGrip(0.333, System.Drawing.Color.FromArgb(255, 220, 71));
                gH_Gradient.AddGrip(0.666, System.Drawing.Color.FromArgb(255, 127, 71));
                gH_Gradient.AddGrip(1, System.Drawing.Color.FromArgb(205, 0, 71));
            }
            else
            {
                for (int i = 0; i < colours.Count; i++)
                {
                    double t = 1.0 - 2.0 / ((double)colours.Count - 1.0) * (double)i;
                    gH_Gradient.AddGrip(t, colours[i]);
                }
            }

            return(gH_Gradient);
        }
Ejemplo n.º 4
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            int numDiv = 40;

            Grasshopper.GUI.Gradient.GH_Gradient gH_Gradient = new Grasshopper.GUI.Gradient.GH_Gradient();
            gH_Gradient.AddGrip(0, m_colour1);
            gH_Gradient.AddGrip(1, m_colour2);

            for (int i = 0; i < numDiv + 1; i++)
            {
                double t   = (double)i / numDiv;
                Color  col = gH_Gradient.ColourAt(t);
                int    thk = (int)Math.Abs(((m_size2 - m_size1) * t + m_size1));
                Line   ln  = new Line(Value.PointAt((double)i / (numDiv - 1)), Value.PointAt((double)(i + 1) / (numDiv - 1)));
                args.Pipeline.DrawLine(ln, col, thk);
            }
        }
Ejemplo n.º 5
0
        /***************************************************/

        // Create standard colour gradient for showing the results.
        public static Grasshopper.GUI.Gradient.GH_Gradient CreateStandardGradient()
        {
            Grasshopper.GUI.Gradient.GH_Gradient gradient = new Grasshopper.GUI.Gradient.GH_Gradient();
            gradient.AddGrip(0.000, Color.Blue);
            gradient.AddGrip(0.125, Color.SkyBlue);
            gradient.AddGrip(0.250, Color.Cyan);
            gradient.AddGrip(0.375, Color.SpringGreen);
            gradient.AddGrip(0.500, Color.GreenYellow);
            gradient.AddGrip(0.625, Color.Yellow);
            gradient.AddGrip(0.750, Color.Orange);
            gradient.AddGrip(0.875, Color.Red);
            gradient.AddGrip(1.000, Color.Brown);
            return(gradient);
        }
Ejemplo n.º 6
0
        public static Grasshopper.GUI.Gradient.GH_Gradient GetStandardGradient(double lim0, double lim1)
        {
            double span = lim1 - lim0;

            if (lim1 <= lim0)
            {
                throw new Exception("Bad limiters");
            }


            Grasshopper.GUI.Gradient.GH_Gradient grad = new Grasshopper.GUI.Gradient.GH_Gradient();
            grad.AddGrip(0, System.Drawing.Color.Blue);
            grad.AddGrip(lim0, System.Drawing.Color.Blue);
            grad.AddGrip(lim0 + span * 0.25, System.Drawing.Color.Cyan);
            grad.AddGrip(lim0 + span * 0.5, System.Drawing.Color.LimeGreen);
            grad.AddGrip(lim0 + span * 0.75, System.Drawing.Color.Yellow);
            grad.AddGrip(lim1, System.Drawing.Color.Red);
            grad.AddGrip(1, System.Drawing.Color.Red);


            return(grad);
        }