Esempio n. 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Wg.Graphic graphic = Wg.Graphics.FillBlack;
            if (!DA.GetData(0, ref graphic))
            {
                graphic = new Wg.Graphic(graphic);
            }

            List <Color> colors = new List <Color>();

            DA.GetDataList(1, colors);

            List <double> stops = new List <double>();

            DA.GetDataList(2, stops);

            double angle = 0;

            DA.GetData(3, ref angle);

            List <Wg.Color> windColors = new List <Wg.Color>();

            foreach (Color color in colors)
            {
                windColors.Add(color.ToWindColor());
            }

            Wg.GradientLinear gradient = new Wg.GradientLinear(windColors, stops);
            gradient.Angle = angle;
            graphic.Fill   = gradient;

            DA.SetData(0, graphic);
        }
Esempio n. 2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Wg.Graphic graphic = new Wg.Graphic();
            if (!DA.GetData(0, ref graphic))
            {
                graphic = new Wg.Graphic(graphic);
            }

            Color color = Color.Black;

            DA.GetData(1, ref color);

            double radius = 1.0;

            DA.GetData(2, ref radius);
            double angle = 0.0;

            DA.GetData(3, ref angle);
            double distance = 0.0;

            DA.GetData(4, ref distance);

            graphic.Effects.Shadow = new Wg.ShadowEffect(color.ToWindColor(), radius, angle, distance);

            DA.SetData(0, graphic);
        }
Esempio n. 3
0
        public static string ToSVGclass(this Wg.Graphic input)
        {
            string output = input.Stroke.ToSVG() + Environment.NewLine;

            output += input.Fill.ToSVG() + Environment.NewLine;

            return(output);
        }
Esempio n. 4
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Wg.Graphic graphic = Wg.Graphics.FillBlack;
            Color      color   = Color.Black;

            if (!DA.GetData(0, ref graphic))
            {
                graphic = new Wg.Graphic(graphic);
            }
            DA.GetData(1, ref color);

            graphic.Fill.Background = color.ToWindColor();

            DA.SetData(0, graphic);
        }
Esempio n. 5
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Wg.Graphic graphic = new Wg.Graphic();
            if (!DA.GetData(0, ref graphic))
            {
                graphic = new Wg.Graphic(graphic);
            }

            double radius = 1.0;

            DA.GetData(1, ref radius);

            graphic.Effects.Blur = new Wg.BlurEffect(radius);

            DA.SetData(0, graphic);
        }
Esempio n. 6
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Wg.Graphic graphic = Wg.Graphics.FillBlack;
            if (!DA.GetData(0, ref graphic))
            {
                graphic = new Wg.Graphic(graphic);
            }

            List <Color> colors = new List <Color>();

            DA.GetDataList(1, colors);

            List <double> stops = new List <double>();

            DA.GetDataList(2, stops);

            Point3d center = new Point3d(0.5, 0.5, 0);

            DA.GetData(3, ref center);

            Point3d focus = new Point3d(0.5, 0.5, 0);

            DA.GetData(4, ref focus);

            double radius = 1.0;

            DA.GetData(5, ref radius);

            List <Wg.Color> windColors = new List <Wg.Color>();

            foreach (Color color in colors)
            {
                windColors.Add(color.ToWindColor());
            }

            Wg.GradientRadial gradient = new Wg.GradientRadial(windColors, stops);
            gradient.Center  = new Wind.Geometry.Point(center.X, center.Y, 0);
            gradient.Focus   = new Wind.Geometry.Point(focus.X, focus.Y, 0);
            gradient.RadiusX = radius;
            gradient.RadiusY = radius;

            graphic.Fill = gradient;

            DA.SetData(0, graphic);
        }
Esempio n. 7
0
        public static string ToSVG(this Wg.Graphic input)
        {
            string output = input.Stroke.ToSVG() + Environment.NewLine;

            switch (input.Fill.FillType)
            {
            case Wg.Fill.FillTypes.LinearGradient:
                output += ((Wg.GradientLinear)input.Fill).ToSVG();
                break;

            case Wg.Fill.FillTypes.RadialGradient:
                output += ((Wg.GradientRadial)input.Fill).ToSVG();
                break;

            default:
                output += input.Fill.ToSVG();
                break;
            }

            return(output);
        }
Esempio n. 8
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Wg.Graphic graphic = Wg.Graphics.StrokeBlack;
            if (!DA.GetData(0, ref graphic))
            {
                graphic = new Wg.Graphic(graphic);
            }

            Color color = Color.Black;

            DA.GetData(1, ref color);

            double weight = 1.0;

            DA.GetData(2, ref weight);

            graphic.Stroke.Color  = color.ToWindColor();
            graphic.Stroke.Weight = weight;

            DA.SetData(0, graphic);
        }