コード例 #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)
        {
            // Declare variables
            IGH_Goo X     = null;
            int     Xsize = 0;
            int     Ysize = 0;
            int     F     = 0;
            int     S     = 0;

            // Access the input parameters
            if (!DA.GetData(0, ref X))
            {
                return;
            }
            if (!DA.GetData(1, ref F))
            {
                return;
            }
            if (!DA.GetData(2, ref S))
            {
                return;
            }
            if (!DA.GetData(3, ref Xsize))
            {
                return;
            }
            if (!DA.GetData(4, ref Ysize))
            {
                return;
            }

            if (F != ModeIndex)
            {
                ModeIndex = F;
                UpdateMessage();
            }

            if (S != TypeIndex)
            {
                TypeIndex = S;
                UpdateMessage();
            }

            wObject Z = new wObject();

            if (X != null)
            {
                X.CastTo(out Z);
            }
            mLayer L = new mLayer((mLayer)Z.Element);

            L.SetSizing(F, S, Xsize, Ysize);

            wObject W = new wObject(L, "Macaw", L.Type);


            DA.SetData(0, W);
        }
コード例 #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)
        {
            // Declare variables
            IGH_Goo X     = null;
            int     MoveX = 0;
            int     MoveY = 0;
            int     Angle = 0;

            // Access the input parameters
            if (!DA.GetData(0, ref X))
            {
                return;
            }
            if (!DA.GetData(1, ref MoveX))
            {
                return;
            }
            if (!DA.GetData(2, ref MoveY))
            {
                return;
            }
            if (!DA.GetData(3, ref Angle))
            {
                return;
            }

            wObject Z = new wObject();

            if (X != null)
            {
                X.CastTo(out Z);
            }
            mLayer L = new mLayer((mLayer)Z.Element);

            L.SetPosition(MoveX, MoveY);
            L.SetRotation(Angle);

            wObject W = new wObject(L, "Macaw", L.Type);


            DA.SetData(0, W);
        }
コード例 #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)
        {
            // Declare variables
            List <IGH_Goo> X = new List <IGH_Goo>();

            // Access the input parameters
            if (!DA.GetDataList(0, X))
            {
                return;
            }

            List <mLayer> Layers = new List <mLayer>();

            foreach (IGH_Goo InputObject in X)
            {
                wObject Z = new wObject();
                if (InputObject != null)
                {
                    InputObject.CastTo(out Z);
                }
                mLayer LayerObject = new mLayer((mLayer)Z.Element);

                Layers.Add(LayerObject);
            }

            Bitmap C = null;

            mComposition CompositionObject = new mComposition(Layers);

            CompositionObject.BuildComposition();

            C = CompositionObject.CompositionBitmap;

            //wObject W = new wObject(CompositionObject, "Macaw", CompositionObject.Type);


            DA.SetData(0, C);
        }
コード例 #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)
        {
            // Declare variables
            IGH_Goo X = null;

            // Access the input parameters
            if (!DA.GetData(0, ref X))
            {
                return;
            }

            wObject Z = new wObject();

            if (X != null)
            {
                X.CastTo(out Z);
            }
            mLayer L = new mLayer((mLayer)Z.Element);

            switch (ModeIndex)
            {
            case 0:
                IGH_Goo Y = null;
                Bitmap  A = new Bitmap(10, 10);

                if (!DA.GetData(1, ref Y))
                {
                    return;
                }
                if (Y != null)
                {
                    Y.CastTo(out A);
                }
                Bitmap B = (Bitmap)A.Clone();

                L.SetImageMask(B);

                break;

            case 1:
                Color  C = Color.Black;
                double V = 1.0;
                if (!DA.GetData(1, ref C))
                {
                    return;
                }
                if (!DA.GetData(2, ref V))
                {
                    return;
                }

                L.SetColorMask(new wColor(C.A, C.R, C.G, C.B), V);

                break;
            }


            wObject W = new wObject(L, "Macaw", L.Type);


            DA.SetData(0, W);
        }
コード例 #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)
        {
            // Declare variables
            IGH_Goo       X = null;
            List <int>    M = new List <int>();
            List <double> V = new List <double>();
            List <Color>  C = new List <Color>();

            // Access the input parameters
            if (!DA.GetData(0, ref X))
            {
                return;
            }
            if (!DA.GetDataList(1, M))
            {
                return;
            }
            if (!DA.GetDataList(2, V))
            {
                return;
            }
            if (!DA.GetDataList(3, C))
            {
                return;
            }

            int total = M.Count;

            if (V.Count > total)
            {
                total = V.Count;
            }
            if (C.Count > total)
            {
                total = C.Count;
            }

            int i = 0;
            int j = M.Count;

            for (i = j; i < total; i++)
            {
                M.Add(M[j - 1]);
            }

            j = V.Count;
            for (i = j; i < total; i++)
            {
                V.Add(V[j - 1]);
            }

            j = C.Count;
            for (i = j; i < total; i++)
            {
                C.Add(C[j - 1]);
            }

            wObject Z = new wObject();

            if (X != null)
            {
                X.CastTo(out Z);
            }
            mLayer L = new mLayer((mLayer)Z.Element);

            List <mModifier> modifiers = new List <mModifier>();

            foreach (mModifier mm in L.Modifiers)
            {
                modifiers.Add(mm);
            }

            int[] Ma = M.ToArray();

            string tID = String.Join("~", Ma);

            if (tID != ID)
            {
                Array.Sort(Ma);
                Array.Reverse(Ma);
                int Mi = Ma[0];

                ModeIndex = Ma;
                UpdateMessage();

                if (Mi < 4)
                {
                    Params.Input[2].NickName = "-";
                }
                else
                {
                    Params.Input[2].NickName = "V";
                }
                if (Mi < 9)
                {
                    Params.Input[3].NickName = "-";
                }
                else
                {
                    Params.Input[3].NickName = "C";
                }
                if (Mi < 9)
                {
                    Params.Input[3].Description = "Not used by this filter";
                }
                else
                {
                    Params.Input[3].Description = "Color";
                }
            }

            //L.Modifiers.Clear();

            for (i = 0; i < M.Count; i++)
            {
                mModifier modifier = null;
                switch (M[i])
                {
                case 0:    //Invert
                    modifier = new mModifyInvert();
                    break;

                case 1:    //Solarize
                    modifier = new mModifySolarize();
                    break;

                case 2:    //Grayscale
                    modifier = new mModifyGrayscale();
                    break;

                case 3:    //Vignette
                    modifier = new mModifyVignette();
                    break;

                case 4:    //Emboss
                    modifier = new mModifyEmboss((float)V[i]);
                    break;

                case 5:    //Brightness
                    modifier = new mModifyBrightness((int)V[i]);
                    break;

                case 6:    //Contrast
                    modifier = new mModifyContrast((int)V[i]);
                    break;

                case 7:    //Feather
                    modifier = new mModifyFeather((int)V[i]);
                    break;

                case 8:    //Gaussian
                    modifier = new mModifyGaussian(1 + (int)V[i]);
                    break;

                case 9:    //Border
                    modifier = new mModifyGaussian((int)V[i]);
                    break;

                case 10:    //Tint
                    modifier = new mModifyColorTint(new Wind.Types.wColor(C[i].A, C[i].R, C[i].G, C[i].B), (int)V[i]);
                    break;
                }
                modifiers.Add(modifier);
            }

            L.Modifiers = modifiers;

            wObject W = new wObject(L, "Macaw", L.Type);


            DA.SetData(0, W);
            DA.SetData(1, L.Modifiers.Count);
        }