示例#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)
        {
            Ml.Layer input = new Ml.Layer();
            if (!DA.GetData(0, ref input))
            {
                return;
            }
            Ml.Layer layer = new Ml.Layer(input);

            int mode = 0;

            DA.GetData(1, ref mode);
            Ml.Modifier modifier = new Ml.Modifier((Ml.Modifier.ModifierModes)mode);

            double value = 0.0;

            if (DA.GetData(2, ref value))
            {
                modifier.Value = value;
            }

            Color color = Color.Black;

            if (DA.GetData(3, ref color))
            {
                modifier.Color = color.ToWindColor();
            }

            layer.Modifiers.Add(modifier);

            DA.SetData(0, layer);
        }
示例#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)
        {
            Ml.Layer input = new Ml.Layer();
            if (!DA.GetData(0, ref input))
            {
                return;
            }
            Ml.Layer layer = new Ml.Layer(input);

            Vector3d vector = new Vector3d();

            if (DA.GetData(1, ref vector))
            {
                layer.X = (int)vector.X;
                layer.Y = (int)vector.Y;
            }
            ;

            int angle = 0;

            if (DA.GetData(2, ref angle))
            {
                layer.Angle = angle;
            }

            int width = 0;

            if (DA.GetData(3, ref width))
            {
                layer.Width = width;
            }

            int height = 0;

            if (DA.GetData(4, ref height))
            {
                layer.Height = height;
            }

            int mode = 0;

            if (DA.GetData(5, ref mode))
            {
                layer.FittingMode = (Ml.Layer.FittingModes)mode;
            }

            DA.SetData(0, layer);
        }
示例#3
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)
        {
            IGH_Goo goo    = null;
            Bitmap  bitmap = new Bitmap(100, 100);

            if (!DA.GetData(0, ref goo))
            {
                return;
            }
            if (!goo.TryGetBitmap(ref bitmap))
            {
                return;
            }

            Ml.Layer layer = new Ml.Layer(bitmap);

            IGH_Goo gooM    = null;
            Bitmap  bitmapM = new Bitmap(100, 100);

            if (DA.GetData(1, ref gooM))
            {
                if (goo.TryGetBitmap(ref bitmapM))
                {
                    layer.Mask = bitmapM;
                }
            }

            int blendMode = 0;

            DA.GetData(2, ref blendMode);

            double opacity = 1.0;

            DA.GetData(3, ref opacity);

            layer.BlendMode = (Ml.Layer.BlendModes)blendMode;
            layer.Opacity   = 100 * opacity;

            DA.SetData(0, layer);
        }
示例#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)
        {
            List <IGH_Goo> goos = new List <IGH_Goo>();

            if (!DA.GetDataList(0, goos))
            {
                return;
            }

            Ml.Composition composition = new Ml.Composition();

            foreach (IGH_Goo goo in goos)
            {
                Ml.Layer layer = new Ml.Layer();
                if (goo.CastTo <Ml.Layer>(out layer))
                {
                    composition.Layers.Add(new Ml.Layer(layer));
                }
            }

            Bitmap bitmap = composition.GetBitmap();

            DA.SetData(0, new Image(bitmap));
        }
示例#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)
        {
            IGH_Goo goo = null;
            Bitmap  top = new Bitmap(100, 100);

            if (!DA.GetData(0, ref goo))
            {
                return;
            }
            if (!goo.TryGetBitmap(ref top))
            {
                return;
            }

            Mp.Layer topLayer = new Mp.Layer(top);

            IGH_Goo gooT   = null;
            Bitmap  bottom = new Bitmap(100, 100);

            if (!DA.GetData(1, ref gooT))
            {
                return;
            }
            if (!gooT.TryGetBitmap(ref bottom))
            {
                return;
            }

            Mp.Layer bottomLayer = new Mp.Layer(bottom);

            IGH_Goo gooM    = null;
            Image   img     = new Image();
            bool    hasMask = false;
            Bitmap  mask    = new Bitmap(100, 100);

            if (DA.GetData(2, ref gooM))
            {
                if (gooM.TryGetImage(ref img))
                {
                    hasMask = true;
                    img.SwapChannel(Image.Channels.Luminance, Image.Channels.Alpha);
                    mask = img.Bitmap;
                }
            }

            int blendMode = 0;

            DA.GetData(3, ref blendMode);

            double opacity = 1.0;

            DA.GetData(4, ref opacity);

            topLayer.BlendMode = (Mp.Layer.BlendModes)blendMode;
            topLayer.Opacity   = 100 * opacity;
            if (hasMask)
            {
                topLayer.Mask = mask;
            }

            Mp.Composition composition = new Mp.Composition();
            composition.Layers.Add(bottomLayer);
            composition.Layers.Add(topLayer);

            DA.SetData(0, new Image(composition.GetBitmap()));
        }